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() |
void |
close()
Closes the producer, this method should be called when the message producer is not used anymore.
|
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.
|
void |
end()
Closes the producer, calls
close() |
MessageProducer<T> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
MessageProducer<T> |
send(T message)
Synonym for
write(Object). |
<R> MessageProducer<T> |
send(T message,
Handler<AsyncResult<Message<R>>> replyHandler) |
MessageProducer<T> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
MessageProducer<T> |
write(T data)
Write some data to the stream.
|
end, writeQueueFullstatic final int DEFAULT_WRITE_QUEUE_MAX_SIZE
MessageProducer<T> send(T message)
write(Object).message - the message to send<R> MessageProducer<T> send(T message, Handler<AsyncResult<Message<R>>> replyHandler)
MessageProducer<T> exceptionHandler(Handler<Throwable> handler)
WriteStreamexceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<T>handler - the exception handlerMessageProducer<T> write(T data)
WriteStreamWriteStream.writeQueueFull() method before writing. This is done automatically if using a Pump.write in interface WriteStream<T>data - the data to writeMessageProducer<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()
void end()
close()end in interface WriteStream<T>void close()
Copyright © 2018 Eclipse. All rights reserved.