Interface ServerLocator
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface ServerLocator extends java.lang.AutoCloseableThe serverLocator locates a server, but beyond that it locates a server based on a list.If you are using straight TCP on the configuration, and if you configure your serverLocator to be HA, the locator will always get an updated list of members to the server, the server will send the updated list to the client.
If you use UDP or JGroups (exclusively JGroups or UDP), the initial discovery is done by the grouping finder, after the initial connection is made the server will always send updates to the client. But the listeners will listen for updates on grouping.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description ServerLocatoraddClusterTopologyListener(ClusterTopologyListener listener)ServerLocatoraddIncomingInterceptor(Interceptor interceptor)Adds an interceptor which will be executed after packets are received from the server.ServerLocatoraddOutgoingInterceptor(Interceptor interceptor)Adds an interceptor which will be executed before packets are sent to the server.booleanallInVM()Verify if all of the transports are using inVM.voidclose()Closes this factory and release all its resourcesClientSessionFactorycreateSessionFactory()Creates a ClientSessionFactory using whatever load balancing policy is in forceClientSessionFactorycreateSessionFactory(java.lang.String nodeID)Creates aClientSessionFactoryto a specific server.ClientSessionFactorycreateSessionFactory(TransportConfiguration transportConfiguration)Creates aClientSessionFactoryto a specific server.ClientSessionFactorycreateSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts)Creates aClientSessionFactoryto a specific server.ClientSessionFactorycreateSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts, boolean failoverOnInitialConnection)Deprecated.This method is no longer acceptable to create a client session factory.intgetAckBatchSize()Returns the acknowledgments batch size.longgetCallFailoverTimeout()Returns the blocking calls failover timeout when the client is awaiting failover, this is over and above the normal call timeout.longgetCallTimeout()Returns the blocking calls timeout.longgetClientFailureCheckPeriod()Returns the period used to check if a client has failed to receive pings from the server.intgetConfirmationWindowSize()Returns the size for the confirmation window of clients using this factory.java.lang.StringgetConnectionLoadBalancingPolicyClassName()Returns the class name of the connection load balancing policy.longgetConnectionTTL()Returns the connection time-to-live.intgetConsumerMaxRate()Returns the maximum rate of message consumption for consumers created through this factory.intgetConsumerWindowSize()Returns the window size for flow control of the consumers created through this factory.DiscoveryGroupConfigurationgetDiscoveryGroupConfiguration()The discovery group configurationjava.lang.StringgetGroupID()Returns the group ID that will be eventually set on each message for the propertyMessage.HDR_GROUP_ID.java.lang.StringgetIncomingInterceptorList()intgetInitialConnectAttempts()intgetInitialMessagePacketSize()Returns the initial size of messages created through this factory.ServerLocatorConfiggetLocatorConfig()longgetMaxRetryInterval()Returns the maximum retry interval (in the case a retry interval multiplier has been specified).intgetMinLargeMessageSize()Returns the large message size threshold.java.lang.StringgetOutgoingInterceptorList()intgetProducerMaxRate()Returns the maximum rate of message production for producers created through this factory.intgetProducerWindowSize()Returns the window size for flow control of the producers created through this factory.ClientProtocolManagerFactorygetProtocolManagerFactory()intgetReconnectAttempts()Returns the maximum number of attempts to retry connection in case of failure.longgetRetryInterval()Returns the time to retry connections created by this factory after failure.doublegetRetryIntervalMultiplier()Returns the multiplier to apply to successive retry intervals.intgetScheduledThreadPoolMaxSize()Returns the maximum size of the scheduled thread pool.TransportConfiguration[]getStaticTransportConfigurations()Returns an array of TransportConfigurations representing the static list of live servers used when creating this objectintgetThreadPoolMaxSize()Returns the maximum size of the thread pool.org.apache.activemq.artemis.core.client.impl.TopologygetTopology()Exposes the Topology used by this ServerLocator.booleangetUseTopologyForLoadBalancing()voidinitialize()This will only instantiate internal objects such as the topologybooleanisAutoGroup()Returns whether producers created through this factory will automatically assign a group ID to the messages they sent.booleanisBlockOnAcknowledge()Returns whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.booleanisBlockOnDurableSend()Returns whether producers created through this factory will block while sending durable messages or do it asynchronously.booleanisBlockOnNonDurableSend()Returns whether producers created through this factory will block while sending non-durable messages or do it asynchronously.booleanisCacheLargeMessagesClient()Whentrue, consumers created through this factory will create temporary files to cache large messages.booleanisClosed()Returns true if close was already calledbooleanisCompressLargeMessage()Whether to compress large messages.booleanisFailoverOnInitialConnection()Deprecated.booleanisHA()Whether this server receives topology notifications from the cluster as servers join or leave the cluster.booleanisPreAcknowledge()Returns whether messages will pre-acknowledged on the server before they are sent to the consumers or not.booleanisUseGlobalPools()Returns whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools.voidremoveClusterTopologyListener(ClusterTopologyListener listener)booleanremoveIncomingInterceptor(Interceptor interceptor)Removes an incoming interceptor.booleanremoveOutgoingInterceptor(Interceptor interceptor)Removes an outgoing interceptor.ServerLocatorsetAckBatchSize(int ackBatchSize)Sets the acknowledgments batch size.ServerLocatorsetAutoGroup(boolean autoGroup)Sets whether producers created through this factory will automatically assign a group ID to the messages they sent.ServerLocatorsetBlockOnAcknowledge(boolean blockOnAcknowledge)Sets whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.ServerLocatorsetBlockOnDurableSend(boolean blockOnDurableSend)Sets whether producers created through this factory will block while sending durable messages or do it asynchronously.ServerLocatorsetBlockOnNonDurableSend(boolean blockOnNonDurableSend)Sets whether producers created through this factory will block while sending non-durable messages or do it asynchronously.ServerLocatorsetCacheLargeMessagesClient(boolean cached)Sets whether large messages received by consumers created through this factory will be cached in temporary files or not.ServerLocatorsetCallFailoverTimeout(long callFailoverTimeout)Sets the blocking call failover timeout.ServerLocatorsetCallTimeout(long callTimeout)Sets the blocking call timeout.ServerLocatorsetClientFailureCheckPeriod(long clientFailureCheckPeriod)Sets the period (in milliseconds) used to check if a client has failed to receive pings from the server.ServerLocatorsetCompressLargeMessage(boolean compressLargeMessages)Sets whether to compress or not large messages.ServerLocatorsetConfirmationWindowSize(int confirmationWindowSize)Sets the size for the confirmation window buffer of clients using this factory.ServerLocatorsetConnectionLoadBalancingPolicyClassName(java.lang.String loadBalancingPolicyClassName)Sets the class name of the connection load balancing policy.ServerLocatorsetConnectionTTL(long connectionTTL)Sets this factory's connections time-to-live.ServerLocatorsetConsumerMaxRate(int consumerMaxRate)Sets the maximum rate of message consumption for consumers created through this factory.ServerLocatorsetConsumerWindowSize(int consumerWindowSize)Sets the window size for flow control of the consumers created through this factory.ServerLocatorsetFailoverOnInitialConnection(boolean failover)Deprecated.ServerLocatorsetGroupID(java.lang.String groupID)Sets the group ID that will be set on each message sent through this factory.ServerLocatorsetIncomingInterceptorList(java.lang.String interceptorList)ServerLocatorsetInitialConnectAttempts(int reconnectAttempts)Sets the maximum number of attempts to establish an initial connection.ServerLocatorsetInitialMessagePacketSize(int size)Sets the initial size of messages created through this factory.voidsetLocatorConfig(ServerLocatorConfig serverLocatorConfig)ServerLocatorsetMaxRetryInterval(long maxRetryInterval)Sets the maximum retry interval.ServerLocatorsetMinLargeMessageSize(int minLargeMessageSize)Sets the large message size threshold.ServerLocatorsetOutgoingInterceptorList(java.lang.String interceptorList)ServerLocatorsetPreAcknowledge(boolean preAcknowledge)Sets totrueto pre-acknowledge consumed messages on the server before they are sent to consumers, else set tofalseto let clients acknowledge the message they consume.ServerLocatorsetProducerMaxRate(int producerMaxRate)Sets the maximum rate of message production for producers created through this factory.ServerLocatorsetProducerWindowSize(int producerWindowSize)Returns the window size for flow control of the producers created through this factory.ServerLocatorsetProtocolManagerFactory(ClientProtocolManagerFactory protocolManager)ServerLocatorsetReconnectAttempts(int reconnectAttempts)Sets the maximum number of attempts to retry connection in case of failure.ServerLocatorsetRetryInterval(long retryInterval)Sets the time to retry connections created by this factory after failure.ServerLocatorsetRetryIntervalMultiplier(double retryIntervalMultiplier)Sets the multiplier to apply to successive retry intervals.ServerLocatorsetScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)Sets the maximum size of the scheduled thread pool.ServerLocatorsetThreadPoolMaxSize(int threadPoolMaxSize)Sets the maximum size of the thread pool.booleansetThreadPools(java.util.concurrent.Executor threadPool, java.util.concurrent.ScheduledExecutorService scheduledThreadPoolExecutor)ServerLocatorsetUseGlobalPools(boolean useGlobalPools)Sets whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools.ServerLocatorsetUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing)
-
-
-
Method Detail
-
isClosed
boolean isClosed()
Returns true if close was already called- Returns:
trueif closed,falseotherwise.
-
createSessionFactory
ClientSessionFactory createSessionFactory() throws java.lang.Exception
Creates a ClientSessionFactory using whatever load balancing policy is in force- Returns:
- The ClientSessionFactory
- Throws:
java.lang.Exception
-
createSessionFactory
ClientSessionFactory createSessionFactory(java.lang.String nodeID) throws java.lang.Exception
Creates aClientSessionFactoryto a specific server. The server must already be known about by this ServerLocator. This method allows the user to make a connection to a specific server bypassing any load balancing policy in force- Parameters:
nodeID-- Returns:
- a ClientSessionFactory instance or
nullif the node is not present on the topology - Throws:
java.lang.Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration) throws java.lang.Exception
Creates aClientSessionFactoryto a specific server. The server must already be known about by this ServerLocator. This method allows the user to make a connection to a specific server bypassing any load balancing policy in force- Parameters:
transportConfiguration-- Returns:
- a
ClientSessionFactoryinstance - Throws:
java.lang.Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts) throws java.lang.Exception
Creates aClientSessionFactoryto a specific server. The server must already be known about by this ServerLocator. This method allows the user to make a connection to a specific server bypassing any load balancing policy in force- Parameters:
transportConfiguration-reconnectAttempts- number of attempts of reconnection to perform- Returns:
- a
ClientSessionFactoryinstance - Throws:
java.lang.Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
@Deprecated ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts, boolean failoverOnInitialConnection) throws java.lang.Exception
Deprecated.This method is no longer acceptable to create a client session factory. Replaced bycreateSessionFactory(TransportConfiguration, int).Creates aClientSessionFactoryto a specific server. The server must already be known about by this ServerLocator. This method allows the user to make a connection to a specific server bypassing any load balancing policy in force- Parameters:
transportConfiguration-reconnectAttempts- number of attempts of reconnection to performfailoverOnInitialConnection-- Returns:
- a
ClientSessionFactoryinstance - Throws:
java.lang.Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
getClientFailureCheckPeriod
long getClientFailureCheckPeriod()
Returns the period used to check if a client has failed to receive pings from the server.Period is in milliseconds, default value is
ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD.- Returns:
- the period used to check if a client has failed to receive pings from the server
-
setClientFailureCheckPeriod
ServerLocator setClientFailureCheckPeriod(long clientFailureCheckPeriod)
Sets the period (in milliseconds) used to check if a client has failed to receive pings from the server.Value must be -1 (to disable) or greater than 0.
- Parameters:
clientFailureCheckPeriod- the period to check failure- Returns:
- this ServerLocator
-
isCacheLargeMessagesClient
boolean isCacheLargeMessagesClient()
Whentrue, consumers created through this factory will create temporary files to cache large messages.There is 1 temporary file created for each large message.
Default value is
ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT.- Returns:
trueif consumers created through this factory will cache large messages in temporary files,falseelse
-
setCacheLargeMessagesClient
ServerLocator setCacheLargeMessagesClient(boolean cached)
Sets whether large messages received by consumers created through this factory will be cached in temporary files or not.- Parameters:
cached-trueto cache large messages in temporary files,falseelse- Returns:
- this ServerLocator
-
getConnectionTTL
long getConnectionTTL()
Returns the connection time-to-live.This TTL determines how long the server will keep a connection alive in the absence of any data arriving from the client. Value is in milliseconds, default value is
ActiveMQClient.DEFAULT_CONNECTION_TTL.- Returns:
- the connection time-to-live in milliseconds
-
setConnectionTTL
ServerLocator setConnectionTTL(long connectionTTL)
Sets this factory's connections time-to-live.Value must be -1 (to disable) or greater or equals to 0.
- Parameters:
connectionTTL- period in milliseconds- Returns:
- this ServerLocator
-
getCallTimeout
long getCallTimeout()
Returns the blocking calls timeout.If client's blocking calls to the server take more than this timeout, the call will throw a
ActiveMQExceptionwith the codeActiveMQExceptionType.CONNECTION_TIMEDOUT. Value is in milliseconds, default value isActiveMQClient.DEFAULT_CALL_TIMEOUT.- Returns:
- the blocking calls timeout
-
setCallTimeout
ServerLocator setCallTimeout(long callTimeout)
Sets the blocking call timeout.Value must be greater or equals to 0
- Parameters:
callTimeout- blocking call timeout in milliseconds- Returns:
- this ServerLocator
-
getCallFailoverTimeout
long getCallFailoverTimeout()
Returns the blocking calls failover timeout when the client is awaiting failover, this is over and above the normal call timeout.If client is in the process of failing over when a blocking call is called then the client will wait this long before actually trying the send.
- Returns:
- the blocking calls failover timeout
-
setCallFailoverTimeout
ServerLocator setCallFailoverTimeout(long callFailoverTimeout)
Sets the blocking call failover timeout.When the client is awaiting failover, this is over and above the normal call timeout.
Value must be greater or equals to -1, -1 means forever
- Parameters:
callFailoverTimeout- blocking call timeout in milliseconds- Returns:
- this ServerLocator
-
getMinLargeMessageSize
int getMinLargeMessageSize()
Returns the large message size threshold.Messages whose size is if greater than this value will be handled as large messages. Value is in bytes, default value is
ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE.- Returns:
- the message size threshold to treat messages as large messages.
-
setMinLargeMessageSize
ServerLocator setMinLargeMessageSize(int minLargeMessageSize)
Sets the large message size threshold.Value must be greater than 0.
- Parameters:
minLargeMessageSize- large message size threshold in bytes- Returns:
- this ServerLocator
-
getConsumerWindowSize
int getConsumerWindowSize()
Returns the window size for flow control of the consumers created through this factory.Value is in bytes, default value is
ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE.- Returns:
- the window size used for consumer flow control
-
setConsumerWindowSize
ServerLocator setConsumerWindowSize(int consumerWindowSize)
Sets the window size for flow control of the consumers created through this factory.Value must be -1 (to disable flow control), 0 (to not buffer any messages) or greater than 0 (to set the maximum size of the buffer)
- Parameters:
consumerWindowSize- window size (in bytes) used for consumer flow control- Returns:
- this ServerLocator
-
getConsumerMaxRate
int getConsumerMaxRate()
Returns the maximum rate of message consumption for consumers created through this factory.This value controls the rate at which a consumer can consume messages. A consumer will never consume messages at a rate faster than the rate specified.
Value is -1 (to disable) or a positive integer corresponding to the maximum desired message consumption rate specified in units of messages per second. Default value is
ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE.- Returns:
- the consumer max rate
-
setConsumerMaxRate
ServerLocator setConsumerMaxRate(int consumerMaxRate)
Sets the maximum rate of message consumption for consumers created through this factory.Value must -1 (to disable) or a positive integer corresponding to the maximum desired message consumption rate specified in units of messages per second.
- Parameters:
consumerMaxRate- maximum rate of message consumption (in messages per seconds)- Returns:
- this ServerLocator
-
getConfirmationWindowSize
int getConfirmationWindowSize()
Returns the size for the confirmation window of clients using this factory.Value is in bytes or -1 (to disable the window). Default value is
ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE.- Returns:
- the size for the confirmation window of clients using this factory
-
setConfirmationWindowSize
ServerLocator setConfirmationWindowSize(int confirmationWindowSize)
Sets the size for the confirmation window buffer of clients using this factory.Value must be -1 (to disable the window) or greater than 0.
- Parameters:
confirmationWindowSize- size of the confirmation window (in bytes)- Returns:
- this ServerLocator
-
getProducerWindowSize
int getProducerWindowSize()
Returns the window size for flow control of the producers created through this factory.Value must be -1 (to disable flow control) or greater than 0 to determine the maximum amount of bytes at any give time (to prevent overloading the connection). Default value is
ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE.- Returns:
- the window size for flow control of the producers created through this factory.
-
setProducerWindowSize
ServerLocator setProducerWindowSize(int producerWindowSize)
Returns the window size for flow control of the producers created through this factory.Value must be -1 (to disable flow control) or greater than 0.
- Parameters:
producerWindowSize- window size (in bytest) for flow control of the producers created through this factory.- Returns:
- this ServerLocator
-
getProducerMaxRate
int getProducerMaxRate()
Returns the maximum rate of message production for producers created through this factory.This value controls the rate at which a producer can produce messages. A producer will never produce messages at a rate faster than the rate specified.
Value is -1 (to disable) or a positive integer corresponding to the maximum desired message production rate specified in units of messages per second. Default value is
ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE.- Returns:
- maximum rate of message production (in messages per seconds)
-
setProducerMaxRate
ServerLocator setProducerMaxRate(int producerMaxRate)
Sets the maximum rate of message production for producers created through this factory.Value must -1 (to disable) or a positive integer corresponding to the maximum desired message production rate specified in units of messages per second.
- Parameters:
producerMaxRate- maximum rate of message production (in messages per seconds)- Returns:
- this ServerLocator
-
isBlockOnAcknowledge
boolean isBlockOnAcknowledge()
Returns whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.Default value is
ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE.- Returns:
- whether consumers will block while sending message acknowledgments or do it asynchronously
-
setBlockOnAcknowledge
ServerLocator setBlockOnAcknowledge(boolean blockOnAcknowledge)
Sets whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.- Parameters:
blockOnAcknowledge-trueto block when sending message acknowledgments orfalseto send them asynchronously- Returns:
- this ServerLocator
-
isBlockOnDurableSend
boolean isBlockOnDurableSend()
Returns whether producers created through this factory will block while sending durable messages or do it asynchronously.
If the session is configured to send durable message asynchronously, the client can set a SendAcknowledgementHandler on the ClientSession to be notified once the message has been handled by the server.Default value is
ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND.- Returns:
- whether producers will block while sending persistent messages or do it asynchronously
-
setBlockOnDurableSend
ServerLocator setBlockOnDurableSend(boolean blockOnDurableSend)
Sets whether producers created through this factory will block while sending durable messages or do it asynchronously.- Parameters:
blockOnDurableSend-trueto block when sending durable messages orfalseto send them asynchronously- Returns:
- this ServerLocator
-
isBlockOnNonDurableSend
boolean isBlockOnNonDurableSend()
Returns whether producers created through this factory will block while sending non-durable messages or do it asynchronously.
If the session is configured to send non-durable message asynchronously, the client can set a SendAcknowledgementHandler on the ClientSession to be notified once the message has been handled by the server.Default value is
ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND.- Returns:
- whether producers will block while sending non-durable messages or do it asynchronously
-
setBlockOnNonDurableSend
ServerLocator setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
Sets whether producers created through this factory will block while sending non-durable messages or do it asynchronously.- Parameters:
blockOnNonDurableSend-trueto block when sending non-durable messages orfalseto send them asynchronously- Returns:
- this ServerLocator
-
isAutoGroup
boolean isAutoGroup()
Returns whether producers created through this factory will automatically assign a group ID to the messages they sent.if
true, a random unique group ID is created and set on each message for the propertyMessage.HDR_GROUP_ID. Default value isActiveMQClient.DEFAULT_AUTO_GROUP.- Returns:
- whether producers will automatically assign a group ID to their messages
-
setAutoGroup
ServerLocator setAutoGroup(boolean autoGroup)
Sets whether producers created through this factory will automatically assign a group ID to the messages they sent.- Parameters:
autoGroup-trueto automatically assign a group ID to each messages sent through this factory,falseelse- Returns:
- this ServerLocator
-
getGroupID
java.lang.String getGroupID()
Returns the group ID that will be eventually set on each message for the propertyMessage.HDR_GROUP_ID.Default value is is
nulland no group ID will be set on the messages.- Returns:
- the group ID that will be eventually set on each message
-
setGroupID
ServerLocator setGroupID(java.lang.String groupID)
Sets the group ID that will be set on each message sent through this factory.- Parameters:
groupID- the group ID to use- Returns:
- this ServerLocator
-
isPreAcknowledge
boolean isPreAcknowledge()
Returns whether messages will pre-acknowledged on the server before they are sent to the consumers or not.Default value is
ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE
-
setPreAcknowledge
ServerLocator setPreAcknowledge(boolean preAcknowledge)
Sets totrueto pre-acknowledge consumed messages on the server before they are sent to consumers, else set tofalseto let clients acknowledge the message they consume.- Parameters:
preAcknowledge-trueto enable pre-acknowledgment,falseelse- Returns:
- this ServerLocator
-
getAckBatchSize
int getAckBatchSize()
Returns the acknowledgments batch size.Default value is
ActiveMQClient.DEFAULT_ACK_BATCH_SIZE.- Returns:
- the acknowledgments batch size
-
setAckBatchSize
ServerLocator setAckBatchSize(int ackBatchSize)
Sets the acknowledgments batch size.Value must be equal or greater than 0.
- Parameters:
ackBatchSize- acknowledgments batch size- Returns:
- this ServerLocator
-
getStaticTransportConfigurations
TransportConfiguration[] getStaticTransportConfigurations()
Returns an array of TransportConfigurations representing the static list of live servers used when creating this object- Returns:
- array with all static
TransportConfigurations
-
getDiscoveryGroupConfiguration
DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
The discovery group configuration
-
isUseGlobalPools
boolean isUseGlobalPools()
Returns whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools.Default value is
ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS.- Returns:
trueif this factory uses global thread pools,falseelse
-
setUseGlobalPools
ServerLocator setUseGlobalPools(boolean useGlobalPools)
Sets whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools.- Parameters:
useGlobalPools-trueto let this factory uses global thread pools,falseelse- Returns:
- this ServerLocator
-
getScheduledThreadPoolMaxSize
int getScheduledThreadPoolMaxSize()
Returns the maximum size of the scheduled thread pool.Default value is
ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE.- Returns:
- the maximum size of the scheduled thread pool.
-
setScheduledThreadPoolMaxSize
ServerLocator setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
Sets the maximum size of the scheduled thread pool.This setting is relevant only if this factory does not use global pools. Value must be greater than 0.
- Parameters:
scheduledThreadPoolMaxSize- maximum size of the scheduled thread pool.- Returns:
- this ServerLocator
-
getThreadPoolMaxSize
int getThreadPoolMaxSize()
Returns the maximum size of the thread pool.Default value is
ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE.- Returns:
- the maximum size of the thread pool.
-
setThreadPoolMaxSize
ServerLocator setThreadPoolMaxSize(int threadPoolMaxSize)
Sets the maximum size of the thread pool.This setting is relevant only if this factory does not use global pools. Value must be -1 (for unlimited thread pool) or greater than 0.
- Parameters:
threadPoolMaxSize- maximum size of the thread pool.- Returns:
- this ServerLocator
-
getRetryInterval
long getRetryInterval()
Returns the time to retry connections created by this factory after failure.Value is in milliseconds, default is
ActiveMQClient.DEFAULT_RETRY_INTERVAL.- Returns:
- the time to retry connections created by this factory after failure
-
setRetryInterval
ServerLocator setRetryInterval(long retryInterval)
Sets the time to retry connections created by this factory after failure.Value must be greater than 0.
- Parameters:
retryInterval- time (in milliseconds) to retry connections created by this factory after failure- Returns:
- this ServerLocator
-
getRetryIntervalMultiplier
double getRetryIntervalMultiplier()
Returns the multiplier to apply to successive retry intervals.Default value is
ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER.- Returns:
- the multiplier to apply to successive retry intervals
-
setRetryIntervalMultiplier
ServerLocator setRetryIntervalMultiplier(double retryIntervalMultiplier)
Sets the multiplier to apply to successive retry intervals.Value must be positive.
- Parameters:
retryIntervalMultiplier- multiplier to apply to successive retry intervals- Returns:
- this ServerLocator
-
getMaxRetryInterval
long getMaxRetryInterval()
Returns the maximum retry interval (in the case a retry interval multiplier has been specified).Value is in milliseconds, default value is
ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL.- Returns:
- the maximum retry interval
-
setMaxRetryInterval
ServerLocator setMaxRetryInterval(long maxRetryInterval)
Sets the maximum retry interval.Value must be greater than 0.
- Parameters:
maxRetryInterval- maximum retry interval to apply in the case a retry interval multiplier has been specified- Returns:
- this ServerLocator
-
getReconnectAttempts
int getReconnectAttempts()
Returns the maximum number of attempts to retry connection in case of failure.Default value is
ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS.- Returns:
- the maximum number of attempts to retry connection in case of failure.
-
setReconnectAttempts
ServerLocator setReconnectAttempts(int reconnectAttempts)
Sets the maximum number of attempts to retry connection in case of failure.Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0.
- Parameters:
reconnectAttempts- maximum number of attempts to retry connection in case of failure- Returns:
- this ServerLocator
-
setInitialConnectAttempts
ServerLocator setInitialConnectAttempts(int reconnectAttempts)
Sets the maximum number of attempts to establish an initial connection.Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0.
- Parameters:
reconnectAttempts- maximum number of attempts for the initial connection- Returns:
- this ServerLocator
-
getInitialConnectAttempts
int getInitialConnectAttempts()
- Returns:
- the number of attempts to be made for first initial connection.
-
isFailoverOnInitialConnection
@Deprecated boolean isFailoverOnInitialConnection()
Deprecated.Returns true if the client will automatically attempt to connect to the backup server if the initial connection to the live server failsDefault value is
ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION.
-
setFailoverOnInitialConnection
@Deprecated ServerLocator setFailoverOnInitialConnection(boolean failover)
Deprecated.Sets the value for FailoverOnInitialReconnection- Parameters:
failover-- Returns:
- this ServerLocator
-
getConnectionLoadBalancingPolicyClassName
java.lang.String getConnectionLoadBalancingPolicyClassName()
Returns the class name of the connection load balancing policy.Default value is "org.apache.activemq.artemis.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy".
- Returns:
- the class name of the connection load balancing policy
-
setConnectionLoadBalancingPolicyClassName
ServerLocator setConnectionLoadBalancingPolicyClassName(java.lang.String loadBalancingPolicyClassName)
Sets the class name of the connection load balancing policy.Value must be the name of a class implementing
ConnectionLoadBalancingPolicy.- Parameters:
loadBalancingPolicyClassName- class name of the connection load balancing policy- Returns:
- this ServerLocator
-
getInitialMessagePacketSize
int getInitialMessagePacketSize()
Returns the initial size of messages created through this factory.Value is in bytes, default value is
ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE.- Returns:
- the initial size of messages created through this factory
-
setInitialMessagePacketSize
ServerLocator setInitialMessagePacketSize(int size)
Sets the initial size of messages created through this factory.Value must be greater than 0.
- Parameters:
size- initial size of messages created through this factory.- Returns:
- this ServerLocator
-
addIncomingInterceptor
ServerLocator addIncomingInterceptor(Interceptor interceptor)
Adds an interceptor which will be executed after packets are received from the server.- Parameters:
interceptor- an Interceptor- Returns:
- this ServerLocator
-
addOutgoingInterceptor
ServerLocator addOutgoingInterceptor(Interceptor interceptor)
Adds an interceptor which will be executed before packets are sent to the server.- Parameters:
interceptor- an Interceptor- Returns:
- this ServerLocator
-
removeIncomingInterceptor
boolean removeIncomingInterceptor(Interceptor interceptor)
Removes an incoming interceptor.- Parameters:
interceptor- interceptor to remove- Returns:
trueif the incoming interceptor is removed from this factory,falseelse
-
removeOutgoingInterceptor
boolean removeOutgoingInterceptor(Interceptor interceptor)
Removes an outgoing interceptor.- Parameters:
interceptor- interceptor to remove- Returns:
trueif the outgoing interceptor is removed from this factory,falseelse
-
close
void close()
Closes this factory and release all its resources- Specified by:
closein interfacejava.lang.AutoCloseable
-
setUseTopologyForLoadBalancing
ServerLocator setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing)
- Parameters:
useTopologyForLoadBalancing-- Returns:
-
getUseTopologyForLoadBalancing
boolean getUseTopologyForLoadBalancing()
-
getTopology
org.apache.activemq.artemis.core.client.impl.Topology getTopology()
Exposes the Topology used by this ServerLocator.- Returns:
- topology
-
isHA
boolean isHA()
Whether this server receives topology notifications from the cluster as servers join or leave the cluster.- Returns:
trueif the locator receives topology updates from the cluster
-
allInVM
boolean allInVM()
Verify if all of the transports are using inVM.- Returns:
trueif the locator has all inVM transports.
-
isCompressLargeMessage
boolean isCompressLargeMessage()
Whether to compress large messages.- Returns:
-
setCompressLargeMessage
ServerLocator setCompressLargeMessage(boolean compressLargeMessages)
Sets whether to compress or not large messages.- Parameters:
compressLargeMessages-- Returns:
- this ServerLocator
-
addClusterTopologyListener
ServerLocator addClusterTopologyListener(ClusterTopologyListener listener)
-
removeClusterTopologyListener
void removeClusterTopologyListener(ClusterTopologyListener listener)
-
getProtocolManagerFactory
ClientProtocolManagerFactory getProtocolManagerFactory()
-
setProtocolManagerFactory
ServerLocator setProtocolManagerFactory(ClientProtocolManagerFactory protocolManager)
-
setIncomingInterceptorList
ServerLocator setIncomingInterceptorList(java.lang.String interceptorList)
- Parameters:
interceptorList- a comma separated string of incoming interceptor class names to be used. Each interceptor needs a default Constructor to be used with this method.- Returns:
- this
-
getIncomingInterceptorList
java.lang.String getIncomingInterceptorList()
-
setOutgoingInterceptorList
ServerLocator setOutgoingInterceptorList(java.lang.String interceptorList)
-
getOutgoingInterceptorList
java.lang.String getOutgoingInterceptorList()
-
setThreadPools
boolean setThreadPools(java.util.concurrent.Executor threadPool, java.util.concurrent.ScheduledExecutorService scheduledThreadPoolExecutor)
-
initialize
void initialize() throws org.apache.activemq.artemis.api.core.ActiveMQExceptionThis will only instantiate internal objects such as the topology- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
getLocatorConfig
ServerLocatorConfig getLocatorConfig()
-
setLocatorConfig
void setLocatorConfig(ServerLocatorConfig serverLocatorConfig)
-
-