Package org.apache.activemq
Class ActiveMQConnectionFactory
- java.lang.Object
-
- org.apache.activemq.jndi.JNDIBaseStorable
-
- org.apache.activemq.ActiveMQConnectionFactory
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,ConnectionFactory,QueueConnectionFactory,TopicConnectionFactory,Referenceable,JNDIStorableInterface,StatsCapable
- Direct Known Subclasses:
ActiveMQConnectionFactory,ActiveMQSslConnectionFactory,ActiveMQXAConnectionFactory
public class ActiveMQConnectionFactory extends JNDIBaseStorable implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, StatsCapable, Cloneable
A ConnectionFactory is an an Administered object, and is used for creating Connections. This class also implements QueueConnectionFactory and TopicConnectionFactory. You can use this connection to create both QueueConnections and TopicConnections.- See Also:
ConnectionFactory, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalwaysSessionAsyncprotected URIbrokerURLprotected StringclientIDstatic StringDEFAULT_BROKER_BIND_URLstatic StringDEFAULT_BROKER_URLstatic StringDEFAULT_PASSWORDstatic intDEFAULT_PRODUCER_WINDOW_SIZEstatic StringDEFAULT_USERprotected booleandispatchAsyncprotected Stringpasswordprotected StringuserNameprotected intxaAckMode
-
Constructor Summary
Constructors Constructor Description ActiveMQConnectionFactory()ActiveMQConnectionFactory(String brokerURL)ActiveMQConnectionFactory(String userName, String password, String brokerURL)ActiveMQConnectionFactory(String userName, String password, URI brokerURL)ActiveMQConnectionFactory(URI brokerURL)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbuildFromMap(Map<String,Object> properties)voidbuildFromProperties(Properties properties)Set the properties that will represent the instance in JNDIprotected voidconfigureConnection(ActiveMQConnection connection)ActiveMQConnectionFactorycopy()Returns a copy of the given connection factoryprotected ActiveMQConnectioncreateActiveMQConnection()protected ActiveMQConnectioncreateActiveMQConnection(String userName, String password)protected ActiveMQConnectioncreateActiveMQConnection(Transport transport, JMSStatsImpl stats)ConnectioncreateConnection()ConnectioncreateConnection(String userName, String password)QueueConnectioncreateQueueConnection()QueueConnectioncreateQueueConnection(String userName, String password)TopicConnectioncreateTopicConnection()TopicConnectioncreateTopicConnection(String userName, String password)protected TransportcreateTransport()Creates a Transport based on this object's connection settings.intgetAuditDepth()intgetAuditMaximumProducerNumber()BlobTransferPolicygetBlobTransferPolicy()StringgetBrokerURL()StringgetClientID()protected IdGeneratorgetClientIdGenerator()StringgetClientIDPrefix()ClientInternalExceptionListenergetClientInternalExceptionListener()intgetCloseTimeout()protected IdGeneratorgetConnectionIdGenerator()intgetConnectResponseTimeout()longgetConsumerFailoverRedeliveryWaitPeriod()ExceptionListenergetExceptionListener()intgetMaxThreadPoolSize()longgetOptimizeAcknowledgeTimeOut()longgetOptimizedAckScheduledAckInterval()Gets the configured time interval that is used to force all MessageConsumers that have optimizedAcknowledge enabled to send an ack for any outstanding Message Acks.StringgetPassword()ActiveMQPrefetchPolicygetPrefetchPolicy()intgetProducerWindowSize()RedeliveryPolicygetRedeliveryPolicy()RedeliveryPolicyMapgetRedeliveryPolicyMap()RejectedExecutionHandlergetRejectedTaskHandler()intgetSendTimeout()TaskRunnerFactorygetSessionTaskRunner()StatsImplgetStats()MessageTransformergetTransformer()TransportListenergetTransportListener()List<String>getTrustedPackages()StringgetUserName()longgetWarnAboutUnstartedConnectionTimeout()booleanisAlwaysSessionAsync()booleanisAlwaysSyncSend()booleanisCheckForDuplicates()booleanisConsumerExpiryCheckEnabled()booleanisCopyMessageOnSend()booleanisDisableTimeStampsByDefault()booleanisDispatchAsync()booleanisExclusiveConsumer()booleanisMessagePrioritySupported()booleanisNestedMapAndListEnabled()booleanisNonBlockingRedelivery()booleanisObjectMessageSerializationDefered()booleanisOptimizeAcknowledge()booleanisOptimizedMessageDispatch()booleanisRmIdFromConnectionId()booleanisSendAcksAsync()booleanisStatsEnabled()booleanisTransactedIndividualAck()booleanisTrustAllPackages()booleanisUseAsyncSend()booleanisUseCompression()booleanisUseDedicatedTaskRunner()booleanisUseRetroactiveConsumer()booleanisWatchTopicAdvisories()voidpopulateProperties(Properties props)Initialize the instance from properties stored in JNDIvoidsetAlwaysSessionAsync(boolean alwaysSessionAsync)If this flag is not set then a separate thread is not used for dispatching messages for each Session in the Connection.voidsetAlwaysSyncSend(boolean alwaysSyncSend)Set true if always require messages to be sync sentvoidsetAuditDepth(int auditDepth)voidsetAuditMaximumProducerNumber(int auditMaximumProducerNumber)voidsetBlobTransferPolicy(BlobTransferPolicy blobTransferPolicy)Sets the policy used to describe how out-of-band BLOBs (Binary Large OBjects) are transferred from producers to brokers to consumersvoidsetBrokerURL(String brokerURL)Sets the connection URL used to connect to the ActiveMQ broker.voidsetCheckForDuplicates(boolean checkForDuplicates)voidsetClientID(String clientID)Sets the JMS clientID to use for the created connection.protected voidsetClientIdGenerator(IdGenerator clientIdGenerator)voidsetClientIDPrefix(String clientIDPrefix)Sets the prefix used by autogenerated JMS Client ID values which are used if the JMS client does not explicitly specify on.voidsetClientInternalExceptionListener(ClientInternalExceptionListener clientInternalExceptionListener)Allows anClientInternalExceptionListenerto be configured on the ConnectionFactory so that when this factory is used by frameworks which don't expose the Connection such as Spring JmsTemplate, you can register an exception listener.voidsetCloseTimeout(int closeTimeout)Sets the timeout before a close is considered complete.protected voidsetConnectionIdGenerator(IdGenerator connectionIdGenerator)voidsetConnectionIDPrefix(String connectionIDPrefix)Sets the prefix used by connection id generatorvoidsetConnectResponseTimeout(int connectResponseTimeout)voidsetConsumerExpiryCheckEnabled(boolean consumerExpiryCheckEnabled)Controls whether message expiration checking is done in each MessageConsumer prior to dispatching a message.voidsetConsumerFailoverRedeliveryWaitPeriod(long consumerFailoverRedeliveryWaitPeriod)voidsetCopyMessageOnSend(boolean copyMessageOnSend)Should a JMS message be copied to a new JMS Message object as part of the send() method in JMS.voidsetDisableTimeStampsByDefault(boolean disableTimeStampsByDefault)Sets whether or not timestamps on messages should be disabled or not.voidsetDispatchAsync(boolean asyncDispatch)Enables or disables the default setting of whether or not consumers have their messages dispatched synchronously or asynchronously by the broker.voidsetExceptionListener(ExceptionListener exceptionListener)Allows anExceptionListenerto be configured on the ConnectionFactory so that when this factory is used by frameworks which don't expose the Connection such as Spring JmsTemplate, you can register an exception listener.voidsetExclusiveConsumer(boolean exclusiveConsumer)Enables or disables whether or not queue consumers should be exclusive or not for example to preserve ordering when not using Message GroupsvoidsetMaxThreadPoolSize(int maxThreadPoolSize)voidsetMessagePrioritySupported(boolean messagePrioritySupported)voidsetNestedMapAndListEnabled(boolean structuredMapsEnabled)Enables/disables whether or not Message properties and MapMessage entries support Nested Structures of Map and List objectsvoidsetNonBlockingRedelivery(boolean nonBlockingRedelivery)When true a MessageConsumer will not stop Message delivery before re-delivering Messages from a rolled back transaction.voidsetObjectMessageSerializationDefered(boolean objectMessageSerializationDefered)When an object is set on an ObjectMessage, the JMS spec requires the object to be serialized by that set method.voidsetOptimizeAcknowledge(boolean optimizeAcknowledge)voidsetOptimizeAcknowledgeTimeOut(long optimizeAcknowledgeTimeOut)The max time in milliseconds between optimized ack batchesvoidsetOptimizedAckScheduledAckInterval(long optimizedAckScheduledAckInterval)Sets the amount of time between scheduled sends of any outstanding Message Acks for consumers that have been configured with optimizeAcknowledge enabled.voidsetOptimizedMessageDispatch(boolean optimizedMessageDispatch)If this flag is set then an larger prefetch limit is used - only applicable for durable topic subscribers.voidsetPassword(String password)Sets the JMS password used for connections created from this factoryvoidsetPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy)Sets the prefetch policy for consumers created by this connection.voidsetProducerWindowSize(int producerWindowSize)voidsetRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)Sets the global default redelivery policy to be used when a message is delivered but the session is rolled backvoidsetRedeliveryPolicyMap(RedeliveryPolicyMap redeliveryPolicyMap)Sets the global redelivery policy mapping to be used when a message is delivered but the session is rolled backvoidsetRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler)voidsetRmIdFromConnectionId(boolean rmIdFromConnectionId)uses the connection id as the resource identity for XAResource.isSameRM ensuring join will only occur on a single connectionvoidsetSendAcksAsync(boolean sendAcksAsync)voidsetSendTimeout(int sendTimeout)voidsetSessionTaskRunner(TaskRunnerFactory sessionTaskRunner)voidsetStatsEnabled(boolean statsEnabled)voidsetTransactedIndividualAck(boolean transactedIndividualAck)when true, submit individual transacted acks immediately rather than with transaction completion.voidsetTransformer(MessageTransformer transformer)Sets the transformer used to transform messages before they are sent on to the JMS bus or when they are received from the bus but before they are delivered to the JMS clientvoidsetTransportListener(TransportListener transportListener)Allows a listener to be configured on the ConnectionFactory so that when this factory is used with frameworks which don't expose the Connection such as Spring JmsTemplate, you can still register a transport listener.voidsetTrustAllPackages(boolean trustAllPackages)voidsetTrustedPackages(List<String> trustedPackages)voidsetUseAsyncSend(boolean useAsyncSend)Forces the use of Async Sends which adds a massive performance boost; but means that the send() method will return immediately whether the message has been sent or not which could lead to message loss.voidsetUseCompression(boolean useCompression)Enables the use of compression of the message bodiesvoidsetUseDedicatedTaskRunner(boolean useDedicatedTaskRunner)voidsetUseRetroactiveConsumer(boolean useRetroactiveConsumer)Sets whether or not retroactive consumers are enabled.voidsetUserName(String userName)Sets the JMS userName used by connections created by this factoryvoidsetWarnAboutUnstartedConnectionTimeout(long warnAboutUnstartedConnectionTimeout)Enables the timeout from a connection creation to when a warning is generated if the connection is not properly started viaConnection.start()and a message is received by a consumer.voidsetWatchTopicAdvisories(boolean watchTopicAdvisories)-
Methods inherited from class org.apache.activemq.jndi.JNDIBaseStorable
getProperties, getReference, readExternal, setProperties, writeExternal
-
-
-
-
Field Detail
-
DEFAULT_BROKER_BIND_URL
public static final String DEFAULT_BROKER_BIND_URL
-
DEFAULT_BROKER_URL
public static final String DEFAULT_BROKER_URL
-
DEFAULT_USER
public static final String DEFAULT_USER
-
DEFAULT_PASSWORD
public static final String DEFAULT_PASSWORD
-
DEFAULT_PRODUCER_WINDOW_SIZE
public static final int DEFAULT_PRODUCER_WINDOW_SIZE
- See Also:
- Constant Field Values
-
brokerURL
protected URI brokerURL
-
userName
protected String userName
-
password
protected String password
-
clientID
protected String clientID
-
dispatchAsync
protected boolean dispatchAsync
-
alwaysSessionAsync
protected boolean alwaysSessionAsync
-
xaAckMode
protected int xaAckMode
-
-
Constructor Detail
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory()
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(String brokerURL)
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(URI brokerURL)
-
ActiveMQConnectionFactory
public ActiveMQConnectionFactory(String userName, String password, URI brokerURL)
-
-
Method Detail
-
copy
public ActiveMQConnectionFactory copy()
Returns a copy of the given connection factory
-
createConnection
public Connection createConnection() throws JMSException
- Specified by:
createConnectionin interfaceConnectionFactory- Returns:
- Returns the Connection.
- Throws:
JMSException
-
createConnection
public Connection createConnection(String userName, String password) throws JMSException
- Specified by:
createConnectionin interfaceConnectionFactory- Returns:
- Returns the Connection.
- Throws:
JMSException
-
createQueueConnection
public QueueConnection createQueueConnection() throws JMSException
- Specified by:
createQueueConnectionin interfaceQueueConnectionFactory- Returns:
- Returns the QueueConnection.
- Throws:
JMSException
-
createQueueConnection
public QueueConnection createQueueConnection(String userName, String password) throws JMSException
- Specified by:
createQueueConnectionin interfaceQueueConnectionFactory- Returns:
- Returns the QueueConnection.
- Throws:
JMSException
-
createTopicConnection
public TopicConnection createTopicConnection() throws JMSException
- Specified by:
createTopicConnectionin interfaceTopicConnectionFactory- Returns:
- Returns the TopicConnection.
- Throws:
JMSException
-
createTopicConnection
public TopicConnection createTopicConnection(String userName, String password) throws JMSException
- Specified by:
createTopicConnectionin interfaceTopicConnectionFactory- Returns:
- Returns the TopicConnection.
- Throws:
JMSException
-
getStats
public StatsImpl getStats()
- Specified by:
getStatsin interfaceStatsCapable- Returns:
- the StatsImpl associated with this ConnectionFactory.
-
createActiveMQConnection
protected ActiveMQConnection createActiveMQConnection() throws JMSException
- Throws:
JMSException
-
createTransport
protected Transport createTransport() throws JMSException
Creates a Transport based on this object's connection settings. Separated from createActiveMQConnection to allow for subclasses to override.- Returns:
- The newly created Transport.
- Throws:
JMSException- If unable to create trasnport.
-
createActiveMQConnection
protected ActiveMQConnection createActiveMQConnection(String userName, String password) throws JMSException
- Returns:
- Returns the Connection.
- Throws:
JMSException
-
createActiveMQConnection
protected ActiveMQConnection createActiveMQConnection(Transport transport, JMSStatsImpl stats) throws Exception
- Throws:
Exception
-
configureConnection
protected void configureConnection(ActiveMQConnection connection) throws JMSException
- Throws:
JMSException
-
getBrokerURL
public String getBrokerURL()
-
setBrokerURL
public void setBrokerURL(String brokerURL)
Sets the connection URL used to connect to the ActiveMQ broker.
-
getClientID
public String getClientID()
-
setClientID
public void setClientID(String clientID)
Sets the JMS clientID to use for the created connection. Note that this can only be used by one connection at once so generally its a better idea to set the clientID on a Connection
-
isCopyMessageOnSend
public boolean isCopyMessageOnSend()
-
setCopyMessageOnSend
public void setCopyMessageOnSend(boolean copyMessageOnSend)
Should a JMS message be copied to a new JMS Message object as part of the send() method in JMS. This is enabled by default to be compliant with the JMS specification. You can disable it if you do not mutate JMS messages after they are sent for a performance boost
-
isDisableTimeStampsByDefault
public boolean isDisableTimeStampsByDefault()
-
setDisableTimeStampsByDefault
public void setDisableTimeStampsByDefault(boolean disableTimeStampsByDefault)
Sets whether or not timestamps on messages should be disabled or not. If you disable them it adds a small performance boost.
-
isOptimizedMessageDispatch
public boolean isOptimizedMessageDispatch()
-
setOptimizedMessageDispatch
public void setOptimizedMessageDispatch(boolean optimizedMessageDispatch)
If this flag is set then an larger prefetch limit is used - only applicable for durable topic subscribers.
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
Sets the JMS password used for connections created from this factory
-
getPrefetchPolicy
public ActiveMQPrefetchPolicy getPrefetchPolicy()
-
setPrefetchPolicy
public void setPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy)
Sets the prefetch policy for consumers created by this connection.
-
isUseAsyncSend
public boolean isUseAsyncSend()
-
getBlobTransferPolicy
public BlobTransferPolicy getBlobTransferPolicy()
-
setBlobTransferPolicy
public void setBlobTransferPolicy(BlobTransferPolicy blobTransferPolicy)
Sets the policy used to describe how out-of-band BLOBs (Binary Large OBjects) are transferred from producers to brokers to consumers
-
setUseAsyncSend
public void setUseAsyncSend(boolean useAsyncSend)
Forces the use of Async Sends which adds a massive performance boost; but means that the send() method will return immediately whether the message has been sent or not which could lead to message loss.
-
isWatchTopicAdvisories
public boolean isWatchTopicAdvisories()
-
setWatchTopicAdvisories
public void setWatchTopicAdvisories(boolean watchTopicAdvisories)
-
isAlwaysSyncSend
public boolean isAlwaysSyncSend()
- Returns:
- true if always sync send messages
-
setAlwaysSyncSend
public void setAlwaysSyncSend(boolean alwaysSyncSend)
Set true if always require messages to be sync sent- Parameters:
alwaysSyncSend-
-
getUserName
public String getUserName()
-
setUserName
public void setUserName(String userName)
Sets the JMS userName used by connections created by this factory
-
isUseRetroactiveConsumer
public boolean isUseRetroactiveConsumer()
-
setUseRetroactiveConsumer
public void setUseRetroactiveConsumer(boolean useRetroactiveConsumer)
Sets whether or not retroactive consumers are enabled. Retroactive consumers allow non-durable topic subscribers to receive old messages that were published before the non-durable subscriber started.
-
isExclusiveConsumer
public boolean isExclusiveConsumer()
-
setExclusiveConsumer
public void setExclusiveConsumer(boolean exclusiveConsumer)
Enables or disables whether or not queue consumers should be exclusive or not for example to preserve ordering when not using Message Groups- Parameters:
exclusiveConsumer-
-
getRedeliveryPolicy
public RedeliveryPolicy getRedeliveryPolicy()
-
setRedeliveryPolicy
public void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
Sets the global default redelivery policy to be used when a message is delivered but the session is rolled back
-
getRedeliveryPolicyMap
public RedeliveryPolicyMap getRedeliveryPolicyMap()
-
setRedeliveryPolicyMap
public void setRedeliveryPolicyMap(RedeliveryPolicyMap redeliveryPolicyMap)
Sets the global redelivery policy mapping to be used when a message is delivered but the session is rolled back
-
getTransformer
public MessageTransformer getTransformer()
-
getSendTimeout
public int getSendTimeout()
- Returns:
- the sendTimeout (in milliseconds)
-
setSendTimeout
public void setSendTimeout(int sendTimeout)
- Parameters:
sendTimeout- the sendTimeout to set (in milliseconds)
-
isSendAcksAsync
public boolean isSendAcksAsync()
- Returns:
- the sendAcksAsync
-
setSendAcksAsync
public void setSendAcksAsync(boolean sendAcksAsync)
- Parameters:
sendAcksAsync- the sendAcksAsync to set
-
isMessagePrioritySupported
public boolean isMessagePrioritySupported()
- Returns:
- the messagePrioritySupported
-
setMessagePrioritySupported
public void setMessagePrioritySupported(boolean messagePrioritySupported)
- Parameters:
messagePrioritySupported- the messagePrioritySupported to set
-
setTransformer
public void setTransformer(MessageTransformer transformer)
Sets the transformer used to transform messages before they are sent on to the JMS bus or when they are received from the bus but before they are delivered to the JMS client
-
buildFromProperties
public void buildFromProperties(Properties properties)
Description copied from class:JNDIBaseStorableSet the properties that will represent the instance in JNDI- Specified by:
buildFromPropertiesin classJNDIBaseStorable
-
populateProperties
public void populateProperties(Properties props)
Description copied from class:JNDIBaseStorableInitialize the instance from properties stored in JNDI- Specified by:
populatePropertiesin classJNDIBaseStorable
-
isUseCompression
public boolean isUseCompression()
-
setUseCompression
public void setUseCompression(boolean useCompression)
Enables the use of compression of the message bodies
-
isObjectMessageSerializationDefered
public boolean isObjectMessageSerializationDefered()
-
setObjectMessageSerializationDefered
public void setObjectMessageSerializationDefered(boolean objectMessageSerializationDefered)
When an object is set on an ObjectMessage, the JMS spec requires the object to be serialized by that set method. Enabling this flag causes the object to not get serialized. The object may subsequently get serialized if the message needs to be sent over a socket or stored to disk.
-
isDispatchAsync
public boolean isDispatchAsync()
-
setDispatchAsync
public void setDispatchAsync(boolean asyncDispatch)
Enables or disables the default setting of whether or not consumers have their messages dispatched synchronously or asynchronously by the broker. For non-durable topics for example we typically dispatch synchronously by default to minimize context switches which boost performance. However sometimes its better to go slower to ensure that a single blocked consumer socket does not block delivery to other consumers.- Parameters:
asyncDispatch- If true then consumers created on this connection will default to having their messages dispatched asynchronously. The default value is true.
-
getCloseTimeout
public int getCloseTimeout()
- Returns:
- Returns the closeTimeout.
-
setCloseTimeout
public void setCloseTimeout(int closeTimeout)
Sets the timeout before a close is considered complete. Normally a close() on a connection waits for confirmation from the broker; this allows that operation to timeout to save the client hanging if there is no broker
-
isAlwaysSessionAsync
public boolean isAlwaysSessionAsync()
- Returns:
- Returns the alwaysSessionAsync.
-
setAlwaysSessionAsync
public void setAlwaysSessionAsync(boolean alwaysSessionAsync)
If this flag is not set then a separate thread is not used for dispatching messages for each Session in the Connection. However, a separate thread is always used if there is more than one session, or the session isn't in auto acknowledge or duplicates ok mode. By default this value is set to true and session dispatch happens asynchronously.
-
isOptimizeAcknowledge
public boolean isOptimizeAcknowledge()
- Returns:
- Returns the optimizeAcknowledge.
-
setOptimizeAcknowledge
public void setOptimizeAcknowledge(boolean optimizeAcknowledge)
- Parameters:
optimizeAcknowledge- The optimizeAcknowledge to set.
-
setOptimizeAcknowledgeTimeOut
public void setOptimizeAcknowledgeTimeOut(long optimizeAcknowledgeTimeOut)
The max time in milliseconds between optimized ack batches- Parameters:
optimizeAcknowledgeTimeOut-
-
getOptimizeAcknowledgeTimeOut
public long getOptimizeAcknowledgeTimeOut()
-
isNestedMapAndListEnabled
public boolean isNestedMapAndListEnabled()
-
setNestedMapAndListEnabled
public void setNestedMapAndListEnabled(boolean structuredMapsEnabled)
Enables/disables whether or not Message properties and MapMessage entries support Nested Structures of Map and List objects
-
getClientIDPrefix
public String getClientIDPrefix()
-
setClientIDPrefix
public void setClientIDPrefix(String clientIDPrefix)
Sets the prefix used by autogenerated JMS Client ID values which are used if the JMS client does not explicitly specify on.- Parameters:
clientIDPrefix-
-
getClientIdGenerator
protected IdGenerator getClientIdGenerator()
-
setClientIdGenerator
protected void setClientIdGenerator(IdGenerator clientIdGenerator)
-
setConnectionIDPrefix
public void setConnectionIDPrefix(String connectionIDPrefix)
Sets the prefix used by connection id generator- Parameters:
connectionIDPrefix-
-
getConnectionIdGenerator
protected IdGenerator getConnectionIdGenerator()
-
setConnectionIdGenerator
protected void setConnectionIdGenerator(IdGenerator connectionIdGenerator)
-
isStatsEnabled
public boolean isStatsEnabled()
- Returns:
- the statsEnabled
-
setStatsEnabled
public void setStatsEnabled(boolean statsEnabled)
- Parameters:
statsEnabled- the statsEnabled to set
-
getProducerWindowSize
public int getProducerWindowSize()
-
setProducerWindowSize
public void setProducerWindowSize(int producerWindowSize)
-
getWarnAboutUnstartedConnectionTimeout
public long getWarnAboutUnstartedConnectionTimeout()
-
setWarnAboutUnstartedConnectionTimeout
public void setWarnAboutUnstartedConnectionTimeout(long warnAboutUnstartedConnectionTimeout)
Enables the timeout from a connection creation to when a warning is generated if the connection is not properly started viaConnection.start()and a message is received by a consumer. It is a very common gotcha to forget to start the connection so this option makes the default case to create a warning if the user forgets. To disable the warning just set the value to < 0 (say -1).
-
getTransportListener
public TransportListener getTransportListener()
-
setTransportListener
public void setTransportListener(TransportListener transportListener)
Allows a listener to be configured on the ConnectionFactory so that when this factory is used with frameworks which don't expose the Connection such as Spring JmsTemplate, you can still register a transport listener.- Parameters:
transportListener- sets the listener to be registered on all connections created by this factory
-
getExceptionListener
public ExceptionListener getExceptionListener()
-
setExceptionListener
public void setExceptionListener(ExceptionListener exceptionListener)
Allows anExceptionListenerto be configured on the ConnectionFactory so that when this factory is used by frameworks which don't expose the Connection such as Spring JmsTemplate, you can register an exception listener.Note: access to this exceptionLinstener will not be serialized if it is associated with more than on connection (as it will be if more than one connection is subsequently created by this connection factory)
- Parameters:
exceptionListener- sets the exception listener to be registered on all connections created by this factory
-
getAuditDepth
public int getAuditDepth()
-
setAuditDepth
public void setAuditDepth(int auditDepth)
-
getAuditMaximumProducerNumber
public int getAuditMaximumProducerNumber()
-
setAuditMaximumProducerNumber
public void setAuditMaximumProducerNumber(int auditMaximumProducerNumber)
-
setUseDedicatedTaskRunner
public void setUseDedicatedTaskRunner(boolean useDedicatedTaskRunner)
-
isUseDedicatedTaskRunner
public boolean isUseDedicatedTaskRunner()
-
setConsumerFailoverRedeliveryWaitPeriod
public void setConsumerFailoverRedeliveryWaitPeriod(long consumerFailoverRedeliveryWaitPeriod)
-
getConsumerFailoverRedeliveryWaitPeriod
public long getConsumerFailoverRedeliveryWaitPeriod()
-
getClientInternalExceptionListener
public ClientInternalExceptionListener getClientInternalExceptionListener()
-
setClientInternalExceptionListener
public void setClientInternalExceptionListener(ClientInternalExceptionListener clientInternalExceptionListener)
Allows anClientInternalExceptionListenerto be configured on the ConnectionFactory so that when this factory is used by frameworks which don't expose the Connection such as Spring JmsTemplate, you can register an exception listener.Note: access to this clientInternalExceptionListener will not be serialized if it is associated with more than on connection (as it will be if more than one connection is subsequently created by this connection factory)
- Parameters:
clientInternalExceptionListener- sets the exception listener to be registered on all connections created by this factory
-
isCheckForDuplicates
public boolean isCheckForDuplicates()
- Returns:
- the checkForDuplicates
-
setCheckForDuplicates
public void setCheckForDuplicates(boolean checkForDuplicates)
- Parameters:
checkForDuplicates- the checkForDuplicates to set
-
isTransactedIndividualAck
public boolean isTransactedIndividualAck()
-
setTransactedIndividualAck
public void setTransactedIndividualAck(boolean transactedIndividualAck)
when true, submit individual transacted acks immediately rather than with transaction completion. This allows the acks to represent delivery status which can be persisted on rollback Used in conjunction with org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter#setRewriteOnRedelivery(boolean) true
-
isNonBlockingRedelivery
public boolean isNonBlockingRedelivery()
-
setNonBlockingRedelivery
public void setNonBlockingRedelivery(boolean nonBlockingRedelivery)
When true a MessageConsumer will not stop Message delivery before re-delivering Messages from a rolled back transaction. This implies that message order will not be preserved and also will result in the TransactedIndividualAck option to be enabled.
-
getMaxThreadPoolSize
public int getMaxThreadPoolSize()
-
setMaxThreadPoolSize
public void setMaxThreadPoolSize(int maxThreadPoolSize)
-
getSessionTaskRunner
public TaskRunnerFactory getSessionTaskRunner()
-
setSessionTaskRunner
public void setSessionTaskRunner(TaskRunnerFactory sessionTaskRunner)
-
getRejectedTaskHandler
public RejectedExecutionHandler getRejectedTaskHandler()
-
setRejectedTaskHandler
public void setRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler)
-
getOptimizedAckScheduledAckInterval
public long getOptimizedAckScheduledAckInterval()
Gets the configured time interval that is used to force all MessageConsumers that have optimizedAcknowledge enabled to send an ack for any outstanding Message Acks. By default this value is set to zero meaning that the consumers will not do any background Message acknowledgment.- Returns:
- the scheduledOptimizedAckInterval
-
setOptimizedAckScheduledAckInterval
public void setOptimizedAckScheduledAckInterval(long optimizedAckScheduledAckInterval)
Sets the amount of time between scheduled sends of any outstanding Message Acks for consumers that have been configured with optimizeAcknowledge enabled.- Parameters:
optimizedAckScheduledAckInterval- the scheduledOptimizedAckInterval to set
-
isRmIdFromConnectionId
public boolean isRmIdFromConnectionId()
-
setRmIdFromConnectionId
public void setRmIdFromConnectionId(boolean rmIdFromConnectionId)
uses the connection id as the resource identity for XAResource.isSameRM ensuring join will only occur on a single connection
-
isConsumerExpiryCheckEnabled
public boolean isConsumerExpiryCheckEnabled()
- Returns:
- true if MessageConsumer instance will check for expired messages before dispatch.
-
setConsumerExpiryCheckEnabled
public void setConsumerExpiryCheckEnabled(boolean consumerExpiryCheckEnabled)
Controls whether message expiration checking is done in each MessageConsumer prior to dispatching a message. Disabling this check can lead to consumption of expired messages.- Parameters:
consumerExpiryCheckEnabled- controls whether expiration checking is done prior to dispatch.
-
isTrustAllPackages
public boolean isTrustAllPackages()
-
setTrustAllPackages
public void setTrustAllPackages(boolean trustAllPackages)
-
getConnectResponseTimeout
public int getConnectResponseTimeout()
-
setConnectResponseTimeout
public void setConnectResponseTimeout(int connectResponseTimeout)
-
-