Package org.apache.qpid.protonj2.client
Class StreamReceiverOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.ReceiverOptions
-
- org.apache.qpid.protonj2.client.StreamReceiverOptions
-
public class StreamReceiverOptions extends ReceiverOptions
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 StreamReceiverOptionsautoAccept(boolean autoAccept)Controls if the created Receiver will automatically accept the deliveries that have been received by the application (default istrue).StreamReceiverOptionsautoSettle(boolean autoSettle)Controls if the created Receiver will automatically settle the deliveries that have been received by the application (default istrue).StreamReceiverOptionsclone()StreamReceiverOptionscloseTimeout(long closeTimeout)Configures the timeout used when awaiting a response from the remote that a request to close theReceiverlink.StreamReceiverOptionscloseTimeout(long timeout, java.util.concurrent.TimeUnit units)Configures the timeout used when awaiting a response from the remote that a request to close theReceiverlink.protected StreamReceiverOptionscopyInto(ReceiverOptions other)Copy all options from thisReceiverOptionsinstance into the instance provided.protected StreamReceiverOptionscopyInto(StreamReceiverOptions other)Copy all options from thisStreamReceiverOptionsinstance into the instance provided.StreamReceiverOptionscreditWindow(int creditWindow)A credit window value that will be used to maintain an window of credit for Receiver instances that are created.StreamReceiverOptionsdeliveryMode(DeliveryMode deliveryMode)Sets theDeliveryModevalue to assign to newly createdReceiverinstances.StreamReceiverOptionsdesiredCapabilities(java.lang.String... desiredCapabilities)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, java.util.concurrent.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.StreamReceiverOptionslinkName(java.lang.String linkName)Configures the link name to use when creating a givenReceiverinstance.StreamReceiverOptionsofferedCapabilities(java.lang.String... offeredCapabilities)StreamReceiverOptionsopenTimeout(long openTimeout)Configures the timeout used when awaiting a response from the remote that a request to open aReceiverhas been honored.StreamReceiverOptionsopenTimeout(long timeout, java.util.concurrent.TimeUnit units)Configures the timeout used when awaiting a response from the remote that a request to open aReceiverhas been honored.StreamReceiverOptionsproperties(java.util.Map<java.lang.String,java.lang.Object> properties)intreadBufferSize()StreamReceiverOptionsreadBufferSize(int readBufferSize)Sets the incoming buffer capacity (in bytes) that theStreamReceiver.StreamReceiverOptionsrequestTimeout(long requestTimeout)Configures the timeout used when awaiting a response from the remote that a request to perform some action such as starting a new transaction.StreamReceiverOptionsrequestTimeout(long timeout, java.util.concurrent.TimeUnit units)Configures the timeout used when awaiting a response from the remote that a request to perform some action such as starting a new transaction.-
Methods inherited from class org.apache.qpid.protonj2.client.ReceiverOptions
autoAccept, autoSettle, closeTimeout, creditWindow, deliveryMode, desiredCapabilities, drainTimeout, linkName, offeredCapabilities, openTimeout, properties, 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()
- Overrides:
clonein classReceiverOptions
-
copyInto
protected StreamReceiverOptions copyInto(StreamReceiverOptions other)
Copy all options from thisStreamReceiverOptionsinstance into the instance provided.- Parameters:
other- the target of this copy operation.- Returns:
- this
StreamReceiverOptionsclass for chaining.
-
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)
Description copied from class:ReceiverOptionsControls if the created Receiver will automatically accept the deliveries that have been received by the application (default istrue).- Overrides:
autoAcceptin classReceiverOptions- Parameters:
autoAccept- The value to assign for auto delivery acceptance.- Returns:
- this
ReceiverOptionsinstance.
-
autoSettle
public StreamReceiverOptions autoSettle(boolean autoSettle)
Description copied from class:ReceiverOptionsControls if the created Receiver will automatically settle the deliveries that have been received by the application (default istrue).- Overrides:
autoSettlein classReceiverOptions- Parameters:
autoSettle- The value to assign for auto delivery settlement.- Returns:
- this
ReceiverOptionsinstance.
-
deliveryMode
public StreamReceiverOptions deliveryMode(DeliveryMode deliveryMode)
Description copied from class:ReceiverOptionsSets theDeliveryModevalue to assign to newly createdReceiverinstances.- Overrides:
deliveryModein classReceiverOptions- Parameters:
deliveryMode- The delivery mode value to configure.- Returns:
- this
ReceiverOptionsinstance.
-
linkName
public StreamReceiverOptions linkName(java.lang.String linkName)
Description copied from class:ReceiverOptionsConfigures the link name to use when creating a givenReceiverinstance.- Overrides:
linkNamein classReceiverOptions- Parameters:
linkName- The assigned link name to use when creating aReceiver.- Returns:
- this
ReceiverOptionsinstance.
-
creditWindow
public StreamReceiverOptions creditWindow(int creditWindow)
Description copied from class:ReceiverOptionsA 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.- Overrides:
creditWindowin classReceiverOptions- Parameters:
creditWindow- The assigned credit window value to use.- Returns:
- this
ReceiverOptionsinstance.
-
closeTimeout
public StreamReceiverOptions closeTimeout(long closeTimeout)
Description copied from class:ReceiverOptionsConfigures the timeout used when awaiting a response from the remote that a request to close theReceiverlink.- Overrides:
closeTimeoutin classReceiverOptions- Parameters:
closeTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
ReceiverOptionsinstance.
-
closeTimeout
public StreamReceiverOptions closeTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:ReceiverOptionsConfigures the timeout used when awaiting a response from the remote that a request to close theReceiverlink.- Overrides:
closeTimeoutin classReceiverOptions- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
ReceiverOptionsinstance.
-
openTimeout
public StreamReceiverOptions openTimeout(long openTimeout)
Description copied from class:ReceiverOptionsConfigures the timeout used when awaiting a response from the remote that a request to open aReceiverhas been honored.- Overrides:
openTimeoutin classReceiverOptions- Parameters:
openTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
ReceiverOptionsinstance.
-
openTimeout
public StreamReceiverOptions openTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:ReceiverOptionsConfigures the timeout used when awaiting a response from the remote that a request to open aReceiverhas been honored.- Overrides:
openTimeoutin classReceiverOptions- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
ReceiverOptionsinstance.
-
drainTimeout
public StreamReceiverOptions drainTimeout(long drainTimeout)
Description copied from class:ReceiverOptionsSets the drain timeout (in milliseconds) after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.- Overrides:
drainTimeoutin classReceiverOptions- Parameters:
drainTimeout- the drainTimeout to use for receiver links.- Returns:
- this
ReceiverOptionsinstance.
-
drainTimeout
public StreamReceiverOptions drainTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:ReceiverOptionsSets the drain timeout value after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.- Overrides:
drainTimeoutin classReceiverOptions- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
ReceiverOptionsinstance.
-
requestTimeout
public StreamReceiverOptions requestTimeout(long requestTimeout)
Description copied from class:ReceiverOptionsConfigures the timeout used when awaiting a response from the remote that a request to perform some action such as starting a new transaction. If the remote does not respond within the configured timeout the resource making the request will mark it as failed and return an error to the request initiator usually in the form of aClientOperationTimedOutException.- Overrides:
requestTimeoutin classReceiverOptions- Parameters:
requestTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
ReceiverOptionsinstance.
-
requestTimeout
public StreamReceiverOptions requestTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:ReceiverOptionsConfigures the timeout used when awaiting a response from the remote that a request to perform some action such as starting a new transaction. If the remote does not respond within the configured timeout the resource making the request will mark it as failed and return an error to the request initiator usually in the form of aClientOperationTimedOutException.- Overrides:
requestTimeoutin classReceiverOptions- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
ReceiverOptionsinstance.
-
offeredCapabilities
public StreamReceiverOptions offeredCapabilities(java.lang.String... offeredCapabilities)
- Overrides:
offeredCapabilitiesin classReceiverOptions- Parameters:
offeredCapabilities- the offeredCapabilities to set- Returns:
- this
ReceiverOptionsinstance.
-
desiredCapabilities
public StreamReceiverOptions desiredCapabilities(java.lang.String... desiredCapabilities)
- Overrides:
desiredCapabilitiesin classReceiverOptions- Parameters:
desiredCapabilities- the desiredCapabilities to set- Returns:
- this
ReceiverOptionsinstance.
-
properties
public StreamReceiverOptions properties(java.util.Map<java.lang.String,java.lang.Object> properties)
- Overrides:
propertiesin classReceiverOptions- Parameters:
properties- the properties to set- Returns:
- this
ReceiverOptionsinstance.
-
copyInto
protected StreamReceiverOptions copyInto(ReceiverOptions other)
Description copied from class:ReceiverOptionsCopy all options from thisReceiverOptionsinstance into the instance provided.- Overrides:
copyIntoin classReceiverOptions- Parameters:
other- the target of this copy operation.- Returns:
- this options class for chaining.
-
-