public class ActiveMQConnectionFactory extends JNDIBaseStorable implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, StatsCapable, Cloneable
ConnectionFactory
,
Serialized FormModifier and Type | Field and 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 and Description |
---|
ActiveMQConnectionFactory() |
ActiveMQConnectionFactory(String brokerURL) |
ActiveMQConnectionFactory(String userName,
String password,
String brokerURL) |
ActiveMQConnectionFactory(String userName,
String password,
URI brokerURL) |
ActiveMQConnectionFactory(URI brokerURL) |
Modifier and Type | Method and Description |
---|---|
boolean |
buildFromMap(Map<String,Object> properties) |
void |
buildFromProperties(Properties properties)
Set the properties that will represent the instance in JNDI
|
protected void |
configureConnection(ActiveMQConnection connection) |
ActiveMQConnectionFactory |
copy()
Returns a copy of the given connection factory
|
protected 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() |
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() |
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 |
isUseAsyncSend() |
boolean |
isUseCompression() |
boolean |
isUseDedicatedTaskRunner() |
boolean |
isUseRetroactiveConsumer() |
boolean |
isWatchTopicAdvisories() |
void |
populateProperties(Properties props)
Initialize the instance from properties stored in JNDI
|
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.
|
void |
setAlwaysSyncSend(boolean alwaysSyncSend)
Set true if always require messages to be sync sent
|
void |
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 consumers
|
void |
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 an
ClientInternalExceptionListener 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 generator
|
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 an
ExceptionListener 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 Groups
|
void |
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 objects
|
void |
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 batches
|
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.
|
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 factory
|
void |
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 back
|
void |
setRedeliveryPolicyMap(RedeliveryPolicyMap redeliveryPolicyMap)
Sets the global redelivery policy mapping to be used when a message is delivered
but the session is rolled back
|
void |
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 connection
|
void |
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 client
|
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.
|
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 bodies
|
void |
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 factory
|
void |
setWarnAboutUnstartedConnectionTimeout(long warnAboutUnstartedConnectionTimeout)
Enables the timeout from a connection creation to when a warning is
generated if the connection is not properly started via
Connection.start() and a message is received by a consumer. |
void |
setWatchTopicAdvisories(boolean watchTopicAdvisories) |
getProperties, getReference, readExternal, setProperties, writeExternal
public static final String DEFAULT_BROKER_BIND_URL
public static final String DEFAULT_BROKER_URL
public static final String DEFAULT_USER
public static final String DEFAULT_PASSWORD
public static final int DEFAULT_PRODUCER_WINDOW_SIZE
protected boolean dispatchAsync
protected boolean alwaysSessionAsync
protected int xaAckMode
public ActiveMQConnectionFactory()
public ActiveMQConnectionFactory(String brokerURL)
public ActiveMQConnectionFactory(URI brokerURL)
public ActiveMQConnectionFactory(String userName, String password, URI brokerURL)
public ActiveMQConnectionFactory(String userName, String password, String brokerURL)
public ActiveMQConnectionFactory copy()
public Connection createConnection() throws JMSException
createConnection
in interface ConnectionFactory
JMSException
public Connection createConnection(String userName, String password) throws JMSException
createConnection
in interface ConnectionFactory
JMSException
public QueueConnection createQueueConnection() throws JMSException
createQueueConnection
in interface QueueConnectionFactory
JMSException
public QueueConnection createQueueConnection(String userName, String password) throws JMSException
createQueueConnection
in interface QueueConnectionFactory
JMSException
public TopicConnection createTopicConnection() throws JMSException
createTopicConnection
in interface TopicConnectionFactory
JMSException
public TopicConnection createTopicConnection(String userName, String password) throws JMSException
createTopicConnection
in interface TopicConnectionFactory
JMSException
public StatsImpl getStats()
getStats
in interface StatsCapable
protected ActiveMQConnection createActiveMQConnection() throws JMSException
JMSException
protected Transport createTransport() throws JMSException
JMSException
- If unable to create trasnport.protected ActiveMQConnection createActiveMQConnection(String userName, String password) throws JMSException
JMSException
protected ActiveMQConnection createActiveMQConnection(Transport transport, JMSStatsImpl stats) throws Exception
Exception
protected void configureConnection(ActiveMQConnection connection) throws JMSException
JMSException
public String getBrokerURL()
public void setBrokerURL(String brokerURL)
public String getClientID()
public void setClientID(String clientID)
public boolean isCopyMessageOnSend()
public void setCopyMessageOnSend(boolean copyMessageOnSend)
public boolean isDisableTimeStampsByDefault()
public void setDisableTimeStampsByDefault(boolean disableTimeStampsByDefault)
public boolean isOptimizedMessageDispatch()
public void setOptimizedMessageDispatch(boolean optimizedMessageDispatch)
public String getPassword()
public void setPassword(String password)
public ActiveMQPrefetchPolicy getPrefetchPolicy()
public void setPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy)
public boolean isUseAsyncSend()
public BlobTransferPolicy getBlobTransferPolicy()
public void setBlobTransferPolicy(BlobTransferPolicy blobTransferPolicy)
public void setUseAsyncSend(boolean useAsyncSend)
public boolean isWatchTopicAdvisories()
public void setWatchTopicAdvisories(boolean watchTopicAdvisories)
public boolean isAlwaysSyncSend()
public void setAlwaysSyncSend(boolean alwaysSyncSend)
alwaysSyncSend
- public String getUserName()
public void setUserName(String userName)
public boolean isUseRetroactiveConsumer()
public void setUseRetroactiveConsumer(boolean useRetroactiveConsumer)
public boolean isExclusiveConsumer()
public void setExclusiveConsumer(boolean exclusiveConsumer)
exclusiveConsumer
- public RedeliveryPolicy getRedeliveryPolicy()
public void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
public RedeliveryPolicyMap getRedeliveryPolicyMap()
public void setRedeliveryPolicyMap(RedeliveryPolicyMap redeliveryPolicyMap)
public MessageTransformer getTransformer()
public int getSendTimeout()
public void setSendTimeout(int sendTimeout)
sendTimeout
- the sendTimeout to set (in milliseconds)public boolean isSendAcksAsync()
public void setSendAcksAsync(boolean sendAcksAsync)
sendAcksAsync
- the sendAcksAsync to setpublic boolean isMessagePrioritySupported()
public void setMessagePrioritySupported(boolean messagePrioritySupported)
messagePrioritySupported
- the messagePrioritySupported to setpublic void setTransformer(MessageTransformer transformer)
public void buildFromProperties(Properties properties)
JNDIBaseStorable
buildFromProperties
in class JNDIBaseStorable
public boolean buildFromMap(Map<String,Object> properties)
public void populateProperties(Properties props)
JNDIBaseStorable
populateProperties
in class JNDIBaseStorable
public boolean isUseCompression()
public void setUseCompression(boolean useCompression)
public boolean isObjectMessageSerializationDefered()
public void setObjectMessageSerializationDefered(boolean objectMessageSerializationDefered)
public boolean isDispatchAsync()
public void setDispatchAsync(boolean asyncDispatch)
asyncDispatch
- If true then consumers created on this connection
will default to having their messages dispatched
asynchronously. The default value is true.public int getCloseTimeout()
public void setCloseTimeout(int closeTimeout)
public boolean isAlwaysSessionAsync()
public void setAlwaysSessionAsync(boolean alwaysSessionAsync)
public boolean isOptimizeAcknowledge()
public void setOptimizeAcknowledge(boolean optimizeAcknowledge)
optimizeAcknowledge
- The optimizeAcknowledge to set.public void setOptimizeAcknowledgeTimeOut(long optimizeAcknowledgeTimeOut)
optimizeAcknowledgeTimeOut
- public long getOptimizeAcknowledgeTimeOut()
public boolean isNestedMapAndListEnabled()
public void setNestedMapAndListEnabled(boolean structuredMapsEnabled)
public String getClientIDPrefix()
public void setClientIDPrefix(String clientIDPrefix)
clientIDPrefix
- protected IdGenerator getClientIdGenerator()
protected void setClientIdGenerator(IdGenerator clientIdGenerator)
public void setConnectionIDPrefix(String connectionIDPrefix)
connectionIDPrefix
- protected IdGenerator getConnectionIdGenerator()
protected void setConnectionIdGenerator(IdGenerator connectionIdGenerator)
public boolean isStatsEnabled()
public void setStatsEnabled(boolean statsEnabled)
statsEnabled
- the statsEnabled to setpublic int getProducerWindowSize()
public void setProducerWindowSize(int producerWindowSize)
public long getWarnAboutUnstartedConnectionTimeout()
public void setWarnAboutUnstartedConnectionTimeout(long warnAboutUnstartedConnectionTimeout)
Connection.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).public TransportListener getTransportListener()
public void setTransportListener(TransportListener transportListener)
transportListener
- sets the listener to be registered on all connections
created by this factorypublic ExceptionListener getExceptionListener()
public void setExceptionListener(ExceptionListener exceptionListener)
ExceptionListener
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)
exceptionListener
- sets the exception listener to be registered on all connections
created by this factorypublic int getAuditDepth()
public void setAuditDepth(int auditDepth)
public int getAuditMaximumProducerNumber()
public void setAuditMaximumProducerNumber(int auditMaximumProducerNumber)
public void setUseDedicatedTaskRunner(boolean useDedicatedTaskRunner)
public boolean isUseDedicatedTaskRunner()
public void setConsumerFailoverRedeliveryWaitPeriod(long consumerFailoverRedeliveryWaitPeriod)
public long getConsumerFailoverRedeliveryWaitPeriod()
public ClientInternalExceptionListener getClientInternalExceptionListener()
public void setClientInternalExceptionListener(ClientInternalExceptionListener clientInternalExceptionListener)
ClientInternalExceptionListener
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)
clientInternalExceptionListener
- sets the exception listener to be registered on all connections
created by this factorypublic boolean isCheckForDuplicates()
public void setCheckForDuplicates(boolean checkForDuplicates)
checkForDuplicates
- the checkForDuplicates to setpublic boolean isTransactedIndividualAck()
public void setTransactedIndividualAck(boolean transactedIndividualAck)
public boolean isNonBlockingRedelivery()
public void setNonBlockingRedelivery(boolean nonBlockingRedelivery)
public int getMaxThreadPoolSize()
public void setMaxThreadPoolSize(int maxThreadPoolSize)
public TaskRunnerFactory getSessionTaskRunner()
public void setSessionTaskRunner(TaskRunnerFactory sessionTaskRunner)
public RejectedExecutionHandler getRejectedTaskHandler()
public void setRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler)
public long getOptimizedAckScheduledAckInterval()
public void setOptimizedAckScheduledAckInterval(long optimizedAckScheduledAckInterval)
optimizedAckScheduledAckInterval
- the scheduledOptimizedAckInterval to setpublic boolean isRmIdFromConnectionId()
public void setRmIdFromConnectionId(boolean rmIdFromConnectionId)
public boolean isConsumerExpiryCheckEnabled()
public void setConsumerExpiryCheckEnabled(boolean consumerExpiryCheckEnabled)
consumerExpiryCheckEnabled
- controls whether expiration checking is done prior to dispatch.Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.