public interface ProtonReceiver extends ProtonLink<ProtonReceiver>
Modifier and Type | Method and Description |
---|---|
ProtonReceiver |
drain(long timeout,
Handler<AsyncResult<Void>> completionHandler)
Initiates a 'drain' of link credit from the remote sender.
|
ProtonReceiver |
flow(int credits)
Grants the given number of message credits to the sender.
|
int |
getPrefetch()
Get the current prefetch value.
|
ProtonReceiver |
handler(ProtonMessageHandler handler)
Sets the handler to process messages as they arrive.
|
boolean |
isAutoAccept()
Get whether the receiver is auto accepting.
|
ProtonReceiver |
maxMessageSizeExceededHandler(Handler<ProtonReceiver> handler)
Sets a handler to execute when an incoming delivery has exceeded the receivers
max-message-size , if one was configured. |
ProtonReceiver |
setAutoAccept(boolean autoAccept)
Sets whether received deliveries should be automatically accepted (and settled) after the message handler runs for
them, if no other disposition has been applied during handling.
|
ProtonReceiver |
setPrefetch(int messages)
Sets the number of message credits the receiver grants and replenishes automatically as messages are delivered.
|
attachments, close, closeHandler, detach, detachHandler, free, getCondition, getCredit, getDrain, getMaxMessageSize, getName, getQoS, getQueued, getRemoteAddress, getRemoteCondition, getRemoteDesiredCapabilities, getRemoteMaxMessageSize, getRemoteOfferedCapabilities, getRemoteProperties, getRemoteQoS, getRemoteSource, getRemoteTarget, getSession, getSource, getTarget, isOpen, open, openHandler, setCondition, setDesiredCapabilities, setMaxMessageSize, setOfferedCapabilities, setProperties, setQoS, setSource, setTarget
ProtonReceiver handler(ProtonMessageHandler handler)
handler
- the handler to process messagesProtonReceiver setPrefetch(int messages)
flow(int)
as needed to manually grant credit.messages
- the message prefetchint getPrefetch()
setPrefetch(int)
ProtonReceiver setAutoAccept(boolean autoAccept)
autoAccept
- whether deliveries should be auto accepted after handling if no disposition was appliedboolean isAutoAccept()
setAutoAccept(boolean)
ProtonReceiver flow(int credits) throws IllegalStateException
setPrefetch(int)
has been used to disable automatic prefetch credit handling.credits
- the credits to flowIllegalStateException
- if prefetch is non-zero, or an existing drain operation is not yet completeProtonReceiver drain(long timeout, Handler<AsyncResult<Void>> completionHandler) throws IllegalStateException, IllegalArgumentException
setPrefetch(int)
has been used to disable automatic credit handling.timeout
- the delay in milliseconds before which the drain attempt should be considered failed, or 0 for no timeout.completionHandler
- handler called when credit hits 0 due to messages arriving, or a 'drain response' flowIllegalStateException
- if prefetch is non-zero, or an existing drain operation is not yet completeIllegalArgumentException
- if no completion handler is givenProtonReceiver maxMessageSizeExceededHandler(Handler<ProtonReceiver> handler)
max-message-size
, if one was configured.
The handler will be called once the receiver becomes aware of transfer frame(s) arriving for
a delivery with accumulated payload exceeding the max-message-size. The delivery payload will be
dropped and no further messages delivered. The handler notifies the situation has arisen to allow
some reaction and provide awareness of impending subsequent activity, namely the sending peers
matching 'response' to the receiver detaching or closing the link.
Exceeding an advertised max-message-size is a link-error, resulting in the link being detached or
closed with the
amqp:link:message-size-exceeded link error. After the handler is executed, if the link has not already
been either detached or closed within the handler, then the library will detach it with the
amqp:link:message-size-exceeded link error. Whether closed or detached by the handler or after it, note
that subsequent behaviour will be the same as if the application called ProtonLink.detach()
or ProtonLink.close()
,
itself normally, i.e the sending peers 'response' is handled as always through use of
ProtonLink.detachHandler(Handler)
and ProtonLink.closeHandler(Handler)
.handler
- the handler to be notified of max-message-size being exceededCopyright © 2020 Eclipse. All rights reserved.