Setting headers on messages
Messages sent over the event bus can also contain headers.
This can be specified by providing a headers
object
inside the DeliveryOptions
object when sending or publishing:
options = {
headers: {
'some-header' => 'some-value'
}
}
vertx.event_bus().send("news.uk.sport", "Yay! Someone kicked a ball", options)
On the other side, the consumer can retrieve the message header as follows:
eb = $vertx.event_bus()
eb.consumer("news.uk.sport") { |message|
puts message.headers().get("some-header")
}