@Immutable public final class SessionOptions extends Object
Provides a value-semantic type which is used to specify session-level configuration parameters.
Most applications should not need to change the parameters for creating a AbstractSession
; the default parameters are fine.
The following parameters are supported:
brokerUri
: Address of the broker to connect to. Default is to connect to the broker
on the local host on the default port (30114). The format is tcp://<host>:port
.
Host can be:
foobar
(or localhost
)
10.11.12.13
WriteBufferWaterMark
: Sizes (in bytes) to use for write cache high and low
watermarks on the channel. Default value for high watermark is 64MB. Note that BlazingMQ
reserves 4MB of this value for control message, so the actual watermark for data published
is 'HighWatermark - 4MB'. Default value for low watermark is 1MB.
statsDumpInterval
: Interval (in seconds) at which to dump stats in the logs. Set to
0 to disable recurring dump of stats (final stats are always dumped at end of session).
Default is 5min.
startTimeout
,
stopTimeout
,
openQueueTimeout
,
configureQueueTimeout
,
closeQueueTimeout
.
hostHealthMonitor
: Optional instance of a class implementing HostHealthMonitor
interface responsible for notifying the session when the health of the
host machine has changed. A hostHealthMonitor
must be specified in oder for queues
opened through the session to suspend on unhealthy hosts.
SessionOptions
object is immutable and thread safe. Helper class Builder
is provided for SessionOptions
creation.
SessionOptions
object with default values:
SessionOptions opts = SessionOptions.createDefault();
SessionOptions
object with custom values:
SessionOptions opts = SessionOptions.builder() .setBrokerUri(URI.create("tcp://localhost:" + 12345)) .build();
Modifier and Type | Class and Description |
---|---|
static class |
SessionOptions.Builder
Helper class to create a
SesssionOptions object with custom settings. |
static class |
SessionOptions.InboundEventBufferWaterMark
Immutable helper class to set sizes (in number of events) for the inbound event buffer high
and low watermarks.
|
static class |
SessionOptions.WriteBufferWaterMark
Immutable helper class to set sizes (in bytes) for write cache high and low watermarks on the
channel.
|
Modifier and Type | Method and Description |
---|---|
URI |
brokerUri()
Returns URI which will be used by the
Session to connect with the
BlazingMQ broker. |
static SessionOptions.Builder |
builder()
Returns a helper class object to set different session level options.
|
Duration |
closeQueueTimeout()
Returns timeout value that defines how much time the user gives to the
Queue for successful close operation. |
Duration |
configureQueueTimeout()
Returns timeout value that defines how much time the user gives to the
Queue for successful configure call. |
static SessionOptions |
createDefault()
Creates this class object with default settings.
|
HostHealthMonitor |
hostHealthMonitor()
Returns an object which monitors the health of the host.
|
SessionOptions.InboundEventBufferWaterMark |
inboundBufferWaterMark()
Returns a helper class object that holds high and low inbound event buffer watermark values.
|
Duration |
openQueueTimeout()
Returns timeout value that defines how much time the user gives to the
Queue for successful queue opening. |
Duration |
startTimeout()
Returns timeout value that defines how much time the user gives to the
Session for successful start. |
Duration |
statsDumpInterval()
Returns interval (in seconds) at which to dump stats in the logs.
|
Duration |
stopTimeout()
Returns timeout value that defines how much time the user gives to the
Session for successful stop. |
SessionOptions.WriteBufferWaterMark |
writeBufferWaterMark()
Returns a helper class object that holds high and low channel watermark values.
|
public static SessionOptions createDefault()
public static SessionOptions.Builder builder()
public URI brokerUri()
Session
to connect with the
BlazingMQ broker.public Duration startTimeout()
Session
for successful start.
Note: this value is used if explicit timeout calling the Session.start(java.time.Duration)
or Session.startAsync(java.time.Duration)
is not
provided.
public Duration stopTimeout()
Session
for successful stop.
Note: this value is used if explicit timeout calling the Session.stop(java.time.Duration)
or Session.stopAsync(java.time.Duration)
is not
provided.
public SessionOptions.WriteBufferWaterMark writeBufferWaterMark()
public SessionOptions.InboundEventBufferWaterMark inboundBufferWaterMark()
public Duration statsDumpInterval()
public Duration openQueueTimeout()
Queue
for successful queue opening. Note: this value is used if explicit
timeout calling the Queue.open(com.bloomberg.bmq.QueueOptions, java.time.Duration)
or Queue.openAsync(com.bloomberg.bmq.QueueOptions, java.time.Duration)
is not provided.public Duration configureQueueTimeout()
Queue
for successful configure call. Note: this value is used if explicit
timeout calling the Queue.configure(com.bloomberg.bmq.QueueOptions, java.time.Duration)
or Queue.configureAsync(com.bloomberg.bmq.QueueOptions, java.time.Duration)
is not provided.public Duration closeQueueTimeout()
Queue
for successful close operation. Note: this value is used if explicit
timeout calling the Queue.close(java.time.Duration)
or Queue.closeAsync(java.time.Duration)
is not provided.public HostHealthMonitor hostHealthMonitor()
Copyright © 2023 Bloomberg L.P.. All rights reserved.