public class ActiveMQConnectionFactory extends JNDIStorable implements ConnectionFactoryOptions, Externalizable, ConnectionFactory, XAConnectionFactory, AutoCloseable
ActiveMQ Artemis implementation of a JMS ConnectionFactory.
This connection factory will use defaults defined by DefaultConnectionProperties
.
Constructor and Description |
---|
ActiveMQConnectionFactory()
This will use a default URI from
DefaultConnectionProperties |
ActiveMQConnectionFactory(boolean ha,
DiscoveryGroupConfiguration groupConfiguration) |
ActiveMQConnectionFactory(boolean ha,
TransportConfiguration... initialConnectors) |
ActiveMQConnectionFactory(ServerLocator serverLocator) |
ActiveMQConnectionFactory(String brokerURL) |
ActiveMQConnectionFactory(String url,
String user,
String password)
For compatibility and users used to this kind of constructor
|
getReference, readObject, writeObject
public ActiveMQConnectionFactory()
DefaultConnectionProperties
public ActiveMQConnectionFactory(String brokerURL)
public ActiveMQConnectionFactory(String url, String user, String password)
public ActiveMQConnectionFactory(ServerLocator serverLocator)
public ActiveMQConnectionFactory(boolean ha, DiscoveryGroupConfiguration groupConfiguration)
public ActiveMQConnectionFactory(boolean ha, TransportConfiguration... initialConnectors)
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public URI toURI() throws IOException
IOException
public String getProtocolManagerFactoryStr()
public void setProtocolManagerFactoryStr(String protocolManagerFactoryStr)
public ActiveMQConnectionFactory disableFinalizeChecks()
public boolean isFinalizeChecks()
public String getDeserializationBlackList()
getDeserializationBlackList
in interface ConnectionFactoryOptions
public void setDeserializationBlackList(String blackList)
setDeserializationBlackList
in interface ConnectionFactoryOptions
public String getDeserializationWhiteList()
getDeserializationWhiteList
in interface ConnectionFactoryOptions
public void setDeserializationWhiteList(String whiteList)
setDeserializationWhiteList
in interface ConnectionFactoryOptions
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void setBrokerURL(String brokerURL) throws JMSException
JMSException
public Connection createConnection() throws JMSException
ConnectionFactory
Connection.start
method is explicitly called.createConnection
in interface ConnectionFactory
JMSException
- if the Jakarta Messaging provider fails to create the connection due to some internal error.JMSSecurityException
- if client authentication fails due to an invalid user name or password.public Connection createConnection(String username, String password) throws JMSException
ConnectionFactory
Connection.start
method is explicitly called.createConnection
in interface ConnectionFactory
username
- the caller's user namepassword
- the caller's passwordJMSException
- if the Jakarta Messaging provider fails to create the connection due to some internal error.JMSSecurityException
- if client authentication fails due to an invalid user name or password.public JMSContext createContext()
ConnectionFactory
A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but will be automatically started when a JMSConsumer is created.
The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is called in the Jakarta EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Jakarta EE application client container:
JMSContext.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement
mode see the link below.
In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:
JMSContext
's commit
or rollback
methods.
In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:
JMSContext.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement
mode see the link below.
createContext
in interface ConnectionFactory
JMSContext.AUTO_ACKNOWLEDGE
,
ConnectionFactory.createContext(int)
,
ConnectionFactory.createContext(java.lang.String, java.lang.String)
,
ConnectionFactory.createContext(java.lang.String, java.lang.String, int)
,
JMSContext.createContext(int)
public JMSContext createContext(int sessionMode)
ConnectionFactory
A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but will be automatically started when a JMSConsumer is created.
The effect of setting the sessionMode
argument depends on whether this method is called in a Java SE
environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is
called in the Jakarta EE web or EJB container then the effect of setting the sessionMode
argument also depends
on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Jakarta EE application client container:
sessionMode
is set to JMSContext.SESSION_TRANSACTED
then the session will use a local
transaction which may subsequently be committed or rolled back by calling the JMSContext
's commit
or
rollback
methods.
sessionMode
is set to any of JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
or JMSContext.DUPS_OK_ACKNOWLEDGE
. then the session will be
non-transacted and messages received by this session will be acknowledged according to the value of
sessionMode
. For a definition of the meaning of these acknowledgement modes see the links below.
In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:
sessionMode
is ignored. The session will participate in the JTA transaction and will be
committed or rolled back when that transaction is committed or rolled back, not by calling the JMSContext
's
commit
or rollback
methods. Since the argument is ignored, developers are recommended to use
createContext()
instead of this method.
In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:
acknowledgeMode
must be set to either of JMSContext.AUTO_ACKNOWLEDGE
or
JMSContext.DUPS_OK_ACKNOWLEDGE
. The session will be non-transacted and messages received by this session will
be acknowledged automatically according to the value of acknowledgeMode
. For a definition of the meaning of
these acknowledgement modes see the links below. The values JMSContext.SESSION_TRANSACTED
and
JMSContext.CLIENT_ACKNOWLEDGE
may not be used.
createContext
in interface ConnectionFactory
sessionMode
- indicates which of four possible session modes will be used.
JMSContext.SESSION_TRANSACTED
, JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
and JMSContext.DUPS_OK_ACKNOWLEDGE
.
JMSContext.AUTO_ACKNOWLEDGE
and JMSContext.DUPS_OK_ACKNOWLEDGE
. In this case
the values JMSContext.TRANSACTED
and JMSContext.CLIENT_ACKNOWLEDGE
are not permitted.
JMSContext.SESSION_TRANSACTED
,
JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
,
JMSContext.DUPS_OK_ACKNOWLEDGE
,
ConnectionFactory.createContext()
,
ConnectionFactory.createContext(java.lang.String, java.lang.String)
,
ConnectionFactory.createContext(java.lang.String, java.lang.String, int)
,
JMSContext.createContext(int)
public JMSContext createContext(String userName, String password)
ConnectionFactory
A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but will be automatically started when a JMSConsumer.
The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is called in the Jakarta EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Jakarta EE application client container:
JMSContext.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement
mode see the link below.
In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:
JMSContext
's commit
or rollback
methods.
In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:
JMSContext.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement
mode see the link below.
createContext
in interface ConnectionFactory
userName
- the caller's user namepassword
- the caller's passwordJMSContext.AUTO_ACKNOWLEDGE
,
ConnectionFactory.createContext()
,
ConnectionFactory.createContext(int)
,
ConnectionFactory.createContext(java.lang.String, java.lang.String, int)
,
JMSContext.createContext(int)
public JMSContext createContext(String userName, String password, int sessionMode)
ConnectionFactory
A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but will be automatically started when a JMSConsumer is created.
The effect of setting the sessionMode
argument depends on whether this method is called in a Java SE
environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is
called in the Jakarta EE web or EJB container then the effect of setting the sessionMode
argument also depends
on whether or not there is an active JTA transaction in progress.
In a Java SE environment or in the Jakarta EE application client container:
sessionMode
is set to JMSContext.SESSION_TRANSACTED
then the session will use a local
transaction which may subsequently be committed or rolled back by calling the JMSContext
's commit
or
rollback
methods.
sessionMode
is set to any of JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
or JMSContext.DUPS_OK_ACKNOWLEDGE
. then the session will be
non-transacted and messages received by this session will be acknowledged according to the value of
sessionMode
. For a definition of the meaning of these acknowledgement modes see the links below.
In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:
sessionMode
is ignored. The session will participate in the JTA transaction and will be
committed or rolled back when that transaction is committed or rolled back, not by calling the JMSContext
's
commit
or rollback
methods. Since the argument is ignored, developers are recommended to use
createContext(String userName, String password)
instead of this method.
In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:
acknowledgeMode
must be set to either of JMSContext.AUTO_ACKNOWLEDGE
or
JMSContext.DUPS_OK_ACKNOWLEDGE
. The session will be non-transacted and messages received by this session will
be acknowledged automatically according to the value of acknowledgeMode
. For a definition of the meaning of
these acknowledgement modes see the links below. The values JMSContext.SESSION_TRANSACTED
and
JMSContext.CLIENT_ACKNOWLEDGE
may not be used.
createContext
in interface ConnectionFactory
userName
- the caller's user namepassword
- the caller's passwordsessionMode
- indicates which of four possible session modes will be used.
JMSContext.SESSION_TRANSACTED
, JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
and JMSContext.DUPS_OK_ACKNOWLEDGE
.
JMSContext.AUTO_ACKNOWLEDGE
and JMSContext.DUPS_OK_ACKNOWLEDGE
. In this case
the values JMSContext.TRANSACTED
and JMSContext.CLIENT_ACKNOWLEDGE
are not permitted.
JMSContext.SESSION_TRANSACTED
,
JMSContext.CLIENT_ACKNOWLEDGE
,
JMSContext.AUTO_ACKNOWLEDGE
,
JMSContext.DUPS_OK_ACKNOWLEDGE
,
ConnectionFactory.createContext()
,
ConnectionFactory.createContext(int)
,
ConnectionFactory.createContext(java.lang.String, java.lang.String)
,
JMSContext.createContext(int)
public QueueConnection createQueueConnection() throws JMSException
JMSException
public QueueConnection createQueueConnection(String username, String password) throws JMSException
JMSException
public TopicConnection createTopicConnection() throws JMSException
JMSException
public TopicConnection createTopicConnection(String username, String password) throws JMSException
JMSException
public XAConnection createXAConnection() throws JMSException
XAConnectionFactory
XAConnection
with the default user identity. The connection is created in stopped mode. No
messages will be delivered until the Connection.start
method is explicitly called.createXAConnection
in interface XAConnectionFactory
XAConnection
JMSException
- if the Jakarta Messaging provider fails to create an XA connection due to some internal error.JMSSecurityException
- if client authentication fails due to an invalid user name or password.public XAConnection createXAConnection(String username, String password) throws JMSException
XAConnectionFactory
XAConnection
with the specified user identity. The connection is created in stopped mode. No
messages will be delivered until the Connection.start
method is explicitly called.createXAConnection
in interface XAConnectionFactory
username
- the caller's user namepassword
- the caller's passwordXAConnection
JMSException
- if the Jakarta Messaging provider fails to create an XA connection due to some internal error.JMSSecurityException
- if client authentication fails due to an invalid user name or password.public XAJMSContext createXAContext()
XAConnectionFactory
XAJMSContext
with the default user identity
A connection and session are created for use by the new XAJMSContext
. The connection is created in stopped
mode but will be automatically started when a JMSConsumer
is created.
createXAContext
in interface XAConnectionFactory
XAJMSContext
public XAJMSContext createXAContext(String userName, String password)
XAConnectionFactory
A connection and session are created for use by the new XAJMSContext
. The connection is created in stopped
mode but will be automatically started when a JMSConsumer
is created.
createXAContext
in interface XAConnectionFactory
userName
- the caller's user namepassword
- the caller's passwordpublic XAQueueConnection createXAQueueConnection() throws JMSException
JMSException
public XAQueueConnection createXAQueueConnection(String username, String password) throws JMSException
JMSException
public XATopicConnection createXATopicConnection() throws JMSException
JMSException
public XATopicConnection createXATopicConnection(String username, String password) throws JMSException
JMSException
protected void buildFromProperties(Properties props)
JNDIStorable
buildFromProperties
in class JNDIStorable
props
- The properties to use when building the new isntance.protected void populateProperties(Properties props)
JNDIStorable
populateProperties
in class JNDIStorable
props
- The properties to use when initializing the new instance.public boolean isHA()
public String getConnectionLoadBalancingPolicyClassName()
public void setConnectionLoadBalancingPolicyClassName(String connectionLoadBalancingPolicyClassName)
public TransportConfiguration[] getStaticConnectors()
public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
public String getClientID()
public void setClientID(String clientID)
public boolean isEnableSharedClientID()
public void setEnableSharedClientID(boolean enableSharedClientID)
public int getDupsOKBatchSize()
public void setDupsOKBatchSize(int dupsOKBatchSize)
public int getTransactionBatchSize()
public void setTransactionBatchSize(int transactionBatchSize)
public boolean isCacheDestinations()
public void setCacheDestinations(boolean cacheDestinations)
public boolean isEnable1xPrefixes()
public void setEnable1xPrefixes(boolean enable1xPrefixes)
public long getClientFailureCheckPeriod()
public void setClientFailureCheckPeriod(long clientFailureCheckPeriod)
public long getConnectionTTL()
public void setConnectionTTL(long connectionTTL)
public long getCallTimeout()
public void setCallTimeout(long callTimeout)
public long getCallFailoverTimeout()
public void setCallFailoverTimeout(long callTimeout)
public void setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing)
public boolean isUseTopologyForLoadBalancing()
public int getConsumerWindowSize()
public void setConsumerWindowSize(int consumerWindowSize)
public int getConsumerMaxRate()
public void setConsumerMaxRate(int consumerMaxRate)
public int getConfirmationWindowSize()
public void setConfirmationWindowSize(int confirmationWindowSize)
public int getProducerMaxRate()
public void setProducerMaxRate(int producerMaxRate)
public int getProducerWindowSize()
public void setProducerWindowSize(int producerWindowSize)
public void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient)
cacheLargeMessagesClient
- public boolean isCacheLargeMessagesClient()
public int getMinLargeMessageSize()
public void setMinLargeMessageSize(int minLargeMessageSize)
public boolean isBlockOnAcknowledge()
public void setBlockOnAcknowledge(boolean blockOnAcknowledge)
public boolean isBlockOnNonDurableSend()
public void setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
public boolean isBlockOnDurableSend()
public void setBlockOnDurableSend(boolean blockOnDurableSend)
public boolean isAutoGroup()
public void setAutoGroup(boolean autoGroup)
public boolean isPreAcknowledge()
public void setPreAcknowledge(boolean preAcknowledge)
public long getRetryInterval()
public void setRetryInterval(long retryInterval)
public long getMaxRetryInterval()
public void setMaxRetryInterval(long retryInterval)
public double getRetryIntervalMultiplier()
public void setRetryIntervalMultiplier(double retryIntervalMultiplier)
public int getReconnectAttempts()
public void setReconnectAttempts(int reconnectAttempts)
public void setInitialConnectAttempts(int reconnectAttempts)
public int getInitialConnectAttempts()
@Deprecated public boolean isFailoverOnInitialConnection()
@Deprecated public void setFailoverOnInitialConnection(boolean failover)
public boolean isUseGlobalPools()
public void setUseGlobalPools(boolean useGlobalPools)
public int getScheduledThreadPoolMaxSize()
public void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
public int getThreadPoolMaxSize()
public void setThreadPoolMaxSize(int threadPoolMaxSize)
public int getInitialMessagePacketSize()
public void setInitialMessagePacketSize(int size)
public boolean isIgnoreJTA()
public void setIgnoreJTA(boolean ignoreJTA)
public void setIncomingInterceptorList(String interceptorList)
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.public String getIncomingInterceptorList()
public void setOutgoingInterceptorList(String interceptorList)
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.public String getOutgoingInterceptorList()
public ActiveMQConnectionFactory setUser(String user)
public String getUser()
public String getPassword()
public ActiveMQConnectionFactory setPassword(String password)
public void setGroupID(String groupID)
public String getGroupID()
public boolean isCompressLargeMessage()
public void setCompressLargeMessage(boolean avoidLargeMessages)
public void close()
close
in interface AutoCloseable
public ServerLocator getServerLocator()
public int getFactoryType()
protected ActiveMQConnection createConnectionInternal(String username, String password, boolean isXA, int type) throws JMSException
JMSException
Copyright © 2021 JBoss by Red Hat. All rights reserved.