Class ActiveMQConnectionFactory

    • Constructor Detail

      • ActiveMQConnectionFactory

        public ActiveMQConnectionFactory​(String brokerURL)
      • ActiveMQConnectionFactory

        public ActiveMQConnectionFactory​(String url,
                                         String user,
                                         String password)
        For compatibility and users used to this kind of constructor
      • ActiveMQConnectionFactory

        public ActiveMQConnectionFactory​(ServerLocator serverLocator)
      • ActiveMQConnectionFactory

        public ActiveMQConnectionFactory​(boolean ha,
                                         TransportConfiguration... initialConnectors)
    • Method Detail

      • getProtocolManagerFactoryStr

        public String getProtocolManagerFactoryStr()
      • setProtocolManagerFactoryStr

        public void setProtocolManagerFactoryStr​(String protocolManagerFactoryStr)
      • setBrokerURL

        public void setBrokerURL​(String brokerURL)
                          throws 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:
        JMSException
      • createConnection

        public Connection createConnection()
                                    throws JMSException
        Description copied from interface: ConnectionFactory
        Creates a connection 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.
        Specified by:
        createConnection in interface ConnectionFactory
        Returns:
        a newly created connection
        Throws:
        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.
      • createConnection

        public Connection createConnection​(String username,
                                           String password)
                                    throws JMSException
        Description copied from interface: ConnectionFactory
        Creates a connection 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.
        Specified by:
        createConnection in interface ConnectionFactory
        Parameters:
        username - the caller's user name
        password - the caller's password
        Returns:
        a newly created connection
        Throws:
        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.
      • createContext

        public JMSContext createContext()
        Description copied from interface: ConnectionFactory
        Creates a JMSContext with the default user identity and an unspecified sessionMode.

        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:

        • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of 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:

        • 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.

        In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:

        • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of JMSContext.AUTO_ACKNOWLEDGE For a definition of the meaning of this acknowledgement mode see the link below.
        Specified by:
        createContext in interface ConnectionFactory
        Returns:
        a newly created JMSContext
        See Also:
        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)
      • createContext

        public JMSContext createContext​(int sessionMode)
        Description copied from interface: ConnectionFactory
        Creates a JMSContext with the default user identity and the specified session mode.

        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:

        • If 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.
        • If 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:

        • The argument 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:

        • The argument 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.
        Specified by:
        createContext in interface ConnectionFactory
        Parameters:
        sessionMode - indicates which of four possible session modes will be used.
        • If this method is called in a Java SE environment or in the Jakarta EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
        • If this method is called in the Jakarta EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
        • If this method is called in the Jakarta EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
        Returns:
        a newly created JMSContext
        See Also:
        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)
      • createContext

        public JMSContext createContext​(String userName,
                                        String password)
        Description copied from interface: ConnectionFactory
        Creates a JMSContext with the specified user identity and an unspecified sessionMode.

        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:

        • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of 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:

        • 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.

        In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:

        • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of JMSContext.AUTO_ACKNOWLEDGE For a definition of the meaning of this acknowledgement mode see the link below.
        Specified by:
        createContext in interface ConnectionFactory
        Parameters:
        userName - the caller's user name
        password - the caller's password
        Returns:
        a newly created JMSContext
        See Also:
        JMSContext.AUTO_ACKNOWLEDGE, ConnectionFactory.createContext(), ConnectionFactory.createContext(int), ConnectionFactory.createContext(java.lang.String, java.lang.String, int), JMSContext.createContext(int)
      • createContext

        public JMSContext createContext​(String userName,
                                        String password,
                                        int sessionMode)
        Description copied from interface: ConnectionFactory
        Creates a JMSContext with the specified user identity and the specified session mode.

        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:

        • If 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.
        • If 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:

        • The argument 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:

        • The argument 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.
        Specified by:
        createContext in interface ConnectionFactory
        Parameters:
        userName - the caller's user name
        password - the caller's password
        sessionMode - indicates which of four possible session modes will be used.
        • If this method is called in a Java SE environment or in the Jakarta EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
        • If this method is called in the Jakarta EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
        • If this method is called in the Jakarta EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
        Returns:
        a newly created JMSContext
        See Also:
        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)
      • createXAConnection

        public XAConnection createXAConnection()
                                        throws JMSException
        Description copied from interface: XAConnectionFactory
        Creates an 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.
        Specified by:
        createXAConnection in interface XAConnectionFactory
        Returns:
        a newly created XAConnection
        Throws:
        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.
      • createXAConnection

        public XAConnection createXAConnection​(String username,
                                               String password)
                                        throws JMSException
        Description copied from interface: XAConnectionFactory
        Creates an 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.
        Specified by:
        createXAConnection in interface XAConnectionFactory
        Parameters:
        username - the caller's user name
        password - the caller's password
        Returns:
        a newly created XAConnection
        Throws:
        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.
      • createXAContext

        public XAJMSContext createXAContext()
        Description copied from interface: XAConnectionFactory
        Creates a 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.

        Specified by:
        createXAContext in interface XAConnectionFactory
        Returns:
        a newly created XAJMSContext
      • createXAContext

        public XAJMSContext createXAContext​(String userName,
                                            String password)
        Description copied from interface: XAConnectionFactory
        Creates a JMSContext with the specified 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.

        Specified by:
        createXAContext in interface XAConnectionFactory
        Parameters:
        userName - the caller's user name
        password - the caller's password
        Returns:
        a newly created JMSContext
      • buildFromProperties

        protected void buildFromProperties​(Properties props)
        Description copied from class: JNDIStorable
        Set the properties that will represent the instance in JNDI
        Specified by:
        buildFromProperties in class JNDIStorable
        Parameters:
        props - The properties to use when building the new isntance.
      • populateProperties

        protected void populateProperties​(Properties props)
        Description copied from class: JNDIStorable
        Initialize the instance from properties stored in JNDI
        Specified by:
        populateProperties in class JNDIStorable
        Parameters:
        props - The properties to use when initializing the new instance.
      • isHA

        public boolean isHA()
      • getConnectionLoadBalancingPolicyClassName

        public String getConnectionLoadBalancingPolicyClassName()
      • setConnectionLoadBalancingPolicyClassName

        public void setConnectionLoadBalancingPolicyClassName​(String connectionLoadBalancingPolicyClassName)
      • getClientID

        public String getClientID()
      • setClientID

        public void setClientID​(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​(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 String getIncomingInterceptorList()
      • setOutgoingInterceptorList

        public void setOutgoingInterceptorList​(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 String getOutgoingInterceptorList()
      • getUser

        public String getUser()
      • getPassword

        public String getPassword()
      • setGroupID

        public void setGroupID​(String groupID)
      • getGroupID

        public String getGroupID()
      • isCompressLargeMessage

        public boolean isCompressLargeMessage()
      • setCompressLargeMessage

        public void setCompressLargeMessage​(boolean avoidLargeMessages)
      • getFactoryType

        public int getFactoryType()
      • makeReadOnly

        protected void makeReadOnly()