Class ActiveMQConnectionFactory
- java.lang.Object
-
- org.apache.activemq.artemis.jndi.JNDIStorable
-
- org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.AutoCloseable
,javax.jms.ConnectionFactory
,javax.jms.XAConnectionFactory
,javax.naming.Referenceable
,ConnectionFactoryOptions
- Direct Known Subclasses:
ActiveMQJMSConnectionFactory
,ActiveMQQueueConnectionFactory
,ActiveMQTopicConnectionFactory
,ActiveMQXAConnectionFactory
,ActiveMQXAQueueConnectionFactory
,ActiveMQXATopicConnectionFactory
public class ActiveMQConnectionFactory extends JNDIStorable implements ConnectionFactoryOptions, java.io.Externalizable, javax.jms.ConnectionFactory, javax.jms.XAConnectionFactory, java.lang.AutoCloseable
ActiveMQ Artemis implementation of a JMS ConnectionFactory.
This connection factory will use defaults defined by
DefaultConnectionProperties
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ActiveMQConnectionFactory()
This will use a default URI fromDefaultConnectionProperties
ActiveMQConnectionFactory(boolean ha, DiscoveryGroupConfiguration groupConfiguration)
ActiveMQConnectionFactory(boolean ha, TransportConfiguration... initialConnectors)
ActiveMQConnectionFactory(java.lang.String brokerURL)
ActiveMQConnectionFactory(java.lang.String url, java.lang.String user, java.lang.String password)
For compatibility and users used to this kind of constructorActiveMQConnectionFactory(ServerLocator serverLocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
buildFromProperties(java.util.Properties props)
Set the properties that will represent the instance in JNDIvoid
close()
javax.jms.Connection
createConnection()
javax.jms.Connection
createConnection(java.lang.String username, java.lang.String password)
protected ActiveMQConnection
createConnectionInternal(java.lang.String username, java.lang.String password, boolean isXA, int type)
javax.jms.JMSContext
createContext()
javax.jms.JMSContext
createContext(int sessionMode)
javax.jms.JMSContext
createContext(java.lang.String userName, java.lang.String password)
javax.jms.JMSContext
createContext(java.lang.String userName, java.lang.String password, int sessionMode)
javax.jms.QueueConnection
createQueueConnection()
javax.jms.QueueConnection
createQueueConnection(java.lang.String username, java.lang.String password)
javax.jms.TopicConnection
createTopicConnection()
javax.jms.TopicConnection
createTopicConnection(java.lang.String username, java.lang.String password)
javax.jms.XAConnection
createXAConnection()
javax.jms.XAConnection
createXAConnection(java.lang.String username, java.lang.String password)
javax.jms.XAJMSContext
createXAContext()
javax.jms.XAJMSContext
createXAContext(java.lang.String userName, java.lang.String password)
javax.jms.XAQueueConnection
createXAQueueConnection()
javax.jms.XAQueueConnection
createXAQueueConnection(java.lang.String username, java.lang.String password)
javax.jms.XATopicConnection
createXATopicConnection()
javax.jms.XATopicConnection
createXATopicConnection(java.lang.String username, java.lang.String password)
long
getCallFailoverTimeout()
long
getCallTimeout()
long
getClientFailureCheckPeriod()
java.lang.String
getClientID()
int
getConfirmationWindowSize()
java.lang.String
getConnectionLoadBalancingPolicyClassName()
long
getConnectionTTL()
int
getConsumerMaxRate()
int
getConsumerWindowSize()
java.lang.String
getDeserializationBlackList()
java.lang.String
getDeserializationWhiteList()
DiscoveryGroupConfiguration
getDiscoveryGroupConfiguration()
int
getDupsOKBatchSize()
int
getFactoryType()
java.lang.String
getGroupID()
java.lang.String
getIncomingInterceptorList()
int
getInitialConnectAttempts()
int
getInitialMessagePacketSize()
long
getMaxRetryInterval()
int
getMinLargeMessageSize()
java.lang.String
getOutgoingInterceptorList()
java.lang.String
getPassword()
int
getProducerMaxRate()
int
getProducerWindowSize()
java.lang.String
getProtocolManagerFactoryStr()
int
getReconnectAttempts()
long
getRetryInterval()
double
getRetryIntervalMultiplier()
int
getScheduledThreadPoolMaxSize()
ServerLocator
getServerLocator()
TransportConfiguration[]
getStaticConnectors()
int
getThreadPoolMaxSize()
int
getTransactionBatchSize()
java.lang.String
getUser()
boolean
isAutoGroup()
boolean
isBlockOnAcknowledge()
boolean
isBlockOnDurableSend()
boolean
isBlockOnNonDurableSend()
boolean
isCacheDestinations()
boolean
isCacheLargeMessagesClient()
boolean
isCompressLargeMessage()
boolean
isEnable1xPrefixes()
boolean
isEnableSharedClientID()
boolean
isFailoverOnInitialConnection()
Deprecated.boolean
isHA()
boolean
isIgnoreJTA()
boolean
isPreAcknowledge()
boolean
isUseGlobalPools()
boolean
isUseTopologyForLoadBalancing()
protected void
makeReadOnly()
protected void
populateProperties(java.util.Properties props)
Initialize the instance from properties stored in JNDIvoid
readExternal(java.io.ObjectInput in)
void
setAutoGroup(boolean autoGroup)
void
setBlockOnAcknowledge(boolean blockOnAcknowledge)
void
setBlockOnDurableSend(boolean blockOnDurableSend)
void
setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
void
setBrokerURL(java.lang.String brokerURL)
Warning: This method will not clear any previous properties.void
setCacheDestinations(boolean cacheDestinations)
void
setCacheLargeMessagesClient(boolean cacheLargeMessagesClient)
void
setCallFailoverTimeout(long callTimeout)
void
setCallTimeout(long callTimeout)
void
setClientFailureCheckPeriod(long clientFailureCheckPeriod)
void
setClientID(java.lang.String clientID)
void
setCompressLargeMessage(boolean avoidLargeMessages)
void
setConfirmationWindowSize(int confirmationWindowSize)
void
setConnectionLoadBalancingPolicyClassName(java.lang.String connectionLoadBalancingPolicyClassName)
void
setConnectionTTL(long connectionTTL)
void
setConsumerMaxRate(int consumerMaxRate)
void
setConsumerWindowSize(int consumerWindowSize)
void
setDeserializationBlackList(java.lang.String blackList)
void
setDeserializationWhiteList(java.lang.String whiteList)
void
setDupsOKBatchSize(int dupsOKBatchSize)
void
setEnable1xPrefixes(boolean enable1xPrefixes)
void
setEnableSharedClientID(boolean enableSharedClientID)
void
setFailoverOnInitialConnection(boolean failover)
Deprecated.void
setGroupID(java.lang.String groupID)
void
setIgnoreJTA(boolean ignoreJTA)
void
setIncomingInterceptorList(java.lang.String interceptorList)
void
setInitialConnectAttempts(int reconnectAttempts)
void
setInitialMessagePacketSize(int size)
void
setMaxRetryInterval(long retryInterval)
void
setMinLargeMessageSize(int minLargeMessageSize)
void
setOutgoingInterceptorList(java.lang.String interceptorList)
ActiveMQConnectionFactory
setPassword(java.lang.String password)
void
setPreAcknowledge(boolean preAcknowledge)
void
setProducerMaxRate(int producerMaxRate)
void
setProducerWindowSize(int producerWindowSize)
void
setProtocolManagerFactoryStr(java.lang.String protocolManagerFactoryStr)
void
setReconnectAttempts(int reconnectAttempts)
void
setRetryInterval(long retryInterval)
void
setRetryIntervalMultiplier(double retryIntervalMultiplier)
void
setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
void
setThreadPoolMaxSize(int threadPoolMaxSize)
void
setTransactionBatchSize(int transactionBatchSize)
void
setUseGlobalPools(boolean useGlobalPools)
ActiveMQConnectionFactory
setUser(java.lang.String user)
void
setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing)
java.lang.String
toString()
java.net.URI
toURI()
void
writeExternal(java.io.ObjectOutput out)
-
Methods inherited from class org.apache.activemq.artemis.jndi.JNDIStorable
getReference, readObject, writeObject
-
-
-
-
Constructor Detail
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory()
This will use a default URI fromDefaultConnectionProperties
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(java.lang.String brokerURL)
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(java.lang.String url, java.lang.String user, java.lang.String password)
For compatibility and users used to this kind of constructor
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(ServerLocator serverLocator)
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(boolean ha, DiscoveryGroupConfiguration groupConfiguration)
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(boolean ha, TransportConfiguration... initialConnectors)
-
-
Method Detail
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
toURI
public java.net.URI toURI() throws java.io.IOException
- Throws:
java.io.IOException
-
getProtocolManagerFactoryStr
public java.lang.String getProtocolManagerFactoryStr()
-
setProtocolManagerFactoryStr
public void setProtocolManagerFactoryStr(java.lang.String protocolManagerFactoryStr)
-
getDeserializationBlackList
public java.lang.String getDeserializationBlackList()
- Specified by:
getDeserializationBlackList
in interfaceConnectionFactoryOptions
-
setDeserializationBlackList
public void setDeserializationBlackList(java.lang.String blackList)
- Specified by:
setDeserializationBlackList
in interfaceConnectionFactoryOptions
-
getDeserializationWhiteList
public java.lang.String getDeserializationWhiteList()
- Specified by:
getDeserializationWhiteList
in interfaceConnectionFactoryOptions
-
setDeserializationWhiteList
public void setDeserializationWhiteList(java.lang.String whiteList)
- Specified by:
setDeserializationWhiteList
in interfaceConnectionFactoryOptions
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
setBrokerURL
public void setBrokerURL(java.lang.String brokerURL) throws javax.jms.JMSException
Warning: This method will not clear any previous properties. Say, you set the user on a first call. Now you just change the brokerURI on a second call without passing the user. The previous filled user will be already set, and nothing will clear it out. Also: you cannot use this method after the connection factory is made readOnly. Which happens after you create a first connection.- Throws:
javax.jms.JMSException
-
createConnection
public javax.jms.Connection createConnection() throws javax.jms.JMSException
- Specified by:
createConnection
in interfacejavax.jms.ConnectionFactory
- Throws:
javax.jms.JMSException
-
createConnection
public javax.jms.Connection createConnection(java.lang.String username, java.lang.String password) throws javax.jms.JMSException
- Specified by:
createConnection
in interfacejavax.jms.ConnectionFactory
- Throws:
javax.jms.JMSException
-
createContext
public javax.jms.JMSContext createContext()
- Specified by:
createContext
in interfacejavax.jms.ConnectionFactory
-
createContext
public javax.jms.JMSContext createContext(int sessionMode)
- Specified by:
createContext
in interfacejavax.jms.ConnectionFactory
-
createContext
public javax.jms.JMSContext createContext(java.lang.String userName, java.lang.String password)
- Specified by:
createContext
in interfacejavax.jms.ConnectionFactory
-
createContext
public javax.jms.JMSContext createContext(java.lang.String userName, java.lang.String password, int sessionMode)
- Specified by:
createContext
in interfacejavax.jms.ConnectionFactory
-
createQueueConnection
public javax.jms.QueueConnection createQueueConnection() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createQueueConnection
public javax.jms.QueueConnection createQueueConnection(java.lang.String username, java.lang.String password) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createTopicConnection
public javax.jms.TopicConnection createTopicConnection() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createTopicConnection
public javax.jms.TopicConnection createTopicConnection(java.lang.String username, java.lang.String password) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createXAConnection
public javax.jms.XAConnection createXAConnection() throws javax.jms.JMSException
- Specified by:
createXAConnection
in interfacejavax.jms.XAConnectionFactory
- Throws:
javax.jms.JMSException
-
createXAConnection
public javax.jms.XAConnection createXAConnection(java.lang.String username, java.lang.String password) throws javax.jms.JMSException
- Specified by:
createXAConnection
in interfacejavax.jms.XAConnectionFactory
- Throws:
javax.jms.JMSException
-
createXAContext
public javax.jms.XAJMSContext createXAContext()
- Specified by:
createXAContext
in interfacejavax.jms.XAConnectionFactory
-
createXAContext
public javax.jms.XAJMSContext createXAContext(java.lang.String userName, java.lang.String password)
- Specified by:
createXAContext
in interfacejavax.jms.XAConnectionFactory
-
createXAQueueConnection
public javax.jms.XAQueueConnection createXAQueueConnection() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createXAQueueConnection
public javax.jms.XAQueueConnection createXAQueueConnection(java.lang.String username, java.lang.String password) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createXATopicConnection
public javax.jms.XATopicConnection createXATopicConnection() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createXATopicConnection
public javax.jms.XATopicConnection createXATopicConnection(java.lang.String username, java.lang.String password) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
buildFromProperties
protected void buildFromProperties(java.util.Properties props)
Description copied from class:JNDIStorable
Set the properties that will represent the instance in JNDI- Specified by:
buildFromProperties
in classJNDIStorable
- Parameters:
props
- The properties to use when building the new isntance.
-
populateProperties
protected void populateProperties(java.util.Properties props)
Description copied from class:JNDIStorable
Initialize the instance from properties stored in JNDI- Specified by:
populateProperties
in classJNDIStorable
- Parameters:
props
- The properties to use when initializing the new instance.
-
isHA
public boolean isHA()
-
getConnectionLoadBalancingPolicyClassName
public java.lang.String getConnectionLoadBalancingPolicyClassName()
-
setConnectionLoadBalancingPolicyClassName
public void setConnectionLoadBalancingPolicyClassName(java.lang.String connectionLoadBalancingPolicyClassName)
-
getStaticConnectors
public TransportConfiguration[] getStaticConnectors()
-
getDiscoveryGroupConfiguration
public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
-
getClientID
public java.lang.String getClientID()
-
setClientID
public void setClientID(java.lang.String clientID)
-
isEnableSharedClientID
public boolean isEnableSharedClientID()
-
setEnableSharedClientID
public void setEnableSharedClientID(boolean enableSharedClientID)
-
getDupsOKBatchSize
public int getDupsOKBatchSize()
-
setDupsOKBatchSize
public void setDupsOKBatchSize(int dupsOKBatchSize)
-
getTransactionBatchSize
public int getTransactionBatchSize()
-
setTransactionBatchSize
public void setTransactionBatchSize(int transactionBatchSize)
-
isCacheDestinations
public boolean isCacheDestinations()
-
setCacheDestinations
public void setCacheDestinations(boolean cacheDestinations)
-
isEnable1xPrefixes
public boolean isEnable1xPrefixes()
-
setEnable1xPrefixes
public void setEnable1xPrefixes(boolean enable1xPrefixes)
-
getClientFailureCheckPeriod
public long getClientFailureCheckPeriod()
-
setClientFailureCheckPeriod
public void setClientFailureCheckPeriod(long clientFailureCheckPeriod)
-
getConnectionTTL
public long getConnectionTTL()
-
setConnectionTTL
public void setConnectionTTL(long connectionTTL)
-
getCallTimeout
public long getCallTimeout()
-
setCallTimeout
public void setCallTimeout(long callTimeout)
-
getCallFailoverTimeout
public long getCallFailoverTimeout()
-
setCallFailoverTimeout
public void setCallFailoverTimeout(long callTimeout)
-
setUseTopologyForLoadBalancing
public void setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing)
-
isUseTopologyForLoadBalancing
public boolean isUseTopologyForLoadBalancing()
-
getConsumerWindowSize
public int getConsumerWindowSize()
-
setConsumerWindowSize
public void setConsumerWindowSize(int consumerWindowSize)
-
getConsumerMaxRate
public int getConsumerMaxRate()
-
setConsumerMaxRate
public void setConsumerMaxRate(int consumerMaxRate)
-
getConfirmationWindowSize
public int getConfirmationWindowSize()
-
setConfirmationWindowSize
public void setConfirmationWindowSize(int confirmationWindowSize)
-
getProducerMaxRate
public int getProducerMaxRate()
-
setProducerMaxRate
public void setProducerMaxRate(int producerMaxRate)
-
getProducerWindowSize
public int getProducerWindowSize()
-
setProducerWindowSize
public void setProducerWindowSize(int producerWindowSize)
-
setCacheLargeMessagesClient
public void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient)
- Parameters:
cacheLargeMessagesClient
-
-
isCacheLargeMessagesClient
public boolean isCacheLargeMessagesClient()
-
getMinLargeMessageSize
public int getMinLargeMessageSize()
-
setMinLargeMessageSize
public void setMinLargeMessageSize(int minLargeMessageSize)
-
isBlockOnAcknowledge
public boolean isBlockOnAcknowledge()
-
setBlockOnAcknowledge
public void setBlockOnAcknowledge(boolean blockOnAcknowledge)
-
isBlockOnNonDurableSend
public boolean isBlockOnNonDurableSend()
-
setBlockOnNonDurableSend
public void setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
-
isBlockOnDurableSend
public boolean isBlockOnDurableSend()
-
setBlockOnDurableSend
public void setBlockOnDurableSend(boolean blockOnDurableSend)
-
isAutoGroup
public boolean isAutoGroup()
-
setAutoGroup
public void setAutoGroup(boolean autoGroup)
-
isPreAcknowledge
public boolean isPreAcknowledge()
-
setPreAcknowledge
public void setPreAcknowledge(boolean preAcknowledge)
-
getRetryInterval
public long getRetryInterval()
-
setRetryInterval
public void setRetryInterval(long retryInterval)
-
getMaxRetryInterval
public long getMaxRetryInterval()
-
setMaxRetryInterval
public void setMaxRetryInterval(long retryInterval)
-
getRetryIntervalMultiplier
public double getRetryIntervalMultiplier()
-
setRetryIntervalMultiplier
public void setRetryIntervalMultiplier(double retryIntervalMultiplier)
-
getReconnectAttempts
public int getReconnectAttempts()
-
setReconnectAttempts
public void setReconnectAttempts(int reconnectAttempts)
-
setInitialConnectAttempts
public void setInitialConnectAttempts(int reconnectAttempts)
-
getInitialConnectAttempts
public int getInitialConnectAttempts()
-
isFailoverOnInitialConnection
@Deprecated public boolean isFailoverOnInitialConnection()
Deprecated.
-
setFailoverOnInitialConnection
@Deprecated public void setFailoverOnInitialConnection(boolean failover)
Deprecated.
-
isUseGlobalPools
public boolean isUseGlobalPools()
-
setUseGlobalPools
public void setUseGlobalPools(boolean useGlobalPools)
-
getScheduledThreadPoolMaxSize
public int getScheduledThreadPoolMaxSize()
-
setScheduledThreadPoolMaxSize
public void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
-
getThreadPoolMaxSize
public int getThreadPoolMaxSize()
-
setThreadPoolMaxSize
public void setThreadPoolMaxSize(int threadPoolMaxSize)
-
getInitialMessagePacketSize
public int getInitialMessagePacketSize()
-
setInitialMessagePacketSize
public void setInitialMessagePacketSize(int size)
-
isIgnoreJTA
public boolean isIgnoreJTA()
-
setIgnoreJTA
public void setIgnoreJTA(boolean ignoreJTA)
-
setIncomingInterceptorList
public void 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.
-
getIncomingInterceptorList
public java.lang.String getIncomingInterceptorList()
-
setOutgoingInterceptorList
public void setOutgoingInterceptorList(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.
-
getOutgoingInterceptorList
public java.lang.String getOutgoingInterceptorList()
-
setUser
public ActiveMQConnectionFactory setUser(java.lang.String user)
-
getUser
public java.lang.String getUser()
-
getPassword
public java.lang.String getPassword()
-
setPassword
public ActiveMQConnectionFactory setPassword(java.lang.String password)
-
setGroupID
public void setGroupID(java.lang.String groupID)
-
getGroupID
public java.lang.String getGroupID()
-
isCompressLargeMessage
public boolean isCompressLargeMessage()
-
setCompressLargeMessage
public void setCompressLargeMessage(boolean avoidLargeMessages)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
getServerLocator
public ServerLocator getServerLocator()
-
getFactoryType
public int getFactoryType()
-
createConnectionInternal
protected ActiveMQConnection createConnectionInternal(java.lang.String username, java.lang.String password, boolean isXA, int type) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
makeReadOnly
protected void makeReadOnly()
-
-