Top Description Methods
io.vertx.core.eventbus

public Interface MessageProducer<T>

Known Direct Implementers
io.vertx.core.eventbus.impl.MessageProducerImpl
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Fluent, .VertxGen, io.vertx.core.AsyncResult, .Future, .Handler

Represents a stream of message that can be written to.

Author
Julien Viet

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The address to which the producer produces messages.
address
()

public Future<Void>

Returns:

a future completed with the result
close
()

Closes the producer, this method should be called when the message producer is not used anymore.

public void
close(Handler<AsyncResult<Void>> handler)

Same as close() but with an handler called when the operation completes

public MessageProducer<T>

Returns:

this producer object
deliveryOptions
(DeliveryOptions
the new options
options
)

Update the delivery options of this producer.

public void
write(T
the message body
body
,
Handler<AsyncResult<Void>> handler)

Write a message to the event-bus, either sending or publishing.

public Future<Void>
write(T body)

Like write(Object, Handler) but returns a Future of the asynchronous result

Method Detail

addressback to summary
public String address()
Returns:String

The address to which the producer produces messages.

closeback to summary
public Future<Void> close()

Closes the producer, this method should be called when the message producer is not used anymore.

Returns:Future<Void>

a future completed with the result

closeback to summary
public void close(Handler<AsyncResult<Void>> handler)

Same as close() but with an handler called when the operation completes

deliveryOptionsback to summary
public MessageProducer<T> deliveryOptions(DeliveryOptions options)

Update the delivery options of this producer.

Parameters
options:DeliveryOptions

the new options

Returns:MessageProducer<T>

this producer object

Annotations
@Fluent
writeback to summary
public void write(T body, Handler<AsyncResult<Void>> handler)

Write a message to the event-bus, either sending or publishing. The handler completion depends on the producer type:

  • send or request: the handler is completed successfully if the message has been written; otherwise, the handler is failed
  • publish: the handler is failed if there is no recipient; otherwise, the handler is completed successfully
In any case, a successfully completed handler is not a delivery guarantee.
Parameters
body:T

the message body

writeback to summary
public Future<Void> write(T body)

Like write(Object, Handler) but returns a Future of the asynchronous result