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 boolean
alwaysSessionAsync
protected URI
brokerURL
protected String
clientID
static String
DEFAULT_BROKER_BIND_URL
static String
DEFAULT_BROKER_URL
static String
DEFAULT_PASSWORD
static int
DEFAULT_PRODUCER_WINDOW_SIZE
static String
DEFAULT_USER
protected boolean
dispatchAsync
protected String
password
protected String
userName
protected int
xaAckMode
-
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 boolean
buildFromMap(Map<String,Object> properties)
void
buildFromProperties(Properties properties)
Set the properties that will represent the instance in JNDIprotected void
configureConnection(ActiveMQConnection connection)
ActiveMQConnectionFactory
copy()
Returns a copy of the given connection factoryprotected ActiveMQConnection
createActiveMQConnection()
protected ActiveMQConnection
createActiveMQConnection(String userName, String password)
protected ActiveMQConnection
createActiveMQConnection(Transport transport, JMSStatsImpl stats)
Connection
createConnection()
Connection
createConnection(String userName, String password)
QueueConnection
createQueueConnection()
QueueConnection
createQueueConnection(String userName, String password)
TopicConnection
createTopicConnection()
TopicConnection
createTopicConnection(String userName, String password)
protected Transport
createTransport()
Creates a Transport based on this object's connection settings.int
getAuditDepth()
int
getAuditMaximumProducerNumber()
BlobTransferPolicy
getBlobTransferPolicy()
String
getBrokerURL()
String
getClientID()
protected IdGenerator
getClientIdGenerator()
String
getClientIDPrefix()
ClientInternalExceptionListener
getClientInternalExceptionListener()
int
getCloseTimeout()
protected IdGenerator
getConnectionIdGenerator()
int
getConnectResponseTimeout()
long
getConsumerFailoverRedeliveryWaitPeriod()
ExceptionListener
getExceptionListener()
int
getMaxThreadPoolSize()
long
getOptimizeAcknowledgeTimeOut()
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.String
getPassword()
ActiveMQPrefetchPolicy
getPrefetchPolicy()
int
getProducerWindowSize()
RedeliveryPolicy
getRedeliveryPolicy()
RedeliveryPolicyMap
getRedeliveryPolicyMap()
RejectedExecutionHandler
getRejectedTaskHandler()
int
getSendTimeout()
TaskRunnerFactory
getSessionTaskRunner()
StatsImpl
getStats()
MessageTransformer
getTransformer()
TransportListener
getTransportListener()
List<String>
getTrustedPackages()
String
getUserName()
long
getWarnAboutUnstartedConnectionTimeout()
boolean
isAlwaysSessionAsync()
boolean
isAlwaysSyncSend()
boolean
isCheckForDuplicates()
boolean
isConsumerExpiryCheckEnabled()
boolean
isCopyMessageOnSend()
boolean
isDisableTimeStampsByDefault()
boolean
isDispatchAsync()
boolean
isExclusiveConsumer()
boolean
isMessagePrioritySupported()
boolean
isNestedMapAndListEnabled()
boolean
isNonBlockingRedelivery()
boolean
isObjectMessageSerializationDefered()
boolean
isOptimizeAcknowledge()
boolean
isOptimizedMessageDispatch()
boolean
isRmIdFromConnectionId()
boolean
isSendAcksAsync()
boolean
isStatsEnabled()
boolean
isTransactedIndividualAck()
boolean
isTrustAllPackages()
boolean
isUseAsyncSend()
boolean
isUseCompression()
boolean
isUseDedicatedTaskRunner()
boolean
isUseRetroactiveConsumer()
boolean
isWatchTopicAdvisories()
void
populateProperties(Properties props)
Initialize the instance from properties stored in JNDIvoid
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.void
setAlwaysSyncSend(boolean alwaysSyncSend)
Set true if always require messages to be sync sentvoid
setAuditDepth(int auditDepth)
void
setAuditMaximumProducerNumber(int auditMaximumProducerNumber)
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 consumersvoid
setBrokerURL(String brokerURL)
Sets the connection URL used to connect to the ActiveMQ broker.void
setCheckForDuplicates(boolean checkForDuplicates)
void
setClientID(String clientID)
Sets the JMS clientID to use for the created connection.protected void
setClientIdGenerator(IdGenerator clientIdGenerator)
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.void
setClientInternalExceptionListener(ClientInternalExceptionListener clientInternalExceptionListener)
Allows anClientInternalExceptionListener
to 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.void
setCloseTimeout(int closeTimeout)
Sets the timeout before a close is considered complete.protected void
setConnectionIdGenerator(IdGenerator connectionIdGenerator)
void
setConnectionIDPrefix(String connectionIDPrefix)
Sets the prefix used by connection id generatorvoid
setConnectResponseTimeout(int connectResponseTimeout)
void
setConsumerExpiryCheckEnabled(boolean consumerExpiryCheckEnabled)
Controls whether message expiration checking is done in each MessageConsumer prior to dispatching a message.void
setConsumerFailoverRedeliveryWaitPeriod(long consumerFailoverRedeliveryWaitPeriod)
void
setCopyMessageOnSend(boolean copyMessageOnSend)
Should a JMS message be copied to a new JMS Message object as part of the send() method in JMS.void
setDisableTimeStampsByDefault(boolean disableTimeStampsByDefault)
Sets whether or not timestamps on messages should be disabled or not.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.void
setExceptionListener(ExceptionListener exceptionListener)
Allows anExceptionListener
to 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.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 Groupsvoid
setMaxThreadPoolSize(int maxThreadPoolSize)
void
setMessagePrioritySupported(boolean messagePrioritySupported)
void
setNestedMapAndListEnabled(boolean structuredMapsEnabled)
Enables/disables whether or not Message properties and MapMessage entries support Nested Structures of Map and List objectsvoid
setNonBlockingRedelivery(boolean nonBlockingRedelivery)
When true a MessageConsumer will not stop Message delivery before re-delivering Messages from a rolled back transaction.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.void
setOptimizeAcknowledge(boolean optimizeAcknowledge)
void
setOptimizeAcknowledgeTimeOut(long optimizeAcknowledgeTimeOut)
The max time in milliseconds between optimized ack batchesvoid
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.void
setOptimizedMessageDispatch(boolean optimizedMessageDispatch)
If this flag is set then an larger prefetch limit is used - only applicable for durable topic subscribers.void
setPassword(String password)
Sets the JMS password used for connections created from this factoryvoid
setPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy)
Sets the prefetch policy for consumers created by this connection.void
setProducerWindowSize(int producerWindowSize)
void
setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
Sets the global default redelivery policy to be used when a message is delivered but the session is rolled backvoid
setRedeliveryPolicyMap(RedeliveryPolicyMap redeliveryPolicyMap)
Sets the global redelivery policy mapping to be used when a message is delivered but the session is rolled backvoid
setRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler)
void
setRmIdFromConnectionId(boolean rmIdFromConnectionId)
uses the connection id as the resource identity for XAResource.isSameRM ensuring join will only occur on a single connectionvoid
setSendAcksAsync(boolean sendAcksAsync)
void
setSendTimeout(int sendTimeout)
void
setSessionTaskRunner(TaskRunnerFactory sessionTaskRunner)
void
setStatsEnabled(boolean statsEnabled)
void
setTransactedIndividualAck(boolean transactedIndividualAck)
when true, submit individual transacted acks immediately rather than with transaction completion.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 clientvoid
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.void
setTrustAllPackages(boolean trustAllPackages)
void
setTrustedPackages(List<String> trustedPackages)
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.void
setUseCompression(boolean useCompression)
Enables the use of compression of the message bodiesvoid
setUseDedicatedTaskRunner(boolean useDedicatedTaskRunner)
void
setUseRetroactiveConsumer(boolean useRetroactiveConsumer)
Sets whether or not retroactive consumers are enabled.void
setUserName(String userName)
Sets the JMS userName used by connections created by this factoryvoid
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.void
setWatchTopicAdvisories(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:
createConnection
in interfaceConnectionFactory
- Returns:
- Returns the Connection.
- Throws:
JMSException
-
createConnection
public Connection createConnection(String userName, String password) throws JMSException
- Specified by:
createConnection
in interfaceConnectionFactory
- Returns:
- Returns the Connection.
- Throws:
JMSException
-
createQueueConnection
public QueueConnection createQueueConnection() throws JMSException
- Specified by:
createQueueConnection
in interfaceQueueConnectionFactory
- Returns:
- Returns the QueueConnection.
- Throws:
JMSException
-
createQueueConnection
public QueueConnection createQueueConnection(String userName, String password) throws JMSException
- Specified by:
createQueueConnection
in interfaceQueueConnectionFactory
- Returns:
- Returns the QueueConnection.
- Throws:
JMSException
-
createTopicConnection
public TopicConnection createTopicConnection() throws JMSException
- Specified by:
createTopicConnection
in interfaceTopicConnectionFactory
- Returns:
- Returns the TopicConnection.
- Throws:
JMSException
-
createTopicConnection
public TopicConnection createTopicConnection(String userName, String password) throws JMSException
- Specified by:
createTopicConnection
in interfaceTopicConnectionFactory
- Returns:
- Returns the TopicConnection.
- Throws:
JMSException
-
getStats
public StatsImpl getStats()
- Specified by:
getStats
in 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:JNDIBaseStorable
Set the properties that will represent the instance in JNDI- Specified by:
buildFromProperties
in classJNDIBaseStorable
-
populateProperties
public void populateProperties(Properties props)
Description copied from class:JNDIBaseStorable
Initialize the instance from properties stored in JNDI- Specified by:
populateProperties
in 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 anExceptionListener
to 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 anClientInternalExceptionListener
to 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)
-
-