@groovy.transform.CompileStatic class MessageConsumer extends java.lang.Object
An event bus consumer object representing a stream of message to an EventBus address that can be read from.
The EventBus.consumer or EventBus.localConsumer creates a new consumer, the returned consumer is not yet registered against the event bus. Registration is effective after the MessageConsumer.handler method is invoked.
The consumer is unregistered from the event bus using the MessageConsumer.unregister method or by calling the MessageConsumer.handler with a null value..
Constructor and description |
---|
MessageConsumer
(java.lang.Object delegate) |
Type | Name and description |
---|---|
java.lang.String |
address()
|
ReadStream<T> |
bodyStream()
|
void |
completionHandler(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler) Optional method which can be called to indicate when the registration has been propagated across the cluster. |
MessageConsumer<T> |
endHandler(io.vertx.core.Handler<java.lang.Void> endHandler) |
MessageConsumer<T> |
exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler) |
java.lang.Object |
getDelegate() |
int |
getMaxBufferedMessages() @return
|
MessageConsumer<T> |
handler(io.vertx.core.Handler<Message<T>> handler) |
boolean |
isRegistered() @return
|
MessageConsumer<T> |
pause() |
MessageConsumer<T> |
resume() |
MessageConsumer<T> |
setMaxBufferedMessages(int maxBufferedMessages) Set the number of messages this registration will buffer when this stream is paused. |
void |
unregister() Unregisters the handler which created this registration |
void |
unregister(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler) Unregisters the handler which created this registration |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Optional method which can be called to indicate when the registration has been propagated across the cluster.
completionHandler
- the completion handler
Set the number of messages this registration will buffer when this stream is paused. The default
value is 0
. When a new value is set, buffered messages may be discarded to reach
the new value.
maxBufferedMessages
- the maximum number of messages that can be bufferedUnregisters the handler which created this registration
Unregisters the handler which created this registration
completionHandler
- the handler called when the unregister is done. For example in a cluster when all nodes of the event bus have been unregistered.