Class EventBusHandler
java.lang.Object
io.vertx.redis.client.EventBusHandler
A handler that can be installed on a Redis connection using
RedisConnection.handler(Handler)
in order to consume subscription messages and send them on the Vert.x event bus.
The message sent to the Vert.x event bus is a JsonObject with the following format:
{
"status": "OK",
"type": "message|subscribe|unsubscribe|pmessage|psubscribe|punsubscribe",
"value": {
"channel": "<the channel>", // for `[p]message`, `subscribe` and `unsubscribe`
"message": "<the message>", // for `[p]message`
"pattern": "<the pattern>", // for `pmessage`, `psubscribe` and `punsubscribe`
"current": <number of current subscriptions> // for `[p]subscribe` and `[p]unsubscribe`
}
}
By default, the address to which the messages are sent is io.vertx.redis.<the channel>.
This can be changed by passing a different address prefix to create(Vertx, String).
For example, if the prefix is com.example, the address is com.example.<the channel>.
Note that for messages of types psubscribe and punsubscribe, there is no channel
name. Therefore, these messages are sent to the address of <prefix>.<the pattern>.
-
Method Summary
Modifier and TypeMethodDescriptionstatic EventBusHandlerCreates a subscription handler that forwards messages to the event bus of the givenvertx.static EventBusHandlerCreates a subscription handler that forwards messages to the event bus of the givenvertx.voidSomething has happened, so handle it.
-
Method Details
-
create
Creates a subscription handler that forwards messages to the event bus of the givenvertx. The default address prefix is used. -
create
Creates a subscription handler that forwards messages to the event bus of the givenvertx. The given address prefix is used. -
handle
-