Kuba Petržílka
11/19/2021, 5:04 PMsuspend fun sampleProcessingFunction(message: AmqpMessage<String>): Outcome<AmqpConsumingError, Unit> {
becomes just: suspend fun sampleProcessingFunction(message: AmqpMessage): Outcome {
first day I m using it and I already found 3 really bad bugs.. or am I doing something wrong?Vadim Mishenev
11/21/2021, 10:41 PMgildor
11/22/2021, 9:20 AMKuba Petržílka
11/22/2021, 9:24 AM3. Create instance of the connector using DSL and start publishing and/or consuming messages
class ExampleResource {
val connector = connector(role = PublisherAndConsumer) {
connectionString = "<amqp://guest:guest@localhost:5672/>"
clientName = "sample-app"
consumer(::sampleProcessingFunction) {
workersCoroutineScope = applicationCoroutineScope
exchange { name = "some-ref-data" }
bindingKey = "refdata.*.user.#"
}
}
val publisher = connector.publisher {
exchange { name = "somedata-exchange" }
routingKey = "somedata.cool.special"
}
suspend fun sampleProcessingFunction(message: AmqpMessage<String>): Outcome<AmqpConsumingError, Unit> {
println(message.payload)
return Success(Unit)
}
suspend fun sendSamplePublication(request: String): Outcome<AmqpPublishingError, Unit> =
publisher(AmqpMessage(request))
}
See [connector][no.dossier.libraries.amqpconnector.dsl.connector],
[consumer][no.dossier.libraries.amqpconnector.dsl.consumer],
[publisher][no.dossier.libraries.amqpconnector.dsl.publisher],
and [rpcClient][no.dossier.libraries.amqpconnector.dsl.rpcClient]
DSL functions for more details and examples
gildor
11/22/2021, 9:25 AMKuba Petržílka
11/22/2021, 9:27 AMgildor
11/22/2021, 9:34 AMprobably not yet production readywell, this why it still in Alpha
Kuba Petržílka
11/22/2021, 10:04 AMgildor
11/25/2021, 4:43 AM