Skip to content

Commit

Permalink
Update README.md (#13)
Browse files Browse the repository at this point in the history
* Update README.md

* Update README.md
  • Loading branch information
portlek authored Jun 9, 2024
1 parent c33c5e7 commit a900d6c
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
### Gradle
```groovy
repositories {
maven("https://jitpack.io/")
mavenCentral()
}
dependencies {
Expand All @@ -19,6 +19,11 @@ dependencies {
// Required, https://mvnrepository.com/artifact/io.lettuce/lettuce-core/
implementation "io.lettuce:lettuce-core:6.3.2.RELEASE"
// A simple codec using Jackson (Optional)
implementation "net.infumia:pubsub-jackson:VERSION"
// Required, https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation "com.fasterxml.jackson.core:jackson-databind:2.17.1"
// Kotlin extensions (Optional)
implementation "net.infumia:pubsub-kotlin:VERSION"
Expand All @@ -33,6 +38,29 @@ dependencies {
}
```
### Code
```java
void pubsub() {}
```kotlin
fun main() {
val mapper = ObjectMapper()
val redisCredentials = RedisCredentials.just(null, "local")
val redisAuth = StaticCredentialsProvider(redisCredentials)
val redisUri = RedisURI.builder()
.withHost("localhost")
.withPort(6379)
.withAuthentication(redisAuth)
.build()
val client = RedisClient.create(redisUri)
val codecProviderJackson = CodecProviderJackson { mapper }
val codecProvider = CodecProviderCached(codecProviderJackson)
val broker = BrokerRedisNoTargetProvider(codecProvider) { client }
broker.initialize()
broker.listen<Test> {
println(it.test)
}
while (true) {
broker.send(Test("Hello World"))
Thread.sleep(1000L)
}
}

class Test(var test: String = "")
```

0 comments on commit a900d6c

Please sign in to comment.