Top Fields Constructors Methods
io.vertx.core.eventbus.impl

public Class MessageProducerImpl<T>

extends Object
implements MessageProducer<T>
Class Inheritance
All Implemented Interfaces
io.vertx.core.eventbus.MessageProducer
Imports
io.vertx.core.AsyncResult, .Future, .Handler, .Promise, .Vertx, io.vertx.core.eventbus.*, io.vertx.core.impl.ContextInternal, .VertxInternal

Author
Julien Viet

Field Summary

Modifier and TypeField and Description
private final String
private final EventBusImpl
private final boolean
private DeliveryOptions
private final boolean
private final Vertx

Constructor Summary

AccessConstructor and Description
public
MessageProducerImpl(Vertx vertx, String address, boolean send, DeliveryOptions options)

Method Summary

Modifier and TypeMethod and Description
public String
public Future<Void>
close()

Implements io.vertx.core.eventbus.MessageProducer.close.

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

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

Implements io.vertx.core.eventbus.MessageProducer.close.

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

public synchronized MessageProducer<T>
deliveryOptions(DeliveryOptions
the new options
options
)

Implements io.vertx.core.eventbus.MessageProducer.deliveryOptions.

Update the delivery options of this producer.

public Future<Void>
write(T body)

Implements io.vertx.core.eventbus.MessageProducer.write.

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

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

Implements io.vertx.core.eventbus.MessageProducer.write.

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

private void
write(T data, Promise<Void> handler)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressback to summary
private final String address
busback to summary
private final EventBusImpl bus
localOnlyback to summary
private final boolean localOnly
optionsback to summary
private DeliveryOptions options
sendback to summary
private final boolean send
vertxback to summary
private final Vertx vertx

Constructor Detail

MessageProducerImplback to summary
public MessageProducerImpl(Vertx vertx, String address, boolean send, DeliveryOptions options)

Method Detail

addressback to summary
public String address()

Implements io.vertx.core.eventbus.MessageProducer.address.

Returns:String

Doc from io.vertx.core.eventbus.MessageProducer.address.

The address to which the producer produces messages.

Annotations
@Override
closeback to summary
public Future<Void> close()

Implements io.vertx.core.eventbus.MessageProducer.close.

Doc from io.vertx.core.eventbus.MessageProducer.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

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

Implements io.vertx.core.eventbus.MessageProducer.close.

Doc from io.vertx.core.eventbus.MessageProducer.close.

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

Annotations
@Override
deliveryOptionsback to summary
public synchronized MessageProducer<T> deliveryOptions(DeliveryOptions options)

Implements io.vertx.core.eventbus.MessageProducer.deliveryOptions.

Doc from io.vertx.core.eventbus.MessageProducer.deliveryOptions.

Update the delivery options of this producer.

Parameters
options:DeliveryOptions

the new options

Returns:MessageProducer<T>

this producer object

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

Implements io.vertx.core.eventbus.MessageProducer.write.

Doc from io.vertx.core.eventbus.MessageProducer.write.

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

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

Implements io.vertx.core.eventbus.MessageProducer.write.

Doc from io.vertx.core.eventbus.MessageProducer.write.

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

Annotations
@Override
writeback to summary
private void write(T data, Promise<Void> handler)