public class HandlerRegistration<T> extends Object implements MessageConsumer<T>, Handler<Message<T>>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_BUFFERED_MESSAGES |
| Constructor and Description |
|---|
HandlerRegistration(Vertx vertx,
EventBusMetrics metrics,
EventBusImpl eventBus,
String address,
String repliedAddress,
boolean localOnly,
Handler<AsyncResult<Message<T>>> asyncResultHandler,
long timeout) |
| Modifier and Type | Method and Description |
|---|---|
String |
address() |
ReadStream<T> |
bodyStream() |
void |
completionHandler(Handler<AsyncResult<Void>> completionHandler)
Optional method which can be called to indicate when the registration has been propagated across the cluster.
|
void |
discardHandler(Handler<Message<T>> handler) |
MessageConsumer<T> |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
MessageConsumer<T> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
MessageConsumer<T> |
fetch(long amount)
Fetch the specified
amount of elements. |
Handler<Message<T>> |
getHandler() |
int |
getMaxBufferedMessages() |
Object |
getMetric() |
void |
handle(Message<T> message)
Something has happened, so handle it.
|
MessageConsumer<T> |
handler(Handler<Message<T>> h)
Set a data handler.
|
boolean |
isRegistered() |
MessageConsumer<T> |
pause()
Pause the
ReadStream, it sets the buffer in fetch mode and clears the actual demand. |
MessageConsumer<T> |
resume()
Resume reading, and sets the buffer in
flowing mode. |
void |
sendAsyncResultFailure(ReplyException failure) |
MessageConsumer<T> |
setMaxBufferedMessages(int maxBufferedMessages)
Set the number of messages this registration will buffer when this stream is paused.
|
void |
setResult(AsyncResult<Void> result) |
void |
unregister()
Unregisters the handler which created this registration
|
void |
unregister(Handler<AsyncResult<Void>> completionHandler)
Unregisters the handler which created this registration
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpipe, pipeTo, pipeTopublic static final int DEFAULT_MAX_BUFFERED_MESSAGES
public HandlerRegistration(Vertx vertx, EventBusMetrics metrics, EventBusImpl eventBus, String address, String repliedAddress, boolean localOnly, Handler<AsyncResult<Message<T>>> asyncResultHandler, long timeout)
public MessageConsumer<T> setMaxBufferedMessages(int maxBufferedMessages)
MessageConsumer1000.
When a new value is set, buffered messages may be discarded to reach the new value. The most recent messages will be kept.
setMaxBufferedMessages in interface MessageConsumer<T>maxBufferedMessages - the maximum number of messages that can be bufferedpublic int getMaxBufferedMessages()
getMaxBufferedMessages in interface MessageConsumer<T>public String address()
address in interface MessageConsumer<T>public void completionHandler(Handler<AsyncResult<Void>> completionHandler)
MessageConsumercompletionHandler in interface MessageConsumer<T>completionHandler - the completion handlerpublic void unregister()
MessageConsumerunregister in interface MessageConsumer<T>public void unregister(Handler<AsyncResult<Void>> completionHandler)
MessageConsumerunregister in interface MessageConsumer<T>completionHandler - the handler called when the unregister is done. For example in a cluster when all nodes of the
event bus have been unregistered.public void sendAsyncResultFailure(ReplyException failure)
public void setResult(AsyncResult<Void> result)
public void handle(Message<T> message)
Handlerpublic MessageConsumer<T> handler(Handler<Message<T>> h)
ReadStreamhandler in interface MessageConsumer<T>handler in interface ReadStream<Message<T>>public ReadStream<T> bodyStream()
bodyStream in interface MessageConsumer<T>public boolean isRegistered()
isRegistered in interface MessageConsumer<T>public MessageConsumer<T> pause()
ReadStreamReadStream, it sets the buffer in fetch mode and clears the actual demand.
While it's paused, no data will be sent to the data handler.
pause in interface MessageConsumer<T>pause in interface ReadStream<Message<T>>public MessageConsumer<T> resume()
ReadStreamflowing mode.
If the ReadStream has been paused, reading will recommence on it.resume in interface MessageConsumer<T>resume in interface ReadStream<Message<T>>public MessageConsumer<T> fetch(long amount)
ReadStreamamount of elements. If the ReadStream has been paused, reading will
recommence with the specified amount of items, otherwise the specified amount will
be added to the current stream demand.fetch in interface MessageConsumer<T>fetch in interface ReadStream<Message<T>>public MessageConsumer<T> endHandler(Handler<Void> endHandler)
ReadStreamendHandler in interface MessageConsumer<T>endHandler in interface ReadStream<Message<T>>public MessageConsumer<T> exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface MessageConsumer<T>exceptionHandler in interface ReadStream<Message<T>>exceptionHandler in interface StreamBasehandler - the exception handlerpublic Object getMetric()
Copyright © 2020. All rights reserved.