public interface MessageConsumer<T>
Message consumers listen for messages from MessageProducers for a topic().
Multiple consumers may listen to the same topic from the same or different nodes within the cluster.
Producers route messages to consumers in round-robin order, so if multiple consumers are registered
for the same topic, messages will be evenly split among them.
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
close()
Closes the consumer.
|
MessageConsumer<T> |
onMessage(Function<T,?> consumer)
Sets a message consumer callback.
|
String |
topic()
Returns the topic for which the consumer consumes messages.
|
String topic()
MessageConsumer<T> onMessage(Function<T,?> consumer)
The provided Function will be called when a message is received from a MessageProducer.
Function return values are sent back to the producer as response values. The function can return a synchronous
value or a CompletableFuture. Consumer return values are handled transparently. If a consumer returns
a future, the message bus will wait for the future to be completed before sending a response.
consumer - The callback to call when a message is received by the consumer.NullPointerException - if consumer is nullCompletableFuture<Void> close()
Copyright © 2013–2015. All rights reserved.