Class MessageConsumer<T>
- All Implemented Interfaces:
MutinyDelegate,ReadStream<Message<T>>,StreamBase
EventBus address that can
be read from.
The EventBus.consumer(java.lang.String) or EventBus.localConsumer(java.lang.String)
creates a new consumer, the returned consumer is not yet registered against the event bus. Registration
is effective after the handler(java.util.function.Consumer<io.vertx.mutiny.core.eventbus.Message<T>>) method is invoked.
The consumer is unregistered from the event bus using the unregister() method or by calling the
handler(java.util.function.Consumer<io.vertx.mutiny.core.eventbus.Message<T>>) with a null value..
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageConsumer(io.vertx.core.eventbus.MessageConsumer delegate) MessageConsumer(io.vertx.core.eventbus.MessageConsumer delegate, TypeArg<T> typeArg_0) MessageConsumer(Object delegate, TypeArg<T> typeArg_0) -
Method Summary
Modifier and TypeMethodDescriptionaddress()io.smallrye.mutiny.Uni<Void>Optional method which can be called to indicate when the registration has been propagated across the cluster.Blocking variant ofcompletionHandler().voidVariant ofcompletionHandler()that ignores the result of the operation.endHandler(Runnable endHandler) booleanexceptionHandler(Consumer<Throwable> handler) fetch(long amount) io.vertx.core.eventbus.MessageConsumerintinthashCode()booleanstatic <T> MessageConsumer<T>newInstance(io.vertx.core.eventbus.MessageConsumer arg) static <T> MessageConsumer<T>newInstance(io.vertx.core.eventbus.MessageConsumer arg, TypeArg<T> __typeArg_T) pause()pipe()io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<Message<T>> dst) Pipe thisReadStreamto theWriteStream.pipeToAndAwait(WriteStream<Message<T>> dst) Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream).voidpipeToAndForget(WriteStream<Message<T>> dst) Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)that ignores the result of the operation.resume()setMaxBufferedMessages(int maxBufferedMessages) toMulti()toString()io.smallrye.mutiny.Uni<Void>Unregisters the handler which created this registrationBlocking variant ofunregister().voidVariant ofunregister()that ignores the result of the operation.
-
Field Details
-
__TYPE_ARG
-
__typeArg_0
-
-
Constructor Details
-
MessageConsumer
public MessageConsumer(io.vertx.core.eventbus.MessageConsumer delegate) -
MessageConsumer
-
MessageConsumer
-
-
Method Details
-
getDelegate
public io.vertx.core.eventbus.MessageConsumer getDelegate()- Specified by:
getDelegatein interfaceMutinyDelegate- Specified by:
getDelegatein interfaceReadStream<T>- Specified by:
getDelegatein interfaceStreamBase- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
pipe
- Specified by:
pipein interfaceReadStream<T>- Returns:
- a pipe
-
pipeTo
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Specified by:
pipeToin interfaceReadStream<T>- Parameters:
dst- the destination write stream- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
pipeToAndAwaitin interfaceReadStream<T>- Parameters:
dst- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)that ignores the result of the operation.This method subscribes on the result of
ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)but you don't need to compose it with other operations.- Specified by:
pipeToAndForgetin interfaceReadStream<T>- Parameters:
dst- the destination write stream
-
exceptionHandler
- Specified by:
exceptionHandlerin interfaceReadStream<T>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
-
handler
- Specified by:
handlerin interfaceReadStream<T>- Returns:
-
pause
- Specified by:
pausein interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
resume
- Specified by:
resumein interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
- Specified by:
fetchin interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
- Specified by:
endHandlerin interfaceReadStream<T>- Returns:
-
bodyStream
- Returns:
- a read stream for the body of the message stream.
-
isRegistered
public boolean isRegistered()- Returns:
- true if the current consumer is registered
-
address
- Returns:
- The address the handler was registered with.
-
setMaxBufferedMessages
- Parameters:
maxBufferedMessages- the maximum number of messages that can be buffered- Returns:
- this registration
-
getMaxBufferedMessages
public int getMaxBufferedMessages()- Returns:
- the maximum number of messages that can be buffered when this stream is paused
-
completionHandler
Optional method which can be called to indicate when the registration has been propagated across the cluster.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
completionHandlerAndAwait
Blocking variant ofcompletionHandler().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
completionHandlerAndForget
public void completionHandlerAndForget()Variant ofcompletionHandler()that ignores the result of the operation.This method subscribes on the result of
completionHandler(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromcompletionHandler()but you don't need to compose it with other operations. -
unregister
Unregisters the handler which created this registrationUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
unregisterAndAwait
Blocking variant ofunregister().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
unregisterAndForget
public void unregisterAndForget()Variant ofunregister()that ignores the result of the operation.This method subscribes on the result of
unregister(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromunregister()but you don't need to compose it with other operations. -
toMulti
- Specified by:
toMultiin interfaceReadStream<T>
-
toBlockingIterable
-
toBlockingStream
-
newInstance
-
newInstance
public static <T> MessageConsumer<T> newInstance(io.vertx.core.eventbus.MessageConsumer arg, TypeArg<T> __typeArg_T)
-