An integration module that offers simplified APIs that use KotlinX serialization to subscribe to Json values. It's an addition to Gcp PubSub KotlinX Serialization Json for Ktor.
Name | Description |
---|---|
[subscribe/subscribeDeserialized] | Subscribe to a subscription to process types annotation with @Serializable using KotlinX Serialization Json |
@Serializable
data class Event(val key: String, val message: String)
fun Application.pubSub(): Job =
pubSub(ProjectId("my-project")) {
subscribe<Event>(SubscriptionId("my-subscription")) { (event, record) ->
println("event.key: ${event.key}, event.message: ${event.message}")
record.ack()
}
}
Add dependencies (you can also add other modules that you need):
dependencies {
implementation("io.github.nomisrev:gcp-pubsub-ktor-kotlinx-serialization-json:1.0.0")
}
Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>io.github.nomisrev</groupId>
<artifactId>gcp-pubsub-ktor-kotlinx-serialization-json</artifactId>
<version>1.0.0</version>
</dependency>