Class ServerLocatorImpl
- All Implemented Interfaces:
AutoCloseable,ServerLocator,ServerLocatorInternal,DiscoveryListener
ServerLocator and all the proper
javadoc is located on that interface.-
Constructor Summary
ConstructorsConstructorDescriptionServerLocatorImpl(boolean useHA, DiscoveryGroupConfiguration groupConfiguration) Create a ServerLocatorImpl using UDP discovery to lookup clusterServerLocatorImpl(boolean useHA, TransportConfiguration... transportConfigs) Create a ServerLocatorImpl using a static list of serversServerLocatorImpl(Topology topology, boolean useHA, DiscoveryGroupConfiguration groupConfiguration) Create a ServerLocatorImpl using UDP discovery to lookup clusterServerLocatorImpl(Topology topology, boolean useHA, TransportConfiguration... transportConfigs) Create a ServerLocatorImpl using a static list of servers -
Method Summary
Modifier and TypeMethodDescriptionaddIncomingInterceptor(Interceptor interceptor) Adds an interceptor which will be executed after packets are received from the server.addOutgoingInterceptor(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.voidcleanup()static voidvoidclose()Closes this factory and release all its resourcesconnect()LikeServerLocatorInternal.connect()but it does not log warnings if it fails to connect.voidconnectorsChanged(List<DiscoveryEntry> newConnectors) Creates a ClientSessionFactory using whatever load balancing policy is in forcecreateSessionFactory(String nodeID) Creates aClientSessionFactoryto a specific server.createSessionFactory(TransportConfiguration transportConfiguration) Creates aClientSessionFactoryto a specific server.createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts) Creates aClientSessionFactoryto a specific server.createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts, boolean failoverOnInitialConnection) Deprecated.voidfactoryClosed(ClientSessionFactory factory) voidintReturns the acknowledgments batch size.longReturns the blocking calls failover timeout when the client is awaiting failover, this is over and above the normal call timeout.longReturns the blocking calls timeout.longReturns the period used to check if a client has failed to receive pings from the server.intintWhat compression level is in useintReturns the size for the confirmation window of clients using this factory.Returns the class name of the connection load balancing policy.longReturns the connection time-to-live.intintReturns the maximum rate of message consumption for consumers created through this factory.intReturns the window size for flow control of the consumers created through this factory.For tests onlyThe discovery group configurationFor tests onlyintReturns the number of failover attempts after a connection failure.intReturns the maximum size of the flow-control thread pool.Returns the group ID that will be eventually set on each message for the propertyMessage.HDR_GROUP_ID.intReturns the number of attempts to be made for first initial connection.for tests only and not part of the public interface.intReturns the initial size of messages created through this factory.longReturns the maximum retry interval (in the case a retry interval multiplier has been specified).intReturns the large message size threshold.longgetNextRetryInterval(long retryInterval, double retryIntervalMultiplier, long maxRetryInterval) intReturns the timeout for onMessage completion when closing ClientConsumers created through this factory.intReturns the maximum rate of message production for producers created through this factory.intReturns the window size for flow control of the producers created through this factory.intReturns the maximum number of attempts to retry connection in case of failure.longReturns the time to retry connections created by this factory after failure.doubleReturns the multiplier to apply to successive retry intervals.intReturns the maximum size of the scheduled thread pool.Returns an array of TransportConfigurations representing the static list of servers used when creating this objectintReturns the maximum size of the thread pool.Exposes the Topology used by this ServerLocator.booleanvoidThis will only instantiate internal objects such as the topologybooleanReturns whether producers created through this factory will automatically assign a group ID to the messages they sent.booleanReturns whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.booleanReturns whether producers created through this factory will block while sending durable messages or do it asynchronously.booleanReturns whether producers created through this factory will block while sending non-durable messages or do it asynchronously.booleanWhentrue, consumers created through this factory will create temporary files to cache large messages.booleanisClosed()Returnstrueif closed,falseotherwise.booleanbooleanWhether to compress large messages.booleanbooleanDeprecated.booleanisHA()Whether this server receives topology notifications from the cluster as servers join or leave the cluster.booleanReturns whether messages will pre-acknowledged on the server before they are sent to the consumers or not.booleanbooleanReturns whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools.static ServerLocatornewLocator(String uri) static ServerLocatornewLocator(URI uri) voidnotifyNodeDown(long eventTime, String nodeID, boolean disconnect) This is directly called when the connection to the node is gone, or when the node sends a disconnection.voidnotifyNodeUp(long uniqueEventID, String nodeID, String backupGroupName, String scaleDownGroupName, Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean last) voidbooleanremoveIncomingInterceptor(Interceptor interceptor) Removes an incoming interceptor.booleanremoveOutgoingInterceptor(Interceptor interceptor) Removes an outgoing interceptor.voidsetAckBatchSize(int ackBatchSize) Sets the acknowledgments batch size.setAutoGroup(boolean autoGroup) Sets whether producers created through this factory will automatically assign a group ID to the messages they sent.setBlockOnAcknowledge(boolean blockOnAcknowledge) Sets whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.setBlockOnDurableSend(boolean blockOnDurableSend) Sets whether producers created through this factory will block while sending durable messages or do it asynchronously.setBlockOnNonDurableSend(boolean blockOnNonDurableSend) Sets whether producers created through this factory will block while sending non-durable messages or do it asynchronously.setCacheLargeMessagesClient(boolean cached) Sets whether large messages received by consumers created through this factory will be cached in temporary files or not.setCallFailoverTimeout(long callFailoverTimeout) Sets the blocking call failover timeout.setCallTimeout(long callTimeout) Sets the blocking call timeout.setClientFailureCheckPeriod(long clientFailureCheckPeriod) Sets the period (in milliseconds) used to check if a client has failed to receive pings from the server.setClusterConnection(boolean clusterConnection) setCompressionLevel(int compressionLevel) Sets what compressionLevel to use when compressing messages Value must be -1 (default), or 0-9setCompressLargeMessage(boolean avoid) Sets whether to compress or not large messages.setConfirmationWindowSize(int confirmationWindowSize) Sets the size for the confirmation window buffer of clients using this factory.setConnectionLoadBalancingPolicyClassName(String loadBalancingPolicyClassName) Sets the class name of the connection load balancing policy.setConnectionTTL(long connectionTTL) Sets this factory's connections time-to-live.setConsumerMaxRate(int consumerMaxRate) Sets the maximum rate of message consumption for consumers created through this factory.setConsumerWindowSize(int consumerWindowSize) Sets the window size for flow control of the consumers created through this factory.setDiscoveryListener(DiscoveryListener discoveryListener) setFailoverAttempts(int attempts) Sets the maximum number of failover attempts to establish a connection to other primary servers after a connection failure.setFailoverOnInitialConnection(boolean failover) Deprecated.setFlowControlThreadPoolMaxSize(int flowControlThreadPoolMaxSize) Sets the maximum size of the flow-control thread pool.setGroupID(String groupID) Sets the group ID that will be set on each message sent through this factory.setIdentity(String identity) Used to better identify Cluster Connection Locators on logs.setIncomingInterceptorList(String interceptorList) Set the list ofInterceptors to use for incoming packets.setInitialConnectAttempts(int initialConnectAttempts) Sets the maximum number of attempts to establish an initial connection.setInitialMessagePacketSize(int size) Sets the initial size of messages created through this factory.voidsetLocatorConfig(ServerLocatorConfig config) setMaxRetryInterval(long retryInterval) Sets the maximum retry interval.setMinLargeMessageSize(int minLargeMessageSize) Sets the large message size threshold.setOnMessageCloseTimeout(int onMessageCloseTimeout) Sets the timeout in milliseconds for onMessage completion when closing ClientConsumers created through this factory.setOutgoingInterceptorList(String interceptorList) Set the list ofInterceptors to use for outgoing packets.setPasswordCodec(String passwordCodec) 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.setProducerMaxRate(int producerMaxRate) Sets the maximum rate of message production for producers created through this factory.setProducerWindowSize(int producerWindowSize) Returns the window size for flow control of the producers created through this factory.setProtocolManagerFactory(ClientProtocolManagerFactory protocolManagerFactory) setReconnectAttempts(int reconnectAttempts) Sets the maximum number of attempts to retry connection in case of failure.setRetryInterval(long retryInterval) Sets the time to retry connections created by this factory after failure.setRetryIntervalMultiplier(double retryIntervalMultiplier) Sets the multiplier to apply to successive retry intervals.setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize) Sets the maximum size of the scheduled thread pool.setThreadPoolMaxSize(int threadPoolMaxSize) Sets the maximum size of the thread pool.booleansetThreadPools(Executor threadPool, ScheduledExecutorService scheduledThreadPool, Executor flowControlThreadPool) 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.setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) voidtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.api.core.client.ServerLocator
disableFinalizeCheckMethods inherited from interface org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal
notifyNodeDown
-
Constructor Details
-
ServerLocatorImpl
Create a ServerLocatorImpl using UDP discovery to lookup cluster -
ServerLocatorImpl
Create a ServerLocatorImpl using a static list of servers -
ServerLocatorImpl
public ServerLocatorImpl(Topology topology, boolean useHA, DiscoveryGroupConfiguration groupConfiguration) Create a ServerLocatorImpl using UDP discovery to lookup cluster -
ServerLocatorImpl
public ServerLocatorImpl(Topology topology, boolean useHA, TransportConfiguration... transportConfigs) Create a ServerLocatorImpl using a static list of servers
-
-
Method Details
-
getDiscoveryGroup
For tests only -
getFactories
For tests only -
clearThreadPools
public static void clearThreadPools() -
setThreadPools
public boolean setThreadPools(Executor threadPool, ScheduledExecutorService scheduledThreadPool, Executor flowControlThreadPool) - Specified by:
setThreadPoolsin interfaceServerLocator
-
initialize
Description copied from interface:ServerLocatorThis will only instantiate internal objects such as the topology- Specified by:
initializein interfaceServerLocator- Throws:
ActiveMQException
-
getLocatorConfig
- Specified by:
getLocatorConfigin interfaceServerLocator
-
setLocatorConfig
- Specified by:
setLocatorConfigin interfaceServerLocator
-
setPasswordCodec
- Specified by:
setPasswordCodecin interfaceServerLocator
-
getPasswordCodec
- Specified by:
getPasswordCodecin interfaceServerLocator
-
newLocator
-
newLocator
-
resetToInitialConnectors
public void resetToInitialConnectors()- Specified by:
resetToInitialConnectorsin interfaceServerLocatorInternal
-
allInVM
public boolean allInVM()Description copied from interface:ServerLocatorVerify if all of the transports are using inVM.- Specified by:
allInVMin interfaceServerLocator- Returns:
trueif the locator has all inVM transports
-
selectNextConnectorPair
- Specified by:
selectNextConnectorPairin interfaceServerLocatorInternal
-
getConnectorsSize
public int getConnectorsSize()- Specified by:
getConnectorsSizein interfaceServerLocatorInternal
-
start
- Specified by:
startin interfaceServerLocatorInternal- Throws:
Exception
-
newProtocolManager
- Specified by:
newProtocolManagerin interfaceServerLocatorInternal
-
getProtocolManagerFactory
- Specified by:
getProtocolManagerFactoryin interfaceServerLocator
-
setProtocolManagerFactory
- Specified by:
setProtocolManagerFactoryin interfaceServerLocator
-
connect
- Specified by:
connectin interfaceServerLocatorInternal- Throws:
ActiveMQException
-
connectNoWarnings
Description copied from interface:ServerLocatorInternalLikeServerLocatorInternal.connect()but it does not log warnings if it fails to connect.- Specified by:
connectNoWarningsin interfaceServerLocatorInternal- Throws:
ActiveMQException
-
setAfterConnectionInternalListener
- Specified by:
setAfterConnectionInternalListenerin interfaceServerLocatorInternal
-
getAfterConnectInternalListener
- Specified by:
getAfterConnectInternalListenerin interfaceServerLocatorInternal
-
setDiscoveryListener
- Specified by:
setDiscoveryListenerin interfaceServerLocatorInternal
-
createSessionFactory
Description copied from interface:ServerLocatorCreates 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- Specified by:
createSessionFactoryin interfaceServerLocator- Returns:
- a ClientSessionFactory instance or
nullif the node is not present on the topology - Throws:
Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
public ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration) throws Exception Description copied from interface:ServerLocatorCreates 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- Specified by:
createSessionFactoryin interfaceServerLocator- Returns:
- a
ClientSessionFactoryinstance - Throws:
Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
public ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts) throws Exception Description copied from interface:ServerLocatorCreates 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- Specified by:
createSessionFactoryin interfaceServerLocatorreconnectAttempts- number of attempts of reconnection to perform- Returns:
- a
ClientSessionFactoryinstance - Throws:
Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
@Deprecated public ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration, int reconnectAttempts, boolean failoverOnInitialConnection) throws Exception Deprecated.Description copied from interface:ServerLocatorCreates 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- Specified by:
createSessionFactoryin interfaceServerLocatorreconnectAttempts- number of attempts of reconnection to perform- Returns:
- a
ClientSessionFactoryinstance - Throws:
Exception- if a failure happened in creating the ClientSessionFactory or the ServerLocator does not know about the passed in transportConfiguration
-
createSessionFactory
Description copied from interface:ServerLocatorCreates a ClientSessionFactory using whatever load balancing policy is in force- Specified by:
createSessionFactoryin interfaceServerLocator- Returns:
- The ClientSessionFactory
- Throws:
ActiveMQException
-
getNextRetryInterval
public long getNextRetryInterval(long retryInterval, double retryIntervalMultiplier, long maxRetryInterval) - Specified by:
getNextRetryIntervalin interfaceServerLocatorInternal
-
flushTopology
public void flushTopology() -
isHA
public boolean isHA()Description copied from interface:ServerLocatorWhether this server receives topology notifications from the cluster as servers join or leave the cluster.- Specified by:
isHAin interfaceServerLocator- Returns:
trueif the locator receives topology updates from the cluster
-
setIncomingInterceptorList
Description copied from interface:ServerLocatorSet the list ofInterceptors to use for incoming packets.- Specified by:
setIncomingInterceptorListin interfaceServerLocator- 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
- Specified by:
getIncomingInterceptorListin interfaceServerLocator
-
setOutgoingInterceptorList
Description copied from interface:ServerLocatorSet the list ofInterceptors to use for outgoing packets.- Specified by:
setOutgoingInterceptorListin interfaceServerLocator- 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
-
getOutgoingInterceptorList
- Specified by:
getOutgoingInterceptorListin interfaceServerLocator
-
isCacheLargeMessagesClient
public boolean isCacheLargeMessagesClient()Description copied from interface:ServerLocatorWhentrue, 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.- Specified by:
isCacheLargeMessagesClientin interfaceServerLocator- Returns:
trueif consumers created through this factory will cache large messages in temporary files,falseelse
-
setCacheLargeMessagesClient
Description copied from interface:ServerLocatorSets whether large messages received by consumers created through this factory will be cached in temporary files or not.- Specified by:
setCacheLargeMessagesClientin interfaceServerLocator- Parameters:
cached-trueto cache large messages in temporary files,falseelse- Returns:
- this ServerLocator
-
getClientFailureCheckPeriod
public long getClientFailureCheckPeriod()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getClientFailureCheckPeriodin interfaceServerLocator- Returns:
- the period used to check if a client has failed to receive pings from the server
-
setClientFailureCheckPeriod
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setClientFailureCheckPeriodin interfaceServerLocator- Parameters:
clientFailureCheckPeriod- the period to check failure- Returns:
- this ServerLocator
-
getConnectionTTL
public long getConnectionTTL()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getConnectionTTLin interfaceServerLocator- Returns:
- the connection time-to-live in milliseconds
-
setConnectionTTL
Description copied from interface:ServerLocatorSets this factory's connections time-to-live.Value must be -1 (to disable) or greater or equals to 0.
- Specified by:
setConnectionTTLin interfaceServerLocator- Parameters:
connectionTTL- period in milliseconds- Returns:
- this ServerLocator
-
getCallTimeout
public long getCallTimeout()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getCallTimeoutin interfaceServerLocator- Returns:
- the blocking calls timeout
-
setCallTimeout
Description copied from interface:ServerLocatorSets the blocking call timeout.Value must be greater or equals to 0
- Specified by:
setCallTimeoutin interfaceServerLocator- Parameters:
callTimeout- blocking call timeout in milliseconds- Returns:
- this ServerLocator
-
getCallFailoverTimeout
public long getCallFailoverTimeout()Description copied from interface:ServerLocatorReturns 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.
- Specified by:
getCallFailoverTimeoutin interfaceServerLocator- Returns:
- the blocking calls failover timeout
-
setCallFailoverTimeout
Description copied from interface:ServerLocatorSets 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
- Specified by:
setCallFailoverTimeoutin interfaceServerLocator- Parameters:
callFailoverTimeout- blocking call timeout in milliseconds- Returns:
- this ServerLocator
-
getMinLargeMessageSize
public int getMinLargeMessageSize()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getMinLargeMessageSizein interfaceServerLocator- Returns:
- the message size threshold to treat messages as large messages
-
setMinLargeMessageSize
Description copied from interface:ServerLocatorSets the large message size threshold.Value must be greater than 0.
- Specified by:
setMinLargeMessageSizein interfaceServerLocator- Parameters:
minLargeMessageSize- large message size threshold in bytes- Returns:
- this ServerLocator
-
getConsumerWindowSize
public int getConsumerWindowSize()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getConsumerWindowSizein interfaceServerLocator- Returns:
- the window size used for consumer flow control
-
setConsumerWindowSize
Description copied from interface:ServerLocatorSets 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)
- Specified by:
setConsumerWindowSizein interfaceServerLocator- Parameters:
consumerWindowSize- window size (in bytes) used for consumer flow control- Returns:
- this ServerLocator
-
getConsumerMaxRate
public int getConsumerMaxRate()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getConsumerMaxRatein interfaceServerLocator- Returns:
- the consumer max rate
-
setConsumerMaxRate
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setConsumerMaxRatein interfaceServerLocator- Parameters:
consumerMaxRate- maximum rate of message consumption (in messages per seconds)- Returns:
- this ServerLocator
-
getConfirmationWindowSize
public int getConfirmationWindowSize()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getConfirmationWindowSizein interfaceServerLocator- Returns:
- the size for the confirmation window of clients using this factory
-
setConfirmationWindowSize
Description copied from interface:ServerLocatorSets the size for the confirmation window buffer of clients using this factory.Value must be -1 (to disable the window) or greater than 0.
- Specified by:
setConfirmationWindowSizein interfaceServerLocator- Parameters:
confirmationWindowSize- size of the confirmation window (in bytes)- Returns:
- this ServerLocator
-
getProducerWindowSize
public int getProducerWindowSize()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getProducerWindowSizein interfaceServerLocator- Returns:
- the window size for flow control of the producers created through this factory
-
setProducerWindowSize
Description copied from interface:ServerLocatorReturns 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.
- Specified by:
setProducerWindowSizein interfaceServerLocator- Parameters:
producerWindowSize- window size (in bytest) for flow control of the producers created through this factory.- Returns:
- this ServerLocator
-
getProducerMaxRate
public int getProducerMaxRate()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getProducerMaxRatein interfaceServerLocator- Returns:
- maximum rate of message production (in messages per seconds)
-
setProducerMaxRate
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setProducerMaxRatein interfaceServerLocator- Parameters:
producerMaxRate- maximum rate of message production (in messages per seconds)- Returns:
- this ServerLocator
-
isBlockOnAcknowledge
public boolean isBlockOnAcknowledge()Description copied from interface:ServerLocatorReturns whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.Default value is
ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE.- Specified by:
isBlockOnAcknowledgein interfaceServerLocator- Returns:
- whether consumers will block while sending message acknowledgments or do it asynchronously
-
setBlockOnAcknowledge
Description copied from interface:ServerLocatorSets whether consumers created through this factory will block while sending message acknowledgments or do it asynchronously.- Specified by:
setBlockOnAcknowledgein interfaceServerLocator- Parameters:
blockOnAcknowledge-trueto block when sending message acknowledgments orfalseto send them asynchronously- Returns:
- this ServerLocator
-
isBlockOnDurableSend
public boolean isBlockOnDurableSend()Description copied from interface:ServerLocatorReturns 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.- Specified by:
isBlockOnDurableSendin interfaceServerLocator- Returns:
- whether producers will block while sending persistent messages or do it asynchronously
-
setBlockOnDurableSend
Description copied from interface:ServerLocatorSets whether producers created through this factory will block while sending durable messages or do it asynchronously.- Specified by:
setBlockOnDurableSendin interfaceServerLocator- Parameters:
blockOnDurableSend-trueto block when sending durable messages orfalseto send them asynchronously- Returns:
- this ServerLocator
-
isBlockOnNonDurableSend
public boolean isBlockOnNonDurableSend()Description copied from interface:ServerLocatorReturns 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.- Specified by:
isBlockOnNonDurableSendin interfaceServerLocator- Returns:
- whether producers will block while sending non-durable messages or do it asynchronously
-
setBlockOnNonDurableSend
Description copied from interface:ServerLocatorSets whether producers created through this factory will block while sending non-durable messages or do it asynchronously.- Specified by:
setBlockOnNonDurableSendin interfaceServerLocator- Parameters:
blockOnNonDurableSend-trueto block when sending non-durable messages orfalseto send them asynchronously- Returns:
- this ServerLocator
-
isAutoGroup
public boolean isAutoGroup()Description copied from interface:ServerLocatorReturns 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.- Specified by:
isAutoGroupin interfaceServerLocator- Returns:
- whether producers will automatically assign a group ID to their messages
-
setAutoGroup
Description copied from interface:ServerLocatorSets whether producers created through this factory will automatically assign a group ID to the messages they sent.- Specified by:
setAutoGroupin interfaceServerLocator- Parameters:
autoGroup-trueto automatically assign a group ID to each messages sent through this factory,falseelse- Returns:
- this ServerLocator
-
isPreAcknowledge
public boolean isPreAcknowledge()Description copied from interface:ServerLocatorReturns whether messages will pre-acknowledged on the server before they are sent to the consumers or not.Default value is
ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE- Specified by:
isPreAcknowledgein interfaceServerLocator
-
setPreAcknowledge
Description copied from interface:ServerLocatorSets totrueto pre-acknowledge consumed messages on the server before they are sent to consumers, else set tofalseto let clients acknowledge the message they consume.- Specified by:
setPreAcknowledgein interfaceServerLocator- Parameters:
preAcknowledge-trueto enable pre-acknowledgment,falseelse- Returns:
- this ServerLocator
-
getAckBatchSize
public int getAckBatchSize()Description copied from interface:ServerLocatorReturns the acknowledgments batch size.Default value is
ActiveMQClient.DEFAULT_ACK_BATCH_SIZE.- Specified by:
getAckBatchSizein interfaceServerLocator- Returns:
- the acknowledgments batch size
-
setAckBatchSize
Description copied from interface:ServerLocatorSets the acknowledgments batch size.Value must be equal or greater than 0.
- Specified by:
setAckBatchSizein interfaceServerLocator- Parameters:
ackBatchSize- acknowledgments batch size- Returns:
- this ServerLocator
-
isUseGlobalPools
public boolean isUseGlobalPools()Description copied from interface:ServerLocatorReturns 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.- Specified by:
isUseGlobalPoolsin interfaceServerLocator- Returns:
trueif this factory uses global thread pools,falseelse
-
setUseGlobalPools
Description copied from interface:ServerLocatorSets whether this factory will use global thread pools (shared among all the factories in the same JVM) or its own pools.- Specified by:
setUseGlobalPoolsin interfaceServerLocator- Parameters:
useGlobalPools-trueto let this factory uses global thread pools,falseelse- Returns:
- this ServerLocator
-
getScheduledThreadPoolMaxSize
public int getScheduledThreadPoolMaxSize()Description copied from interface:ServerLocatorReturns the maximum size of the scheduled thread pool.Default value is
ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE.- Specified by:
getScheduledThreadPoolMaxSizein interfaceServerLocator- Returns:
- the maximum size of the scheduled thread pool
-
setScheduledThreadPoolMaxSize
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setScheduledThreadPoolMaxSizein interfaceServerLocator- Parameters:
scheduledThreadPoolMaxSize- maximum size of the scheduled thread pool.- Returns:
- this ServerLocator
-
getThreadPoolMaxSize
public int getThreadPoolMaxSize()Description copied from interface:ServerLocatorReturns the maximum size of the thread pool.Default value is
ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE.- Specified by:
getThreadPoolMaxSizein interfaceServerLocator- Returns:
- the maximum size of the thread pool
-
setThreadPoolMaxSize
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setThreadPoolMaxSizein interfaceServerLocator- Parameters:
threadPoolMaxSize- maximum size of the thread pool.- Returns:
- this ServerLocator
-
getFlowControlThreadPoolMaxSize
public int getFlowControlThreadPoolMaxSize()Description copied from interface:ServerLocatorReturns the maximum size of the flow-control thread pool.Default value is
ActiveMQClient.DEFAULT_FLOW_CONTROL_THREAD_POOL_MAX_SIZE.- Specified by:
getFlowControlThreadPoolMaxSizein interfaceServerLocator- Returns:
- the maximum size of the flow-control thread pool
-
setFlowControlThreadPoolMaxSize
Description copied from interface:ServerLocatorSets the maximum size of the flow-control 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.
- Specified by:
setFlowControlThreadPoolMaxSizein interfaceServerLocator- Parameters:
flowControlThreadPoolMaxSize- maximum size of the flow-control thread pool.- Returns:
- this ServerLocator
-
getRetryInterval
public long getRetryInterval()Description copied from interface:ServerLocatorReturns the time to retry connections created by this factory after failure.Value is in milliseconds, default is
ActiveMQClient.DEFAULT_RETRY_INTERVAL.- Specified by:
getRetryIntervalin interfaceServerLocator- Returns:
- the time to retry connections created by this factory after failure
-
setRetryInterval
Description copied from interface:ServerLocatorSets the time to retry connections created by this factory after failure.Value must be greater than 0.
- Specified by:
setRetryIntervalin interfaceServerLocator- Parameters:
retryInterval- time (in milliseconds) to retry connections created by this factory after failure- Returns:
- this ServerLocator
-
getMaxRetryInterval
public long getMaxRetryInterval()Description copied from interface:ServerLocatorReturns 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.- Specified by:
getMaxRetryIntervalin interfaceServerLocator- Returns:
- the maximum retry interval
-
setMaxRetryInterval
Description copied from interface:ServerLocatorSets the maximum retry interval.Value must be greater than 0.
- Specified by:
setMaxRetryIntervalin interfaceServerLocator- Parameters:
retryInterval- maximum retry interval to apply in the case a retry interval multiplier has been specified- Returns:
- this ServerLocator
-
getRetryIntervalMultiplier
public double getRetryIntervalMultiplier()Description copied from interface:ServerLocatorReturns the multiplier to apply to successive retry intervals.Default value is
ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER.- Specified by:
getRetryIntervalMultiplierin interfaceServerLocator- Returns:
- the multiplier to apply to successive retry intervals
-
setRetryIntervalMultiplier
Description copied from interface:ServerLocatorSets the multiplier to apply to successive retry intervals.Value must be positive.
- Specified by:
setRetryIntervalMultiplierin interfaceServerLocator- Parameters:
retryIntervalMultiplier- multiplier to apply to successive retry intervals- Returns:
- this ServerLocator
-
getReconnectAttempts
public int getReconnectAttempts()Description copied from interface:ServerLocatorReturns the maximum number of attempts to retry connection in case of failure.Default value is
ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS.- Specified by:
getReconnectAttemptsin interfaceServerLocator- Returns:
- the maximum number of attempts to retry connection in case of failure
-
setReconnectAttempts
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setReconnectAttemptsin interfaceServerLocator- Parameters:
reconnectAttempts- maximum number of attempts to retry connection in case of failure- Returns:
- this ServerLocator
-
setInitialConnectAttempts
Description copied from interface:ServerLocatorSets 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.
- Specified by:
setInitialConnectAttemptsin interfaceServerLocator- Parameters:
initialConnectAttempts- maximum number of attempts for the initial connection- Returns:
- this ServerLocator
-
getInitialConnectAttempts
public int getInitialConnectAttempts()Description copied from interface:ServerLocatorReturns the number of attempts to be made for first initial connection.- Specified by:
getInitialConnectAttemptsin interfaceServerLocator- Returns:
- the number of attempts to be made for first initial connection
-
setFailoverAttempts
Description copied from interface:ServerLocatorSets the maximum number of failover attempts to establish a connection to other primary servers after a connection failure.Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0.
- Specified by:
setFailoverAttemptsin interfaceServerLocator- Parameters:
attempts- maximum number of failover attempts after a connection failure- Returns:
- this ServerLocator
-
getFailoverAttempts
public int getFailoverAttempts()Description copied from interface:ServerLocatorReturns the number of failover attempts after a connection failure.- Specified by:
getFailoverAttemptsin interfaceServerLocator- Returns:
- the number of failover attempts after a connection failure
-
isFailoverOnInitialConnection
Deprecated.Description copied from interface:ServerLocatorReturns true if the client will automatically attempt to connect to the backup server if the initial connection to the primary server failsDefault value is
ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION.- Specified by:
isFailoverOnInitialConnectionin interfaceServerLocator
-
setFailoverOnInitialConnection
Deprecated.Description copied from interface:ServerLocatorSets the value for FailoverOnInitialReconnection- Specified by:
setFailoverOnInitialConnectionin interfaceServerLocator- Returns:
- this ServerLocator
-
getConnectionLoadBalancingPolicyClassName
Description copied from interface:ServerLocatorReturns the class name of the connection load balancing policy.Default value is "org.apache.activemq.artemis.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy".
- Specified by:
getConnectionLoadBalancingPolicyClassNamein interfaceServerLocator- Returns:
- the class name of the connection load balancing policy
-
setConnectionLoadBalancingPolicyClassName
public ServerLocatorImpl setConnectionLoadBalancingPolicyClassName(String loadBalancingPolicyClassName) Description copied from interface:ServerLocatorSets the class name of the connection load balancing policy.Value must be the name of a class implementing
ConnectionLoadBalancingPolicy.- Specified by:
setConnectionLoadBalancingPolicyClassNamein interfaceServerLocator- Parameters:
loadBalancingPolicyClassName- class name of the connection load balancing policy- Returns:
- this ServerLocator
-
getStaticTransportConfigurations
Description copied from interface:ServerLocatorReturns an array of TransportConfigurations representing the static list of servers used when creating this object- Specified by:
getStaticTransportConfigurationsin interfaceServerLocator- Returns:
- array with all static
TransportConfigurations
-
getDiscoveryGroupConfiguration
Description copied from interface:ServerLocatorThe discovery group configuration- Specified by:
getDiscoveryGroupConfigurationin interfaceServerLocator
-
addIncomingInterceptor
Description copied from interface:ServerLocatorAdds an interceptor which will be executed after packets are received from the server.- Specified by:
addIncomingInterceptorin interfaceServerLocator- Parameters:
interceptor- an Interceptor- Returns:
- this ServerLocator
-
addOutgoingInterceptor
Description copied from interface:ServerLocatorAdds an interceptor which will be executed before packets are sent to the server.- Specified by:
addOutgoingInterceptorin interfaceServerLocator- Parameters:
interceptor- an Interceptor- Returns:
- this ServerLocator
-
removeIncomingInterceptor
Description copied from interface:ServerLocatorRemoves an incoming interceptor.- Specified by:
removeIncomingInterceptorin interfaceServerLocator- Parameters:
interceptor- interceptor to remove- Returns:
trueif the incoming interceptor is removed from this factory,falseelse
-
removeOutgoingInterceptor
Description copied from interface:ServerLocatorRemoves an outgoing interceptor.- Specified by:
removeOutgoingInterceptorin interfaceServerLocator- Parameters:
interceptor- interceptor to remove- Returns:
trueif the outgoing interceptor is removed from this factory,falseelse
-
getInitialMessagePacketSize
public int getInitialMessagePacketSize()Description copied from interface:ServerLocatorReturns the initial size of messages created through this factory.Value is in bytes, default value is
ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE.- Specified by:
getInitialMessagePacketSizein interfaceServerLocator- Returns:
- the initial size of messages created through this factory
-
setInitialMessagePacketSize
Description copied from interface:ServerLocatorSets the initial size of messages created through this factory.Value must be greater than 0.
- Specified by:
setInitialMessagePacketSizein interfaceServerLocator- Parameters:
size- initial size of messages created through this factory.- Returns:
- this ServerLocator
-
getOnMessageCloseTimeout
public int getOnMessageCloseTimeout()Description copied from interface:ServerLocatorReturns the timeout for onMessage completion when closing ClientConsumers created through this factory.Value is in milliseconds, default value is
ActiveMQClient.DEFAULT_ONMESSAGE_CLOSE_TIMEOUT.- Specified by:
getOnMessageCloseTimeoutin interfaceServerLocator- Returns:
- the timeout for onMessage completion when closing ClientConsumers created through this factory
-
setOnMessageCloseTimeout
Description copied from interface:ServerLocatorSets the timeout in milliseconds for onMessage completion when closing ClientConsumers created through this factory.A value of -1 means wait until the onMessage completes no matter how long it takes.
- Specified by:
setOnMessageCloseTimeoutin interfaceServerLocator- Parameters:
onMessageCloseTimeout- how long to wait in milliseconds for the ClientConsumer's MessageHandler's onMessage method to finish before closing or stopping the ClientConsumer.- Returns:
- this ServerLocator
-
setGroupID
Description copied from interface:ServerLocatorSets the group ID that will be set on each message sent through this factory.- Specified by:
setGroupIDin interfaceServerLocator- Parameters:
groupID- the group ID to use- Returns:
- this ServerLocator
-
getGroupID
Description copied from interface:ServerLocatorReturns 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.- Specified by:
getGroupIDin interfaceServerLocator- Returns:
- the group ID that will be eventually set on each message
-
isCompressLargeMessage
public boolean isCompressLargeMessage()Description copied from interface:ServerLocatorWhether to compress large messages.- Specified by:
isCompressLargeMessagein interfaceServerLocator
-
setCompressLargeMessage
Description copied from interface:ServerLocatorSets whether to compress or not large messages.- Specified by:
setCompressLargeMessagein interfaceServerLocator- Returns:
- this ServerLocator
-
getCompressionLevel
public int getCompressionLevel()Description copied from interface:ServerLocatorWhat compression level is in use- Specified by:
getCompressionLevelin interfaceServerLocator
-
setCompressionLevel
Description copied from interface:ServerLocatorSets what compressionLevel to use when compressing messages Value must be -1 (default), or 0-9- Specified by:
setCompressionLevelin interfaceServerLocator- Returns:
- this ServerLocator
-
setIdentity
Description copied from interface:ServerLocatorInternalUsed to better identify Cluster Connection Locators on logs. To facilitate eventual debugging.This method used to be on tests interface, but I'm now making it part of the public interface since
- Specified by:
setIdentityin interfaceServerLocatorInternal
-
setNodeID
- Specified by:
setNodeIDin interfaceServerLocatorInternal
-
getNodeID
- Specified by:
getNodeIDin interfaceServerLocatorInternal
-
setClusterConnection
- Specified by:
setClusterConnectionin interfaceServerLocatorInternal
-
isClusterConnection
public boolean isClusterConnection()- Specified by:
isClusterConnectionin interfaceServerLocatorInternal
-
getClusterTransportConfiguration
- Specified by:
getClusterTransportConfigurationin interfaceServerLocatorInternal
-
setClusterTransportConfiguration
- Specified by:
setClusterTransportConfigurationin interfaceServerLocatorInternal
-
cleanup
public void cleanup()- Specified by:
cleanupin interfaceServerLocatorInternal
-
close
public void close()Description copied from interface:ServerLocatorCloses this factory and release all its resources- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceServerLocator
-
notifyNodeDown
This is directly called when the connection to the node is gone, or when the node sends a disconnection. Look for callers of this method!- Specified by:
notifyNodeDownin interfaceServerLocatorInternal
-
notifyNodeUp
public void notifyNodeUp(long uniqueEventID, String nodeID, String backupGroupName, String scaleDownGroupName, Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean last) - Specified by:
notifyNodeUpin interfaceServerLocatorInternal
-
toString
-
connectorsChanged
- Specified by:
connectorsChangedin interfaceDiscoveryListener
-
factoryClosed
- Specified by:
factoryClosedin interfaceServerLocatorInternal
-
setUseTopologyForLoadBalancing
- Specified by:
setUseTopologyForLoadBalancingin interfaceServerLocator
-
getUseTopologyForLoadBalancing
public boolean getUseTopologyForLoadBalancing()- Specified by:
getUseTopologyForLoadBalancingin interfaceServerLocator
-
getTopology
Description copied from interface:ServerLocatorExposes the Topology used by this ServerLocator.- Specified by:
getTopologyin interfaceServerLocator- Specified by:
getTopologyin interfaceServerLocatorInternal- Returns:
- topology
-
isConnectable
public boolean isConnectable()- Specified by:
isConnectablein interfaceServerLocatorInternal
-
addClusterTopologyListener
- Specified by:
addClusterTopologyListenerin interfaceServerLocator
-
removeClusterTopologyListener
- Specified by:
removeClusterTopologyListenerin interfaceServerLocator
-
getInitialConnectors
for tests only and not part of the public interface. Do not use it. -
isClosed
public boolean isClosed()Description copied from interface:ServerLocatorReturnstrueif closed,falseotherwise.- Specified by:
isClosedin interfaceServerLocator- Returns:
trueif closed,falseotherwise
-
isReceivedTopology
public boolean isReceivedTopology() -
getClientSessionFactoryCount
public int getClientSessionFactoryCount()
-