Package org.apache.qpid.protonj2.client
Class SenderOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.LinkOptions<SenderOptions>
-
- org.apache.qpid.protonj2.client.SenderOptions
-
- All Implemented Interfaces:
Cloneable
public class SenderOptions extends LinkOptions<SenderOptions> implements Cloneable
Options that control the behavior of aSender
created from them.
-
-
Constructor Summary
Constructors Constructor Description SenderOptions()
Create a newSenderOptions
instance configured with default configuration settings.SenderOptions(SenderOptions options)
Create a new SenderOptions instance that copies the configuration from the specified source options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SenderOptions
clone()
protected SenderOptions
copyInto(SenderOptions other)
Copy all options from thisSenderOptions
instance into the instance provided.Supplier<DeliveryTagGenerator>
deliveryTagGeneratorSupplier()
SenderOptions
deliveryTagGeneratorSupplier(Supplier<DeliveryTagGenerator> supplier)
Configures aSupplier
which provides unique instances ofDeliveryTagGenerator
objects for anySender
created using these options.protected SenderOptions
self()
long
sendTimeout()
SenderOptions
sendTimeout(long sendTimeout)
Configures the timeout used when awaiting a send operation to complete.SenderOptions
sendTimeout(long timeout, TimeUnit units)
Configures the timeout used when awaiting a send operation to complete.-
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
-
-
-
-
Constructor Detail
-
SenderOptions
public SenderOptions()
Create a newSenderOptions
instance configured with default configuration settings.
-
SenderOptions
public SenderOptions(SenderOptions options)
Create a new SenderOptions instance that copies the configuration from the specified source options.- Parameters:
options
- The SenderOptions instance whose settings are to be copied into this one.
-
-
Method Detail
-
sendTimeout
public long sendTimeout()
- Returns:
- the timeout used when awaiting a response from the remote when a resource is message send.
-
sendTimeout
public SenderOptions sendTimeout(long sendTimeout)
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.- Parameters:
sendTimeout
- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SenderOptions
instance.
-
sendTimeout
public SenderOptions sendTimeout(long timeout, TimeUnit units)
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.- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
that defines the timeout span.- Returns:
- this
SenderOptions
instance.
-
clone
public SenderOptions clone()
-
copyInto
protected SenderOptions copyInto(SenderOptions other)
Copy all options from thisSenderOptions
instance into the instance provided.- Parameters:
other
- the target of this copy operation.- Returns:
- the
SenderOptions
instance that was given.
-
deliveryTagGeneratorSupplier
public SenderOptions deliveryTagGeneratorSupplier(Supplier<DeliveryTagGenerator> supplier)
Configures aSupplier
which provides unique instances ofDeliveryTagGenerator
objects for anySender
created using these options.The client sender will use a default
DeliveryTagGenerator
under normal circumstances and the user is not required to configure aSupplier
. In some cases where the user is communicating with a system that requires a specific format of delivery tag this option allows use of a custom generator. The caller is responsible for providing a supplier that will create a unique instance of a tag generator as they are not meant to be shared amongst senders. Once a sender has been created the tag generator it uses cannot be changed so future calls to this method will not affect previously createdSender
instances.- Parameters:
supplier
- TheSupplier
ofDeliveryTagGenerator
instances.- Returns:
- the
SenderOptions
instance that was given.
-
deliveryTagGeneratorSupplier
public Supplier<DeliveryTagGenerator> deliveryTagGeneratorSupplier()
- Returns:
- the configured delivery tag
Supplier
or null if none was set.
-
self
protected SenderOptions self()
- Specified by:
self
in classLinkOptions<SenderOptions>
- Returns:
- the true derived type instance for use in this class.
-
-