public class MessageProducerImpl<T> extends Object implements MessageProducer<T>
Constructor and Description |
---|
MessageProducerImpl(EventBus bus,
String address,
boolean send,
DeliveryOptions options) |
Modifier and Type | Method and Description |
---|---|
String |
address() |
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.
|
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 . |
MessageProducer<T> |
write(T data)
Write some data to the stream.
|
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int) |
public MessageProducerImpl(EventBus bus, String address, boolean send, DeliveryOptions options)
public MessageProducer<T> deliveryOptions(DeliveryOptions options)
MessageProducer
deliveryOptions
in interface MessageProducer<T>
options
- the new optionspublic MessageProducer<T> exceptionHandler(Handler<Throwable> handler)
WriteStream
exceptionHandler
in interface MessageProducer<T>
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<T>
handler
- the exception handlerpublic MessageProducer<T> setWriteQueueMaxSize(int maxSize)
WriteStream
maxSize
. You will still be able to write to the stream even
if there is more than maxSize
bytes in the write queue. This is used as an indicator by classes such as
Pump
to provide flow control.setWriteQueueMaxSize
in interface MessageProducer<T>
setWriteQueueMaxSize
in interface WriteStream<T>
maxSize
- the max size of the write streampublic MessageProducer<T> write(T data)
WriteStream
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a Pump
.write
in interface MessageProducer<T>
write
in interface WriteStream<T>
data
- the data to writepublic boolean writeQueueFull()
WriteStream
true
if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)
writeQueueFull
in interface WriteStream<T>
public MessageProducer<T> drainHandler(Handler<Void> handler)
WriteStream
Pump
for an example of this being used.drainHandler
in interface MessageProducer<T>
drainHandler
in interface WriteStream<T>
handler
- the handlerpublic String address()
address
in interface MessageProducer<T>
Copyright © 2015. All Rights Reserved.