Extensive annotation-based Redis Pub-Sub wrapper for lettuce written in Kotlin.

  • Aware was written to be a replacement for the very dated Banana library.
  • Aware allows for both asynchronous and synchronous contexts.
  • Aware contain wrappers for the RedisCodec<K, V>.
    • These codec wrappers are only used for message values, therefore they only accept one type, V. (WrappedRedisCodec<V>)
    • We have multiple wrapper types available:
      • StringRedisCodec
      • JsonRedisCodec<V>
        • AwareMessageCodec (A default implementation of JsonRedisCodec, for the AwareMessage)
  • Aware uses a platform-level credential & serialization provider.
    • Aware currently ONLY supports Gson.
    • Aware credential & serialization providers can be configured by using AwareHub#configure()
  • Aware is an annotation-based.
    • More traditional solutions will be implemented in the future.


An example pub-sub subscription for an AwareMessage codec:

@ExpiresIn(30L, TimeUnit.SECONDS)
fun onTestExpiresIn30Seconds(
    message: AwareMessage
    val horse = message.retrieve<String>("horse")

    println("Hey! It's not been 30 seconds. :) ($horse)")

An example AwareMessage use case:

    "test", aware,
    "horse" to "heyy-${Random.nextFloat()}"
    // supplying our own thread context

An example AwareHub configuration:

    // the default credentials would be localhost:6379, no password.
) {

An example AwareBuilder configuration:

val aware = AwareBuilder
    // You can do this:
    // Or you can do this:
    .codec(object : JsonRedisCodec<AwareMessage>(AwareMessage::class) {
        override fun getPacketId(v: AwareMessage) = v.packet

Future plans:

  • Allow for upstream message encryption, after the provided WrappedRedisCodec<V> does its thing.
  • Allow for conversation channels (A -> B, B -> A) (Both sides are notified of the opposite response)
  • Allow for traditional, lambda based subscriptions.

Other information:

lettuce-core is automatically shaded into the final shadowJar. kotlin-stdlib & kotlin-reflect are NOT.


If you’re using this in a closed-source project, please add GrowlyX to the project’s author section.


View Github