public class ActiveMQConnectionFactory extends Object implements Externalizable, Referenceable, 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 url) |
ActiveMQConnectionFactory(String url,
String user,
String password)
For compatibility and users used to this kind of constructor
|
public ActiveMQConnectionFactory()
DefaultConnectionPropertiespublic ActiveMQConnectionFactory(String url)
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 ExternalizableIOExceptionpublic URI toURI() throws IOException
IOExceptionpublic String getProtocolManagerFactoryStr()
public void setProtocolManagerFactoryStr(String protocolManagerFactoryStr)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic Connection createConnection() throws JMSException
ConnectionFactoryConnection.start method
is explicitly called.createConnection in interface ConnectionFactoryJMSException - if the JMS 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
ConnectionFactoryConnection.start method
is explicitly called.createConnection in interface ConnectionFactoryusername - the caller's user namepassword - the caller's passwordJMSException - if the JMS 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()
ConnectionFactoryA 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 Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java 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 Java EE application client container:
JMSContext.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement mode see the link below.
In a Java EE web or EJB container, when there is an active JTA transaction in progress:
JMSContext's commit or rollback methods.
In the Java 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 ConnectionFactoryJMSContext.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)
ConnectionFactoryA 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 Java EE application client container, or in the Java EE web or EJB container.
If this method is called in the Java 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 Java 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 Java 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
createSession(), which has no arguments, instead of this method.
In the Java 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 ConnectionFactorysessionMode - 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)
ConnectionFactoryA 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 Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java 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 Java EE application client container:
JMSContext.AUTO_ACKNOWLEDGE
For a definition of the meaning of this acknowledgement mode see the link below.
In a Java EE web or EJB container, when there is an active JTA transaction in progress:
JMSContext's commit or rollback methods.
In the Java 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 ConnectionFactoryuserName - 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)
ConnectionFactoryA 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 Java EE application client container, or in the Java EE web or EJB container.
If this method is called in the Java 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 Java 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 Java 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
createSession(), which has no arguments, instead of this method.
In the Java 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 ConnectionFactoryuserName - 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
JMSExceptionpublic QueueConnection createQueueConnection(String username, String password) throws JMSException
JMSExceptionpublic TopicConnection createTopicConnection() throws JMSException
JMSExceptionpublic TopicConnection createTopicConnection(String username, String password) throws JMSException
JMSExceptionpublic XAConnection createXAConnection() throws JMSException
XAConnectionFactoryXAConnection 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 XAConnectionFactoryXAConnectionJMSException - if the JMS 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
XAConnectionFactoryXAConnection 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 XAConnectionFactoryusername - the caller's user namepassword - the caller's passwordXAConnectionJMSException - if the JMS 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()
XAConnectionFactoryXAJMSContext 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 XAConnectionFactoryXAJMSContextpublic 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 XAConnectionFactoryuserName - the caller's user namepassword - the caller's passwordpublic XAQueueConnection createXAQueueConnection() throws JMSException
JMSExceptionpublic XAQueueConnection createXAQueueConnection(String username, String password) throws JMSException
JMSExceptionpublic XATopicConnection createXATopicConnection() throws JMSException
JMSExceptionpublic XATopicConnection createXATopicConnection(String username, String password) throws JMSException
JMSExceptionpublic Reference getReference() throws NamingException
getReference in interface ReferenceableNamingExceptionpublic 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 int getDupsOKBatchSize()
public void setDupsOKBatchSize(int dupsOKBatchSize)
public int getTransactionBatchSize()
public void setTransactionBatchSize(int transactionBatchSize)
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 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()
public boolean isFailoverOnInitialConnection()
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 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 AutoCloseablepublic ServerLocator getServerLocator()
public int getFactoryType()
protected ActiveMQConnection createConnectionInternal(String username, String password, boolean isXA, int type) throws JMSException
JMSExceptionCopyright © 2016 JBoss by Red Hat. All rights reserved.