Package org.apache.qpid.protonj2.client
Class StreamReceiverOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.LinkOptions<StreamReceiverOptions>
-
- org.apache.qpid.protonj2.client.StreamReceiverOptions
-
- All Implemented Interfaces:
Cloneable
public final class StreamReceiverOptions extends LinkOptions<StreamReceiverOptions> implements Cloneable
Options class that controls various aspects of aStreamReceiverinstance and how a streamed message transfer is written.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_READ_BUFFER_SIZEDefines the default read buffering size which is used to control how much incoming data can be buffered before the remote has back pressured applied to avoid out of memory conditions.
-
Constructor Summary
Constructors Constructor Description StreamReceiverOptions()Creates aStreamReceiverOptionsinstance with default values for all optionsStreamReceiverOptions(StreamReceiverOptions options)Create aStreamReceiverOptionsinstance that copies all configuration from the givenStreamReceiverOptionsinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanautoAccept()StreamReceiverOptionsautoAccept(boolean autoAccept)Controls if the created Receiver will automatically accept the deliveries that have been received by the application (default istrue).StreamReceiverOptionsclone()protected StreamReceiverOptionscopyInto(StreamReceiverOptions other)Copy all options from thisStreamReceiverOptionsinstance into the instance provided.intcreditWindow()StreamReceiverOptionscreditWindow(int creditWindow)A credit window value that will be used to maintain an window of credit for Receiver instances that are created.longdrainTimeout()StreamReceiverOptionsdrainTimeout(long drainTimeout)Sets the drain timeout (in milliseconds) after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.StreamReceiverOptionsdrainTimeout(long timeout, TimeUnit units)Sets the drain timeout value after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.intreadBufferSize()StreamReceiverOptionsreadBufferSize(int readBufferSize)Sets the incoming buffer capacity (in bytes) that theStreamReceiver.protected StreamReceiverOptionsself()-
Methods inherited from class org.apache.qpid.protonj2.client.LinkOptions
autoSettle, autoSettle, closeTimeout, closeTimeout, closeTimeout, copyInto, deliveryMode, deliveryMode, desiredCapabilities, desiredCapabilities, linkName, linkName, offeredCapabilities, offeredCapabilities, openTimeout, openTimeout, openTimeout, properties, properties, requestTimeout, requestTimeout, requestTimeout, sourceOptions, targetOptions
-
-
-
-
Field Detail
-
DEFAULT_READ_BUFFER_SIZE
public static final int DEFAULT_READ_BUFFER_SIZE
Defines the default read buffering size which is used to control how much incoming data can be buffered before the remote has back pressured applied to avoid out of memory conditions.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StreamReceiverOptions
public StreamReceiverOptions()
Creates aStreamReceiverOptionsinstance with default values for all options
-
StreamReceiverOptions
public StreamReceiverOptions(StreamReceiverOptions options)
Create aStreamReceiverOptionsinstance that copies all configuration from the givenStreamReceiverOptionsinstance.- Parameters:
options- The options instance to copy all configuration values from.
-
-
Method Detail
-
clone
public StreamReceiverOptions clone()
-
copyInto
protected StreamReceiverOptions copyInto(StreamReceiverOptions other)
Copy all options from thisStreamReceiverOptionsinstance into the instance provided.- Parameters:
other- the target of this copy operation.- Returns:
- the
StreamReceiverOptionsinstance that was given.
-
readBufferSize
public int readBufferSize()
- Returns:
- the configured session capacity for the parent session of the
StreamReceiver.
-
readBufferSize
public StreamReceiverOptions readBufferSize(int readBufferSize)
Sets the incoming buffer capacity (in bytes) that theStreamReceiver.When the remote peer is sending incoming data for a
StreamReceiverMessagethe amount that is stored in memory before back pressure is applied to the remote is controlled by this option. If the user does not read incoming data as it arrives this limit can prevent out of memory errors that might otherwise arise as the remote attempts to immediately send all contents of very large message payloads.- Parameters:
readBufferSize- The number of bytes that theStreamReceiverwill buffer for a givenStreamReceiverMessage.- Returns:
- this
StreamReceiverOptionsinstance.
-
autoAccept
public StreamReceiverOptions autoAccept(boolean autoAccept)
Controls if the created Receiver will automatically accept the deliveries that have been received by the application (default istrue).- Parameters:
autoAccept- The value to assign for auto delivery acceptance.- Returns:
- this
StreamReceiverOptionsinstance.
-
autoAccept
public boolean autoAccept()
- Returns:
- the current value of the
Receiverauto accept setting.
-
creditWindow
public int creditWindow()
- Returns:
- the credit window configuration that will be applied to created
Receiverinstances.
-
creditWindow
public StreamReceiverOptions creditWindow(int creditWindow)
A credit window value that will be used to maintain an window of credit for Receiver instances that are created. TheReceiverwill allow up to the credit window amount of incoming deliveries to be queued and as they are read from theReceiverthe window will be extended to maintain a consistent backlog of deliveries. The default is to configure a credit window of 10.To disable credit windowing and allow the client application to control the credit on the
Receiverlink the credit window value should be set to zero.- Parameters:
creditWindow- The assigned credit window value to use.- Returns:
- this
StreamReceiverOptionsinstance.
-
drainTimeout
public long drainTimeout()
- Returns:
- the configured drain timeout value that will use to fail a pending drain request.
-
drainTimeout
public StreamReceiverOptions drainTimeout(long drainTimeout)
Sets the drain timeout (in milliseconds) after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.- Parameters:
drainTimeout- the drainTimeout to use for receiver links.- Returns:
- this
StreamReceiverOptionsinstance.
-
drainTimeout
public StreamReceiverOptions drainTimeout(long timeout, TimeUnit units)
Sets the drain timeout value after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
StreamReceiverOptionsinstance.
-
self
protected StreamReceiverOptions self()
- Specified by:
selfin classLinkOptions<StreamReceiverOptions>- Returns:
- the true derived type instance for use in this class.
-
-