An event bus consumer object representing a stream of message to an EventBus address that can be read from.

The consumer or localConsumer creates a new consumer, the returned consumer is not yet registered against the event bus. Registration is effective after the handler method is invoked.

The consumer is unregistered from the event bus using the unregister method or by calling the handler with a null value..

no subtypes hierarchy

MessageConsumer(MessageConsumer<out Object> unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
addressshared default String address()
bodyStreamshared default ReadStream<T> bodyStream()
completionHandlershared default void completionHandler(Anything(Throwable?) completionHandler)

Optional method which can be called to indicate when the registration has been propagated across the cluster.

  • completionHandler

    the completion handler

endHandlershared actual default MessageConsumer<T> endHandler(Anything()? endHandler)

Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.

exceptionHandlershared actual default MessageConsumer<T> exceptionHandler(Anything(Throwable)? handler)

Set an exception handler.

getMaxBufferedMessagesshared default Integer getMaxBufferedMessages()
handlershared actual default MessageConsumer<T> handler(Anything(Message<T>)? handler)

Set a data handler. As data is read, the handler will be called with the data.

isRegisteredshared default Boolean isRegistered()
pauseshared actual default MessageConsumer<T> pause()

Pause the ReadSupport. While it's paused, no data will be sent to the dataHandler

resumeshared actual default MessageConsumer<T> resume()

Resume reading. If the ReadSupport has been paused, reading will recommence on it.

setMaxBufferedMessagesshared default MessageConsumer<T> setMaxBufferedMessages(Integer maxBufferedMessages)

Set the number of messages this registration will buffer when this stream is paused. The default value is 1000. 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 buffered

unregistershared default void unregister()

Unregisters the handler which created this registration

unregistershared default void unregister(Anything(Throwable?) completionHandler)

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.

Inherited Methods
Methods inherited from: Object
Methods inherited from: ReadStream<T>
Methods inherited from: StreamBase