Package org.apache.qpid.protonj2.client
Class StreamSenderOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.SenderOptions
-
- org.apache.qpid.protonj2.client.StreamSenderOptions
-
public class StreamSenderOptions extends SenderOptions
Options class that controls various aspects of aStreamSenderMessage
instance and how a streamed message transfer is written.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PENDING_WRITES_BUFFER_SIZE
Defines the default pending write buffering size which is used to control how much outgoing data can be buffered for local writing before the sender has back pressured applied to avoid out of memory conditions due to overly large pending batched writes.static int
MIN_BUFFER_SIZE_LIMIT
Defines the default minimum size that the context write buffer will allocate which drives the interval auto flushing of written data for this context.
-
Constructor Summary
Constructors Constructor Description StreamSenderOptions()
Creates aStreamSenderOptions
instance with default values for all optionsStreamSenderOptions(StreamSenderOptions options)
Create aStreamSenderOptions
instance that copies all configuration from the givenStreamSenderOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamSenderOptions
autoSettle(boolean autoSettle)
Sets whether sent deliveries should be automatically locally-settled once they have become remotely-settled by the receiving peer.StreamSenderOptions
clone()
StreamSenderOptions
closeTimeout(long closeTimeout)
Configures the timeout used when awaiting a response from the remote that a request to close theSender
link.StreamSenderOptions
closeTimeout(long timeout, java.util.concurrent.TimeUnit units)
Configures the timeout used when awaiting a response from the remote that a request to close theSender
link.protected StreamSenderOptions
copyInto(StreamSenderOptions other)
Copy all options from thisStreamSenderOptions
instance into the instance provided.StreamSenderOptions
deliveryMode(DeliveryMode deliveryMode)
Sets theDeliveryMode
value to assign to newly createdSender
instances.StreamSenderOptions
desiredCapabilities(java.lang.String... desiredCapabilities)
StreamSenderOptions
linkName(java.lang.String linkName)
Configures the link name to use when creating a givenSender
instance.StreamSenderOptions
offeredCapabilities(java.lang.String... offeredCapabilities)
StreamSenderOptions
openTimeout(long openTimeout)
Configures the timeout used when awaiting a response from the remote that a request to open aSender
has been honored.StreamSenderOptions
openTimeout(long timeout, java.util.concurrent.TimeUnit units)
Configures the timeout used when awaiting a response from the remote that a request to open aSender
has been honored.int
pendingWritesBufferSize()
StreamSenderOptions
pendingWritesBufferSize(int pendingWritesBufferSize)
Sets the overall number of bytes the stream sender will allow to be pending for write before applying back pressure to the stream write caller.StreamSenderOptions
properties(java.util.Map<java.lang.String,java.lang.Object> properties)
StreamSenderOptions
requestTimeout(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.StreamSenderOptions
requestTimeout(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.StreamSenderOptions
sendTimeout(long sendTimeout)
Configures the timeout used when awaiting a send operation to complete.StreamSenderOptions
sendTimeout(long timeout, java.util.concurrent.TimeUnit units)
Configures the timeout used when awaiting a send operation to complete.int
writeBufferSize()
StreamSenderOptions
writeBufferSize(int writeBufferSize)
Sets the overall number of bytes the stream sender will buffer before automatically flushing the currently buffered bytes.-
Methods inherited from class org.apache.qpid.protonj2.client.SenderOptions
autoSettle, closeTimeout, copyInto, deliveryMode, desiredCapabilities, linkName, offeredCapabilities, openTimeout, properties, requestTimeout, sendTimeout, sourceOptions, targetOptions
-
-
-
-
Field Detail
-
DEFAULT_PENDING_WRITES_BUFFER_SIZE
public static final int DEFAULT_PENDING_WRITES_BUFFER_SIZE
Defines the default pending write buffering size which is used to control how much outgoing data can be buffered for local writing before the sender has back pressured applied to avoid out of memory conditions due to overly large pending batched writes.- See Also:
- Constant Field Values
-
MIN_BUFFER_SIZE_LIMIT
public static final int MIN_BUFFER_SIZE_LIMIT
Defines the default minimum size that the context write buffer will allocate which drives the interval auto flushing of written data for this context.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StreamSenderOptions
public StreamSenderOptions()
Creates aStreamSenderOptions
instance with default values for all options
-
StreamSenderOptions
public StreamSenderOptions(StreamSenderOptions options)
Create aStreamSenderOptions
instance that copies all configuration from the givenStreamSenderOptions
instance.- Parameters:
options
- The options instance to copy all configuration values from.
-
-
Method Detail
-
clone
public StreamSenderOptions clone()
- Overrides:
clone
in classSenderOptions
-
copyInto
protected StreamSenderOptions copyInto(StreamSenderOptions other)
Copy all options from thisStreamSenderOptions
instance into the instance provided.- Parameters:
other
- the target of this copy operation.- Returns:
- this
StreamSenderOptions
class for chaining.
-
writeBufferSize
public int writeBufferSize()
- Returns:
- the configured context write buffering limit for the associated
StreamSender
-
writeBufferSize
public StreamSenderOptions writeBufferSize(int writeBufferSize)
Sets the overall number of bytes the stream sender will buffer before automatically flushing the currently buffered bytes. By default the stream sender implementation chooses a value for this buffer limit based on the configured frame size limits of the connection.- Parameters:
writeBufferSize
- The number of bytes that can be written before the context performs a flush operation.- Returns:
- this
StreamSenderOptions
instance.
-
pendingWritesBufferSize
public int pendingWritesBufferSize()
- Returns:
- the configured pending write buffering limit for the associated
StreamSender
-
pendingWritesBufferSize
public StreamSenderOptions pendingWritesBufferSize(int pendingWritesBufferSize)
Sets the overall number of bytes the stream sender will allow to be pending for write before applying back pressure to the stream write caller. By default the stream sender implementation chooses a value for this pending write limit based on the configured frame size limits of the connection. This is an advanced option and should not be used unless the impact of doing so is understood by the user.- Parameters:
pendingWritesBufferSize
- The number of bytes that can be pending for write before the sender applies back pressure.- Returns:
- this
StreamSenderOptions
instance.
-
linkName
public StreamSenderOptions linkName(java.lang.String linkName)
Description copied from class:SenderOptions
Configures the link name to use when creating a givenSender
instance.- Overrides:
linkName
in classSenderOptions
- Parameters:
linkName
- The assigned link name to use when creating aSender
.- Returns:
- this
SenderOptions
instance.
-
autoSettle
public StreamSenderOptions autoSettle(boolean autoSettle)
Description copied from class:SenderOptions
Sets whether sent deliveries should be automatically locally-settled once they have become remotely-settled by the receiving peer. True by default.- Overrides:
autoSettle
in classSenderOptions
- Parameters:
autoSettle
- whether deliveries should be auto settled locally after being settled by the receiver- Returns:
- the sender
-
deliveryMode
public StreamSenderOptions deliveryMode(DeliveryMode deliveryMode)
Description copied from class:SenderOptions
Sets theDeliveryMode
value to assign to newly createdSender
instances.- Overrides:
deliveryMode
in classSenderOptions
- Parameters:
deliveryMode
- The delivery mode value to configure.- Returns:
- this
SenderOptions
instance.
-
closeTimeout
public StreamSenderOptions closeTimeout(long closeTimeout)
Description copied from class:SenderOptions
Configures the timeout used when awaiting a response from the remote that a request to close theSender
link.- Overrides:
closeTimeout
in classSenderOptions
- Parameters:
closeTimeout
- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SenderOptions
instance.
-
closeTimeout
public StreamSenderOptions closeTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:SenderOptions
Configures the timeout used when awaiting a response from the remote that a request to close theSender
link.- Overrides:
closeTimeout
in classSenderOptions
- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
that defines the timeout span.- Returns:
- this
SenderOptions
instance.
-
openTimeout
public StreamSenderOptions openTimeout(long openTimeout)
Description copied from class:SenderOptions
Configures the timeout used when awaiting a response from the remote that a request to open aSender
has been honored.- Overrides:
openTimeout
in classSenderOptions
- Parameters:
openTimeout
- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SenderOptions
instance.
-
openTimeout
public StreamSenderOptions openTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:SenderOptions
Configures the timeout used when awaiting a response from the remote that a request to open aSender
has been honored.- Overrides:
openTimeout
in classSenderOptions
- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
that defines the timeout span.- Returns:
- this
SenderOptions
instance.
-
sendTimeout
public StreamSenderOptions sendTimeout(long sendTimeout)
Description copied from class:SenderOptions
Configures the timeout used when awaiting a send operation to complete. A send will block if the remote has not granted theSender
or theSession
credit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutException
exception to indicate that the send did not complete.- Overrides:
sendTimeout
in classSenderOptions
- Parameters:
sendTimeout
- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SenderOptions
instance.
-
sendTimeout
public StreamSenderOptions sendTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:SenderOptions
Configures the timeout used when awaiting a send operation to complete. A send will block if the remote has not granted theSender
or theSession
credit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutException
exception to indicate that the send did not complete.- Overrides:
sendTimeout
in classSenderOptions
- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
that defines the timeout span.- Returns:
- this
SenderOptions
instance.
-
requestTimeout
public StreamSenderOptions requestTimeout(long requestTimeout)
Description copied from class:SenderOptions
Configures 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:
requestTimeout
in classSenderOptions
- Parameters:
requestTimeout
- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SenderOptions
instance.
-
requestTimeout
public StreamSenderOptions requestTimeout(long timeout, java.util.concurrent.TimeUnit units)
Description copied from class:SenderOptions
Configures 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:
requestTimeout
in classSenderOptions
- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
that defines the timeout span.- Returns:
- this
SenderOptions
instance.
-
offeredCapabilities
public StreamSenderOptions offeredCapabilities(java.lang.String... offeredCapabilities)
- Overrides:
offeredCapabilities
in classSenderOptions
- Parameters:
offeredCapabilities
- the offeredCapabilities to set- Returns:
- this
SenderOptions
instance.
-
desiredCapabilities
public StreamSenderOptions desiredCapabilities(java.lang.String... desiredCapabilities)
- Overrides:
desiredCapabilities
in classSenderOptions
- Parameters:
desiredCapabilities
- the desiredCapabilities to set- Returns:
- this
SenderOptions
instance.
-
properties
public StreamSenderOptions properties(java.util.Map<java.lang.String,java.lang.Object> properties)
- Overrides:
properties
in classSenderOptions
- Parameters:
properties
- the properties to set- Returns:
- this
SenderOptions
instance.
-
-