public class MessageProducer<T> extends Object implements WriteStream<T>
NOTE: This class has been automatically generated from the
original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<MessageProducer> |
__TYPE_ARG |
io.vertx.lang.rx.TypeArg<T> |
__typeArg_0 |
static int |
DEFAULT_WRITE_QUEUE_MAX_SIZE |
Constructor and Description |
---|
MessageProducer(MessageProducer delegate) |
MessageProducer(MessageProducer delegate,
io.vertx.lang.rx.TypeArg<T> typeArg_0) |
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() |
void |
end(T t)
Same as
end(T) but writes some data to the stream before ending. |
boolean |
equals(Object o) |
MessageProducer<T> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
MessageProducer |
getDelegate() |
int |
hashCode() |
static <T> MessageProducer<T> |
newInstance(MessageProducer arg) |
static <T> MessageProducer<T> |
newInstance(MessageProducer arg,
io.vertx.lang.rx.TypeArg<T> __typeArg_T) |
MessageProducer<T> |
send(T message)
This method actually sends a message using the send semantic regardless this producer
is a sender or a publisher.
|
<R> MessageProducer<T> |
send(T message,
Handler<AsyncResult<Message<R>>> replyHandler)
Like
send(T) but specifying a replyHandler that will be called if the recipient
subsequently replies to the message. |
MessageProducer<T> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
String |
toString() |
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 setWriteQueueMaxSize(int) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newInstance, newInstance
newInstance
public static final io.vertx.lang.rx.TypeArg<MessageProducer> __TYPE_ARG
public final io.vertx.lang.rx.TypeArg<T> __typeArg_0
public static final int DEFAULT_WRITE_QUEUE_MAX_SIZE
public MessageProducer(MessageProducer delegate)
public MessageProducer(MessageProducer delegate, io.vertx.lang.rx.TypeArg<T> typeArg_0)
public MessageProducer getDelegate()
getDelegate
in interface StreamBase
getDelegate
in interface WriteStream<T>
public void end(T t)
end(T)
but writes some data to the stream before ending.end
in interface WriteStream<T>
t
- public boolean writeQueueFull()
true
if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)
writeQueueFull
in interface WriteStream<T>
public MessageProducer<T> send(T message)
message
- the message to sendpublic <R> MessageProducer<T> send(T message, Handler<AsyncResult<Message<R>>> replyHandler)
send(T)
but specifying a replyHandler
that will be called if the recipient
subsequently replies to the message.message
- the message to sendreplyHandler
- reply handler will be called when any reply from the recipient is received, may be null
public MessageProducer<T> exceptionHandler(Handler<Throwable> handler)
WriteStream
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<T>
handler
- the exception handlerpublic MessageProducer<T> write(T data)
WriteStream
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a Pump
.write
in interface WriteStream<T>
data
- the data to writepublic MessageProducer<T> setWriteQueueMaxSize(int maxSize)
WriteStream
maxSize
. 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 streampublic MessageProducer<T> drainHandler(Handler<Void> handler)
WriteStream
Pump
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 handlerpublic MessageProducer<T> deliveryOptions(DeliveryOptions options)
options
- the new optionspublic String address()
public void end()
close()
end
in interface WriteStream<T>
public void close()
public static <T> MessageProducer<T> newInstance(MessageProducer arg)
public static <T> MessageProducer<T> newInstance(MessageProducer arg, io.vertx.lang.rx.TypeArg<T> __typeArg_T)
Copyright © 2018 Eclipse. All rights reserved.