Interface WithEventBus
- All Superinterfaces:
io.vertx.core.Verticle
public interface WithEventBus
extends io.vertx.core.Verticle
Allows
Verticle
instances to get simplified access to the Vert.x event bus.
All methods allow usage with JsonMessage
messages, too.
Usage
public class MyVerticle extends TelestionVerticle implements WithEventBus {
@Override
public void startVerticle() {
register("channel-1", this::handle, SimpleMessage.class);
}
private void handle(SimpleMessage body) {
logger.info("Received Telecommand: {}", body.tcClass());
}
}
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
publish(String address, JsonMessage message)
default void
publish(String address, JsonMessage message, io.vertx.core.eventbus.DeliveryOptions options)
default void
default void
default <T extends JsonMessage>
voidregister(String address, ExtendedMessageHandler<T> handler, Class<T> type)
Registers a handler onto an eventbus channel.default <T extends JsonMessage>
voidregister(String address, MessageHandler<T> handler, Class<T> type)
Registers a handler onto an eventbus channel.default void
Registers a handler onto an eventbus channel.default <T extends JsonMessage>
io.vertx.core.Future<DecodedMessage<T>>request(String address, JsonMessage request, io.vertx.core.eventbus.DeliveryOptions options, Class<T> responseType)
default <T extends JsonMessage>
io.vertx.core.Future<DecodedMessage<T>>request(String address, JsonMessage request, Class<T> responseType)
default <T extends JsonMessage>
io.vertx.core.Future<DecodedMessage<T>>request(String address, Object request, io.vertx.core.eventbus.DeliveryOptions options, Class<T> responseType)
default <T extends JsonMessage>
io.vertx.core.Future<DecodedMessage<T>>default void
send(String address, JsonMessage message)
default void
send(String address, JsonMessage message, io.vertx.core.eventbus.DeliveryOptions options)
default void
default void
Methods inherited from interface io.vertx.core.Verticle
getVertx, init, start, stop
-
Method Details
-
publish
default void publish(String address, Object message, io.vertx.core.eventbus.DeliveryOptions options)- See Also:
EventBus.publish(String, Object, DeliveryOptions)
-
publish
default void publish(String address, JsonMessage message, io.vertx.core.eventbus.DeliveryOptions options)- See Also:
EventBus.publish(String, Object, DeliveryOptions)
-
publish
- See Also:
EventBus.publish(String, Object)
-
publish
- See Also:
EventBus.publish(String, Object)
-
send
- See Also:
EventBus.send(String, Object, DeliveryOptions)
-
send
default void send(String address, JsonMessage message, io.vertx.core.eventbus.DeliveryOptions options)- See Also:
EventBus.send(String, Object, DeliveryOptions)
-
send
- See Also:
EventBus.send(String, Object)
-
send
- See Also:
EventBus.send(String, Object)
-
request
default <T extends JsonMessage> io.vertx.core.Future<DecodedMessage<T>> request(String address, Object request, io.vertx.core.eventbus.DeliveryOptions options, Class<T> responseType)- Parameters:
responseType
- the type of the response to map to- See Also:
EventBus.request(String, Object, DeliveryOptions)
-
request
default <T extends JsonMessage> io.vertx.core.Future<DecodedMessage<T>> request(String address, JsonMessage request, io.vertx.core.eventbus.DeliveryOptions options, Class<T> responseType) -
request
default <T extends JsonMessage> io.vertx.core.Future<DecodedMessage<T>> request(String address, Object request, Class<T> responseType)- Parameters:
responseType
- the type of the response to map to- See Also:
EventBus.request(String, Object)
-
request
default <T extends JsonMessage> io.vertx.core.Future<DecodedMessage<T>> request(String address, JsonMessage request, Class<T> responseType) -
register
default void register(String address, io.vertx.core.Handler<io.vertx.core.eventbus.Message<Object>> handler)Registers a handler onto an eventbus channel.- Parameters:
address
- the eventbus address namehandler
- the handler that gets called when a new message arrives at the specified eventbus address- See Also:
EventBus.consumer(String, Handler)
-
register
default <T extends JsonMessage> void register(String address, MessageHandler<T> handler, Class<T> type)Registers a handler onto an eventbus channel. The received messages are mapped to the specified json type before handing over to the handler.- Parameters:
address
- the eventbus address namehandler
- the handler that gets called when a new message arrives at the specified eventbus addresstype
- the json type to map to- See Also:
EventBus.consumer(String, Handler)
-
register
default <T extends JsonMessage> void register(String address, ExtendedMessageHandler<T> handler, Class<T> type)Registers a handler onto an eventbus channel. The received messages are mapped to the specified json type before handing over to the handler. The handler gets the plain message object received from the eventbus, too.- Parameters:
address
- the eventbus address namehandler
- the handler that gets called when a new message arrives at the specified eventbus addresstype
- the json type to map to
-