public interface MessageProducer<T> extends WriteStream<T>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_WRITE_QUEUE_MAX_SIZE |
| Modifier and Type | Method and Description |
|---|---|
String |
address() |
Future<Void> |
close()
Closes the producer, this method should be called when the message producer is not used anymore.
|
void |
close(Handler<AsyncResult<Void>> handler)
Same as
close() but with an handler called when the operation completes |
MessageProducer<T> |
deliveryOptions(DeliveryOptions options)
Update the delivery options of this producer.
|
MessageProducer<T> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
Future<Void> |
end()
Closes the producer, calls
close() |
void |
end(Handler<AsyncResult<Void>> handler)
Closes the producer, calls
close(Handler) |
MessageProducer<T> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
MessageProducer<T> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
end, end, write, write, writeQueueFullstatic final int DEFAULT_WRITE_QUEUE_MAX_SIZE
MessageProducer<T> exceptionHandler(Handler<Throwable> handler)
WriteStreamexceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<T>handler - the exception handlerMessageProducer<T> setWriteQueueMaxSize(int maxSize)
WriteStreammaxSize. You will still be able to write to the stream even
if there is more than maxSize items in the write queue. This is used as an indicator by classes such as
Pump to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket, the number of Message for a
MessageProducer, etc...setWriteQueueMaxSize in interface WriteStream<T>maxSize - the max size of the write streamMessageProducer<T> drainHandler(Handler<Void> handler)
WriteStreamPump for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2.drainHandler in interface WriteStream<T>handler - the handlerMessageProducer<T> deliveryOptions(DeliveryOptions options)
options - the new optionsString address()
Future<Void> end()
close()end in interface WriteStream<T>void end(Handler<AsyncResult<Void>> handler)
close(Handler)end in interface WriteStream<T>Future<Void> close()
void close(Handler<AsyncResult<Void>> handler)
close() but with an handler called when the operation completesCopyright © 2019 Eclipse. All rights reserved.