Class EventBus
- All Implemented Interfaces:
MutinyDelegate
,Measured
An event-bus supports publish-subscribe messaging, point-to-point messaging and request-response messaging.
Message delivery is best-effort and messages can be lost if failure of all or part of the event bus occurs.
Please refer to the documentation for more information on the event bus.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> EventBus
addInboundInterceptor
(Consumer<DeliveryContext<T>> interceptor) <T> EventBus
addOutboundInterceptor
(Consumer<DeliveryContext<T>> interceptor) clusterSerializableChecker
(Function<String, Boolean> classNamePredicate) codecSelector
(Function<Object, String> selector) <T> MessageConsumer<T>
<T> MessageConsumer<T>
boolean
io.vertx.core.eventbus.EventBus
int
hashCode()
boolean
<T> MessageConsumer<T>
localConsumer
(String address) <T> MessageConsumer<T>
localConsumer
(String address, Consumer<Message<T>> handler) static EventBus
newInstance
(io.vertx.core.eventbus.EventBus arg) <T> MessageProducer<T>
<T> MessageProducer<T>
registerCodec
(io.vertx.core.eventbus.MessageCodec codec) <T> EventBus
removeInboundInterceptor
(Consumer<DeliveryContext<T>> interceptor) <T> EventBus
removeOutboundInterceptor
(Consumer<DeliveryContext<T>> interceptor) <T> io.smallrye.mutiny.Uni<Message<T>>
Sends a message and specify areplyHandler
that will be called if the recipient subsequently replies to the message.<T> io.smallrye.mutiny.Uni<Message<T>>
Likerequest(java.lang.String, java.lang.Object)
but specifyingoptions
that can be used to configure the delivery.<T> Message<T>
requestAndAwait
(String address, Object message) Blocking variant ofrequest(String,Object)
.<T> Message<T>
requestAndAwait
(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) Blocking variant ofrequest(String,Object,DeliveryOptions)
.<T> EventBus
requestAndForget
(String address, Object message) Variant ofrequest(String,Object)
that ignores the result of the operation.<T> EventBus
requestAndForget
(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) Variant ofrequest(String,Object,DeliveryOptions)
that ignores the result of the operation.<T> MessageProducer<T>
<T> MessageProducer<T>
serializableChecker
(Function<String, Boolean> classNamePredicate) toString()
unregisterCodec
(String name)
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
EventBus
public EventBus(io.vertx.core.eventbus.EventBus delegate) -
EventBus
-
-
Method Details
-
getDelegate
public io.vertx.core.eventbus.EventBus getDelegate()- Specified by:
getDelegate
in interfaceMeasured
- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
isMetricsEnabled
public boolean isMetricsEnabled()- Specified by:
isMetricsEnabled
in interfaceMeasured
- Returns:
true
if metrics are enabled
-
send
- Parameters:
address
- the address to send it tomessage
- the message, may benull
- Returns:
- a reference to this, so the API can be used fluently
-
send
public EventBus send(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) - Parameters:
address
- the address to send it tomessage
- the message, may benull
options
- delivery options- Returns:
- a reference to this, so the API can be used fluently
-
request
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<Message<T>> request(String address, Object message) Sends a message and specify areplyHandler
that will be called if the recipient subsequently replies to the message.The message will be delivered to at most one of the handlers registered to the address.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
address
- the address to send it tomessage
- the message body, may benull
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
requestAndAwait
Blocking variant ofrequest(String,Object)
.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).
- Parameters:
address
- the address to send it tomessage
- the message body, may benull
- Returns:
- the Message
instance produced by the operation.
-
requestAndForget
Variant ofrequest(String,Object)
that ignores the result of the operation.This method subscribes on the result of
request(String,Object)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromrequest(String,Object)
but you don't need to compose it with other operations.- Parameters:
address
- the address to send it tomessage
- the message body, may benull
- Returns:
- the instance of EventBus to chain method calls.
-
request
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<Message<T>> request(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) Likerequest(java.lang.String, java.lang.Object)
but specifyingoptions
that can be used to configure the delivery.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
address
- the address to send it tomessage
- the message body, may benull
options
- delivery options- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
requestAndAwait
public <T> Message<T> requestAndAwait(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) Blocking variant ofrequest(String,Object,DeliveryOptions)
.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).
- Parameters:
address
- the address to send it tomessage
- the message body, may benull
options
- delivery options- Returns:
- the Message
instance produced by the operation.
-
requestAndForget
public <T> EventBus requestAndForget(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) Variant ofrequest(String,Object,DeliveryOptions)
that ignores the result of the operation.This method subscribes on the result of
request(String,Object,DeliveryOptions)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromrequest(String,Object,DeliveryOptions)
but you don't need to compose it with other operations.- Parameters:
address
- the address to send it tomessage
- the message body, may benull
options
- delivery options- Returns:
- the instance of EventBus to chain method calls.
-
publish
- Parameters:
address
- the address to publish it tomessage
- the message, may benull
- Returns:
- a reference to this, so the API can be used fluently
-
publish
public EventBus publish(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options) - Parameters:
address
- the address to publish it tomessage
- the message, may benull
options
- the delivery options- Returns:
- a reference to this, so the API can be used fluently
-
consumer
- Parameters:
address
- the address that it will register it at- Returns:
- the event bus message consumer
-
consumer
- Parameters:
address
- the address that will register it athandler
- the handler that will process the received messages- Returns:
-
localConsumer
- Parameters:
address
- the address to register it at- Returns:
- the event bus message consumer
-
localConsumer
- Parameters:
address
- the address that will register it athandler
- the handler that will process the received messages- Returns:
-
sender
- Parameters:
address
- the address to send it to- Returns:
- The sender
-
sender
public <T> MessageProducer<T> sender(String address, io.vertx.core.eventbus.DeliveryOptions options) - Parameters:
address
- the address to send it tooptions
- the delivery options- Returns:
- The sender
-
publisher
- Parameters:
address
- The address to publish it to- Returns:
- The publisher
-
publisher
public <T> MessageProducer<T> publisher(String address, io.vertx.core.eventbus.DeliveryOptions options) - Parameters:
address
- the address to publish it tooptions
- the delivery options- Returns:
- The publisher
-
codecSelector
- Parameters:
selector
- the codec selector- Returns:
- a reference to this, so the API can be used fluently
-
addOutboundInterceptor
- Parameters:
interceptor
- the interceptor- Returns:
-
removeOutboundInterceptor
- Parameters:
interceptor
- the interceptor- Returns:
-
addInboundInterceptor
- Parameters:
interceptor
- the interceptor- Returns:
-
removeInboundInterceptor
- Parameters:
interceptor
- the interceptor- Returns:
-
clusterSerializableChecker
- Parameters:
classNamePredicate
- the predicate- Returns:
- a reference to this, so the API can be used fluently
-
serializableChecker
- Parameters:
classNamePredicate
- the predicate- Returns:
- a reference to this, so the API can be used fluently
-
registerCodec
- Parameters:
codec
- the message codec to register- Returns:
- a reference to this, so the API can be used fluently
-
unregisterCodec
- Parameters:
name
- the name of the codec- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
-