Class AmqpSender
- java.lang.Object
-
- io.vertx.rxjava3.amqp.AmqpSender
-
- All Implemented Interfaces:
StreamBase
,WriteStream<AmqpMessage>
public class AmqpSender extends Object implements WriteStream<AmqpMessage>
AMQP Sender interface used to send messages.NOTE: This class has been automatically generated from the
original
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<AmqpSender>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description AmqpSender(AmqpSender delegate)
AmqpSender(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
address()
Completable
close()
Closes the sender.AmqpConnection
connection()
Gets the connection having created the sender.WriteStream<AmqpMessage>
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.Completable
end()
Ends the stream.Completable
end(AmqpMessage data)
Same asWriteStream.end()
but writes some data to the stream before ending.boolean
equals(Object o)
AmqpSender
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.AmqpSender
getDelegate()
int
hashCode()
static AmqpSender
newInstance(AmqpSender arg)
long
remainingCredits()
Completable
rxClose()
Closes the sender.Completable
rxEnd()
Ends the stream.Completable
rxEnd(AmqpMessage data)
Same asWriteStream.end()
but writes some data to the stream before ending.Completable
rxSendWithAck(AmqpMessage message)
Sends an AMQP message and waits for an acknowledgement.Completable
rxWrite(AmqpMessage data)
Write some data to the stream.AmqpSender
send(AmqpMessage message)
Sends an AMQP message.Completable
sendWithAck(AmqpMessage message)
Sends an AMQP message and waits for an acknowledgement.AmqpSender
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue tomaxSize
.WriteStreamObserver<AmqpMessage>
toObserver()
String
toString()
WriteStreamSubscriber<AmqpMessage>
toSubscriber()
io.vertx.proton.ProtonSender
unwrap()
Completable
write(AmqpMessage data)
Write some data to the stream.boolean
writeQueueFull()
This will returntrue
if there are more bytes in the write queue than the value set usingsetWriteQueueMaxSize(int)
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<AmqpSender> __TYPE_ARG
-
-
Constructor Detail
-
AmqpSender
public AmqpSender(AmqpSender delegate)
-
AmqpSender
public AmqpSender(Object delegate)
-
-
Method Detail
-
getDelegate
public AmqpSender getDelegate()
- Specified by:
getDelegate
in interfaceStreamBase
- Specified by:
getDelegate
in interfaceWriteStream<AmqpMessage>
-
toObserver
public WriteStreamObserver<AmqpMessage> toObserver()
- Specified by:
toObserver
in interfaceWriteStream<AmqpMessage>
-
toSubscriber
public WriteStreamSubscriber<AmqpMessage> toSubscriber()
- Specified by:
toSubscriber
in interfaceWriteStream<AmqpMessage>
-
write
public Completable write(AmqpMessage data)
Write some data to the stream.The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a .When the
data
is moved from the queue to the actual medium, the returned will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.- Specified by:
write
in interfaceWriteStream<AmqpMessage>
- Parameters:
data
- the data to write- Returns:
- a future completed with the write result
-
rxWrite
public Completable rxWrite(AmqpMessage data)
Write some data to the stream.The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a .When the
data
is moved from the queue to the actual medium, the returned will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.- Specified by:
rxWrite
in interfaceWriteStream<AmqpMessage>
- Parameters:
data
- the data to write- Returns:
- a future completed with the write result
-
end
public Completable end()
Ends the stream.Once the stream has ended, it cannot be used any more.
- Specified by:
end
in interfaceWriteStream<AmqpMessage>
- Returns:
- a future completed with the result
-
rxEnd
public Completable rxEnd()
Ends the stream.Once the stream has ended, it cannot be used any more.
- Specified by:
rxEnd
in interfaceWriteStream<AmqpMessage>
- Returns:
- a future completed with the result
-
end
public Completable end(AmqpMessage data)
Same asWriteStream.end()
but writes some data to the stream before ending.- Specified by:
end
in interfaceWriteStream<AmqpMessage>
- Parameters:
data
- the data to write- Returns:
- a future completed with the result
-
rxEnd
public Completable rxEnd(AmqpMessage data)
Same asWriteStream.end()
but writes some data to the stream before ending.- Specified by:
rxEnd
in interfaceWriteStream<AmqpMessage>
- Parameters:
data
- the data to write- Returns:
- a future completed with the result
-
writeQueueFull
public boolean writeQueueFull()
This will returntrue
if there are more bytes in the write queue than the value set usingsetWriteQueueMaxSize(int)
- Specified by:
writeQueueFull
in interfaceWriteStream<AmqpMessage>
- Returns:
true
if write queue is full
-
drainHandler
public WriteStream<AmqpMessage> drainHandler(Handler<Void> handler)
Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See 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
.- Specified by:
drainHandler
in interfaceWriteStream<AmqpMessage>
- Parameters:
handler
- the handler- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
public AmqpSender exceptionHandler(Handler<Throwable> handler)
Description copied from interface:WriteStream
Set an exception handler on the write stream.- Specified by:
exceptionHandler
in interfaceStreamBase
- Specified by:
exceptionHandler
in interfaceWriteStream<AmqpMessage>
- Parameters:
handler
- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
setWriteQueueMaxSize
public AmqpSender setWriteQueueMaxSize(int maxSize)
Description copied from interface:WriteStream
Set the maximum size of the write queue tomaxSize
. You will still be able to write to the stream even if there is more thanmaxSize
items in the write queue. This is used as an indicator by classes such asPipe
to provide flow control. The value is defined by the implementation of the stream, e.g in bytes for aNetSocket
, etc...- Specified by:
setWriteQueueMaxSize
in interfaceWriteStream<AmqpMessage>
- Parameters:
maxSize
- the max size of the write stream- Returns:
- a reference to this, so the API can be used fluently
-
send
public AmqpSender send(AmqpMessage message)
Sends an AMQP message. The destination the configured sender address or the address configured in the message.- Parameters:
message
- the message, must not benull
- Returns:
- the current sender
-
sendWithAck
public Completable sendWithAck(AmqpMessage message)
Sends an AMQP message and waits for an acknowledgement. It returns a future marked as failed if the message has been rejected or re-routed. If the message has been accepted, the handler is called with a success.- Parameters:
message
- the message, must not benull
- Returns:
- a future notified with the acknowledgement
-
rxSendWithAck
public Completable rxSendWithAck(AmqpMessage message)
Sends an AMQP message and waits for an acknowledgement. It returns a future marked as failed if the message has been rejected or re-routed. If the message has been accepted, the handler is called with a success.- Parameters:
message
- the message, must not benull
- Returns:
- a future notified with the acknowledgement
-
close
public Completable close()
Closes the sender.- Returns:
- a future notified when the sender has been closed
-
rxClose
public Completable rxClose()
Closes the sender.- Returns:
- a future notified when the sender has been closed
-
address
public String address()
- Returns:
- the configured address.
-
connection
public AmqpConnection connection()
Gets the connection having created the sender. Cannot benull
- Returns:
- the connection having created the sender.
-
remainingCredits
public long remainingCredits()
- Returns:
- the remaining credit, 0 is none.
-
unwrap
public io.vertx.proton.ProtonSender unwrap()
- Returns:
- the underlying ProtonSender.
-
newInstance
public static AmqpSender newInstance(AmqpSender arg)
-
-