Class ConnectionOptions
- All Implemented Interfaces:
- Cloneable
Connection created from them.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final longstatic final longstatic final longstatic final intstatic final NextReceiverPolicystatic final longstatic final longstatic final longstatic final long
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newConnectionOptionsinstance configured with default configuration settings.ConnectionOptions(ConnectionOptions options) Creates aConnectionOptionsinstance that is a copy of the given instance.
- 
Method SummaryModifier and TypeMethodDescriptionintchannelMax(int channelMax) Configure the channel maximum value for the newConnectioncreated with these options.clone()longcloseTimeout(long closeTimeout) Configures the timeout used when awaiting a response from the remote that a request to close a resource such as aConnection,Session,SenderorReceiverh as been honored.closeTimeout(long timeout, TimeUnit units) Configures the timeout used when awaiting a response from the remote that a request to close a resource such as aConnection,Session,SenderorReceiverh as been honored.connectedHandler(BiConsumer<Connection, ConnectionEvent> connectedHandler) Configures a handler that will be notified when aConnectionhas established.protected ConnectionOptionscopyInto(ConnectionOptions other) Copy all options from thisConnectionOptionsinstance into the instance provided.Configures the default next receiver policy for this connection and any session that is created without specifying user defined session default options.String[]desiredCapabilities(String... desiredCapabilities) Sets the collection of capabilities to request from the remote for a newConnectioncreated using theseConnectionOptions.disconnectedHandler(BiConsumer<Connection, DisconnectionEvent> disconnectedHandler) Configures a handler that will be notified when the connection has failed and cannot be recovered should reconnect be enabled.longdrainTimeout(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.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.longidleTimeout(long idleTimeout) Sets the idle timeout (in milliseconds) after which the connection will be closed if the peer has not send any data.idleTimeout(long timeout, TimeUnit units) Sets the idle timeout value after which the connection will be closed if the peer has not send any data.interruptedHandler(BiConsumer<Connection, DisconnectionEvent> interruptedHandler) Configures a handler that will be notified when the currentConnectionexperiences an interruption.intmaxFrameSize(int maxFrameSize) Sets the max frame size (in bytes), values of -1 indicates to use the client selected default.String[]offeredCapabilities(String... offeredCapabilities) Sets the collection of capabilities to offer to the remote from a newConnectioncreated using theseConnectionOptions.longopenTimeout(long openTimeout) Configures the timeout used when awaiting a response from the remote that a request to open a resource such as aConnection,Session,SenderorReceiverhas been honored.openTimeout(long timeout, TimeUnit units) Configures the timeout used when awaiting a response from the remote that a request to open a resource such as aConnection,Session,SenderorReceiverhas been honored.password()Sets the password used when performing connection authentication.properties(Map<String, Object> properties) Sets aMapof properties to convey to the remote when a newConnectionis created from theseConnectionOptions.reconnectedHandler(BiConsumer<Connection, ConnectionEvent> reconnectedHandler) Configures a handler that will be notified when aConnectionthat has previously experienced and interruption has been reconnected to a remote based on the reconnection configuration.booleanreconnectEnabled(boolean reconnectEnabled) Controls if the connection will attempt to reconnect if unable to connect immediately or if an existing connection fails (default is disabled).longrequestTimeout(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.requestTimeout(long timeout, 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.longsendTimeout(long sendTimeout) Configures the timeout used when awaiting a send operation to complete.sendTimeout(long timeout, TimeUnit units) Configures the timeout used when awaiting a send operation to complete.booleansslEnabled(boolean sslEnabled) Controls if the connection will attempt to connect using a secure IO layer or not.booleantraceFrames(boolean traceFrames) Configure if the newly created connection should enabled AMQP frame tracing to the system output.user()Sets the user name used when performing connection authentication.virtualHost(String virtualHost) The virtual host value to provide to the remote when creating a newConnection.
- 
Field Details- 
DEFAULT_DESIRED_CAPABILITIES
- 
INFINITEpublic static final long INFINITE- See Also:
 
- 
DEFAULT_OPEN_TIMEOUTpublic static final long DEFAULT_OPEN_TIMEOUT- See Also:
 
- 
DEFAULT_CLOSE_TIMEOUTpublic static final long DEFAULT_CLOSE_TIMEOUT- See Also:
 
- 
DEFAULT_SEND_TIMEOUTpublic static final long DEFAULT_SEND_TIMEOUT- See Also:
 
- 
DEFAULT_REQUEST_TIMEOUTpublic static final long DEFAULT_REQUEST_TIMEOUT- See Also:
 
- 
DEFAULT_IDLE_TIMEOUTpublic static final long DEFAULT_IDLE_TIMEOUT- See Also:
 
- 
DEFAULT_DRAIN_TIMEOUTpublic static final long DEFAULT_DRAIN_TIMEOUT- See Also:
 
- 
DEFAULT_CHANNEL_MAXpublic static final int DEFAULT_CHANNEL_MAX- See Also:
 
- 
DEFAULT_MAX_FRAME_SIZEpublic static final int DEFAULT_MAX_FRAME_SIZE- See Also:
 
- 
DEFAULT_NEXT_RECEIVER_POLICY
 
- 
- 
Constructor Details- 
ConnectionOptionspublic ConnectionOptions()Create a newConnectionOptionsinstance configured with default configuration settings.
- 
ConnectionOptionsCreates aConnectionOptionsinstance that is a copy of the given instance.- Parameters:
- options- The- ConnectionOptionsinstance whose configuration should be copied to this one.
 
 
- 
- 
Method Details- 
clone
- 
copyIntoCopy all options from thisConnectionOptionsinstance into the instance provided.- Parameters:
- other- the target of this copy operation.
- Returns:
- the ConnectionOptionsinstance that was given.
 
- 
closeTimeoutpublic long closeTimeout()- Returns:
- the timeout used when awaiting a response from the remote when a resource is closed.
 
- 
closeTimeoutConfigures the timeout used when awaiting a response from the remote that a request to close a resource such as aConnection,Session,SenderorReceiverh as been honored.- Parameters:
- closeTimeout- Timeout value in milliseconds to wait for a remote response.
- Returns:
- this ConnectionOptionsinstance.
 
- 
closeTimeoutConfigures the timeout used when awaiting a response from the remote that a request to close a resource such as aConnection,Session,SenderorReceiverh as been honored.- Parameters:
- timeout- Timeout value to wait for a remote response.
- units- The- TimeUnitthat defines the timeout span.
- Returns:
- this ConnectionOptionsinstance.
 
- 
openTimeoutpublic long openTimeout()- Returns:
- the timeout used when awaiting a response from the remote when a resource is opened.
 
- 
openTimeoutConfigures the timeout used when awaiting a response from the remote that a request to open a resource such as aConnection,Session,SenderorReceiverhas been honored.- Parameters:
- openTimeout- Timeout value in milliseconds to wait for a remote response.
- Returns:
- this ConnectionOptionsinstance.
 
- 
openTimeoutConfigures the timeout used when awaiting a response from the remote that a request to open a resource such as aConnection,Session,SenderorReceiverhas been honored.- Parameters:
- timeout- Timeout value to wait for a remote response.
- units- The- TimeUnitthat defines the timeout span.
- Returns:
- this ConnectionOptionsinstance.
 
- 
sendTimeoutpublic long sendTimeout()- Returns:
- the timeout used when awaiting a response from the remote when a resource is message send.
 
- 
sendTimeoutConfigures the timeout used when awaiting a send operation to complete. A send will block if the remote has not granted theSenderor theSessioncredit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutExceptionexception to indicate that the send did not complete.- Parameters:
- sendTimeout- Timeout value in milliseconds to wait for a remote response.
- Returns:
- this ConnectionOptionsinstance.
 
- 
sendTimeoutConfigures the timeout used when awaiting a send operation to complete. A send will block if the remote has not granted theSenderor theSessioncredit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutExceptionexception to indicate that the send did not complete.- Parameters:
- timeout- Timeout value to wait for a remote response.
- units- The- TimeUnitthat defines the timeout span.
- Returns:
- this ConnectionOptionsinstance.
 
- 
requestTimeoutpublic long requestTimeout()- Returns:
- the timeout used when awaiting a response from the remote when a resource makes a request.
 
- 
requestTimeoutConfigures 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.- Parameters:
- requestTimeout- Timeout value in milliseconds to wait for a remote response.
- Returns:
- this ConnectionOptionsinstance.
 
- 
requestTimeoutConfigures 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.- Parameters:
- timeout- Timeout value to wait for a remote response.
- units- The- TimeUnitthat defines the timeout span.
- Returns:
- this ConnectionOptionsinstance.
 
- 
channelMaxpublic int channelMax()- Returns:
- the configured or default channel max value for create Connectioninstances.
 
- 
channelMaxConfigure the channel maximum value for the newConnectioncreated with these options.The channel max value controls how many Sessioninstances can be created by a given Connection, the default value is 65535.- Parameters:
- channelMax- The channel max value to assign to newly created- Connectioninstances.
- Returns:
- this ConnectionOptionsinstance.
 
- 
maxFrameSizepublic int maxFrameSize()- Returns:
- the configure maximum frame size value for newly create Connectioninstances.
 
- 
maxFrameSizeSets the max frame size (in bytes), values of -1 indicates to use the client selected default.- Parameters:
- maxFrameSize- the frame size in bytes.
- Returns:
- this ConnectionOptionsinstance.
 
- 
idleTimeoutpublic long idleTimeout()- Returns:
- the configured idle timeout value that will be sent to the remote.
 
- 
idleTimeoutSets the idle timeout (in milliseconds) after which the connection will be closed if the peer has not send any data. The provided value will be halved before being transmitted as our advertised idle-timeout in the AMQPOpenframe.- Parameters:
- idleTimeout- the timeout in milliseconds.
- Returns:
- this ConnectionOptionsinstance.
 
- 
idleTimeoutSets the idle timeout value after which the connection will be closed if the peer has not send any data. The provided value will be halved before being transmitted as our advertised idle-timeout in the AMQPOpenframe.- Parameters:
- timeout- Timeout value to wait for a remote response.
- units- The- TimeUnitthat defines the timeout span.
- Returns:
- this ConnectionOptionsinstance.
 
- 
drainTimeoutpublic long drainTimeout()- Returns:
- the configured drain timeout value that will use to fail a pending drain request.
 
- 
drainTimeoutSets 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 ConnectionOptionsinstance.
 
- 
drainTimeoutSets 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- The- TimeUnitthat defines the timeout span.
- Returns:
- this ConnectionOptionsinstance.
 
- 
offeredCapabilities- Returns:
- the offeredCapabilities that have been configured.
 
- 
offeredCapabilitiesSets the collection of capabilities to offer to the remote from a newConnectioncreated using theseConnectionOptions. The offered capabilities advertise to the remote capabilities that thisConnectionsupports.- Parameters:
- offeredCapabilities- the offeredCapabilities to set on a new- Connection.
- Returns:
- this ConnectionOptionsinstance.
 
- 
desiredCapabilities- Returns:
- the desiredCapabilities that have been configured.
 
- 
desiredCapabilitiesSets the collection of capabilities to request from the remote for a newConnectioncreated using theseConnectionOptions. The desired capabilities inform the remote peer of the various capabilities the newConnectionrequires and the remote should return those that it supports in its offered capabilities.- Parameters:
- desiredCapabilities- the desiredCapabilities to set on a new- Connection.
- Returns:
- this ConnectionOptionsinstance.
 
- 
properties- Returns:
- the properties that have been configured.
 
- 
propertiesSets aMapof properties to convey to the remote when a newConnectionis created from theseConnectionOptions.- Parameters:
- properties- the properties to set
- Returns:
- this ConnectionOptionsinstance.
 
- 
virtualHost- Returns:
- the virtual host value configured.
 
- 
virtualHostThe virtual host value to provide to the remote when creating a newConnection.A value of nullsignifies that the client should send the host value used to connect to the remote in the SASLInit and Open performatives, otherwise the value provided is sent unless empty string is provided in which case no AMQP host value is sent in either the SASLInit or the Open performative allowing the remote to select from a configured default.- Parameters:
- virtualHost- the virtual host to set
- Returns:
- this ConnectionOptionsinstance.
 
- 
user- Returns:
- the user name that is configured for new Connectioninstances.
 
- 
userSets the user name used when performing connection authentication.- Parameters:
- user- the user to set
- Returns:
- this ConnectionOptionsinstance.
 
- 
password- Returns:
- the password that is configured for new Connectioninstances.
 
- 
passwordSets the password used when performing connection authentication.- Parameters:
- password- the password to set
- Returns:
- this ConnectionOptionsinstance.
 
- 
transportOptions- Returns:
- the transport options that will be used for the Connection.
 
- 
sslOptions- Returns:
- the SSL options that will be used for the Connection.
 
- 
saslOptions- Returns:
- the SASL options that will be used for the Connection.
 
- 
reconnectEnabledpublic boolean reconnectEnabled()- Returns:
- true if reconnection support has been enabled for this connection.
 
- 
reconnectEnabledControls if the connection will attempt to reconnect if unable to connect immediately or if an existing connection fails (default is disabled).This option enables or disables reconnection to a remote peer after IO errors or remote forcibly closing the connection. To control specifics of the reconnection configuration for the Connectionthe values must be updated in theReconnectOptionsconfiguration prior to creating the connection.- Parameters:
- reconnectEnabled- Controls if reconnection is enabled or not for the associated- Connection.
- Returns:
- this options instance.
 
- 
reconnectOptions- Returns:
- the reconnection options that will be used for the Connection.
 
- 
traceFramesConfigure if the newly created connection should enabled AMQP frame tracing to the system output.- Parameters:
- traceFrames- true if frame tracing on this connection should be enabled.
- Returns:
- this ConnectionOptionsinstance.
 
- 
traceFramespublic boolean traceFrames()- Returns:
- true if the connection is configured to perform frame tracing.
 
- 
sslEnabledpublic boolean sslEnabled()- Returns:
- true if SSL support has been enabled for this connection.
 
- 
sslEnabledControls if the connection will attempt to connect using a secure IO layer or not.This option enables or disables SSL encryption when connecting to a remote peer. To control specifics of the SSL configuration for the Connectionthe values must be updated in theSslOptionsconfiguration prior to creating the connection.- Parameters:
- sslEnabled- Is SSL encryption enabled for the- Connection.
- Returns:
- this ConnectionOptionsinstance.
 
- 
defaultNextReceiverPolicy- Returns:
- the configured default next receiver policy for the connection.
 
- 
defaultNextReceiverPolicyConfigures the default next receiver policy for this connection and any session that is created without specifying user defined session default options.- Parameters:
- policy- The next receiver policy to assign as the default.
- Returns:
- this ConnectionOptionsinstance.
 
- 
disconnectedHandler- Returns:
- the connection failed handler currently registered.
 
- 
disconnectedHandlerpublic ConnectionOptions disconnectedHandler(BiConsumer<Connection, DisconnectionEvent> disconnectedHandler) Configures a handler that will be notified when the connection has failed and cannot be recovered should reconnect be enabled. Once notified of the failure theConnectionis no longer operable and theConnectionAPIs will throw an exception to indicate that the connection has failed. The client application should close a failedConnectiononce it becomes aware of the failure to ensure all connection resources are cleaned up properly.- Parameters:
- disconnectedHandler- the connection failed handler to notify when the connection fails for any reason.
- Returns:
- this ConnectionOptionsinstance.
- See Also:
- 
- interruptedHandler
- connectedHandler
- disconnectedHandler
 
 
- 
connectedHandler- Returns:
- the connection established handler that is currently registered
 
- 
connectedHandlerConfigures a handler that will be notified when aConnectionhas established. This handler is called for each connection event when reconnection is enabled unless areconnectedHandleris configured in which case this handler is only notified on the first connection to a remote.- Parameters:
- connectedHandler- the connection established handler to assign to these- ConnectionOptions.
- Returns:
- this ConnectionOptionsinstance.
- See Also:
- 
- disconnectedHandler()
- interruptedHandler
- reconnectedHandler
 
 
- 
interruptedHandler- Returns:
- the connection interrupted handler that is currently registered
 
- 
interruptedHandlerpublic ConnectionOptions interruptedHandler(BiConsumer<Connection, DisconnectionEvent> interruptedHandler) Configures a handler that will be notified when the currentConnectionexperiences an interruption. TheConnectionwill only signal this handler when the reconnection feature is enabled and will follow this event either with a notification that the connection has been restored (if a handler is registered), or with a notification that the connection has failed if the reconnection configuration places limits on the the number of reconnection attempts.- Parameters:
- interruptedHandler- the connection interrupted handler to assign to these- ConnectionOptions.
- Returns:
- this ReconnectOptionsinstance.
- See Also:
- 
- connectedHandler
- reconnectedHandler
- disconnectedHandler
 
 
- 
reconnectedHandler- Returns:
- the connection restored handler that is currently registered
 
- 
reconnectedHandlerpublic ConnectionOptions reconnectedHandler(BiConsumer<Connection, ConnectionEvent> reconnectedHandler) Configures a handler that will be notified when aConnectionthat has previously experienced and interruption has been reconnected to a remote based on the reconnection configuration.- Parameters:
- reconnectedHandler- the connection restored handler to assign to these- ConnectionOptions.
- Returns:
- this ReconnectOptionsinstance.
- See Also:
- 
- connectedHandler
- interruptedHandler
- disconnectedHandler
 
 
 
-