|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.activemq.jndi.JNDIBaseStorable
org.apache.activemq.ActiveMQConnectionFactory
public class ActiveMQConnectionFactory
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.
ConnectionFactory,
Serialized Form| Field Summary | |
|---|---|
protected boolean |
alwaysSessionAsync
|
protected URI |
brokerURL
|
protected String |
clientID
|
static String |
DEFAULT_BROKER_BIND_URL
|
static String |
DEFAULT_BROKER_URL
|
protected static Executor |
DEFAULT_CONNECTION_EXECUTOR
|
static String |
DEFAULT_PASSWORD
|
static int |
DEFAULT_PRODUCER_WINDOW_SIZE
|
static String |
DEFAULT_USER
|
protected boolean |
dispatchAsync
|
protected String |
password
|
protected String |
userName
|
| Constructor Summary | |
|---|---|
ActiveMQConnectionFactory()
|
|
ActiveMQConnectionFactory(String brokerURL)
|
|
ActiveMQConnectionFactory(String userName,
String password,
String brokerURL)
|
|
ActiveMQConnectionFactory(String userName,
String password,
URI brokerURL)
|
|
ActiveMQConnectionFactory(URI brokerURL)
|
|
| Method Summary | |
|---|---|
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. |
BlobTransferPolicy |
getBlobTransferPolicy()
|
String |
getBrokerURL()
|
String |
getClientID()
|
protected IdGenerator |
getClientIdGenerator()
|
String |
getClientIDPrefix()
|
int |
getCloseTimeout()
|
String |
getPassword()
|
ActiveMQPrefetchPolicy |
getPrefetchPolicy()
|
int |
getProducerWindowSize()
|
RedeliveryPolicy |
getRedeliveryPolicy()
|
int |
getSendTimeout()
|
StatsImpl |
getStats()
|
MessageTransformer |
getTransformer()
|
TransportListener |
getTransportListener()
|
String |
getUserName()
|
long |
getWarnAboutUnstartedConnectionTimeout()
|
boolean |
isAlwaysSessionAsync()
|
boolean |
isAlwaysSyncSend()
|
boolean |
isCopyMessageOnSend()
|
boolean |
isDisableTimeStampsByDefault()
|
boolean |
isDispatchAsync()
|
boolean |
isExclusiveConsumer()
|
boolean |
isNestedMapAndListEnabled()
|
boolean |
isObjectMessageSerializationDefered()
|
boolean |
isOptimizeAcknowledge()
|
boolean |
isOptimizedMessageDispatch()
|
boolean |
isSendAcksAsync()
|
boolean |
isStatsEnabled()
|
boolean |
isUseAsyncSend()
|
boolean |
isUseCompression()
|
boolean |
isUseRetroactiveConsumer()
|
boolean |
isWatchTopicAdvisories()
|
void |
populateProperties(Properties props)
Initialize the instance from properties stored in JNDI |
void |
setAlwaysSessionAsync(boolean alwaysSessionAsync)
If this flag is 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 |
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 |
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 |
setCloseTimeout(int closeTimeout)
Sets the timeout before a close is considered complete. |
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 |
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 |
setNestedMapAndListEnabled(boolean structuredMapsEnabled)
Enables/disables whether or not Message properties and MapMessage entries support Nested Structures of Map and List objects |
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 |
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 redelivery policy to be used when a message is delivered but the session is rolled back |
void |
setSendAcksAsync(boolean sendAcksAsync)
|
void |
setSendTimeout(int sendTimeout)
|
void |
setStatsEnabled(boolean statsEnabled)
|
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 |
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)
|
| Methods inherited from class org.apache.activemq.jndi.JNDIBaseStorable |
|---|
getProperties, getReference, readExternal, setProperties, writeExternal |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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 static final Executor DEFAULT_CONNECTION_EXECUTOR
protected URI brokerURL
protected String userName
protected String password
protected String clientID
protected boolean dispatchAsync
protected boolean alwaysSessionAsync
| Constructor Detail |
|---|
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)
| Method Detail |
|---|
public ActiveMQConnectionFactory copy()
public Connection createConnection()
throws JMSException
createConnection in interface ConnectionFactoryJMSException
public Connection createConnection(String userName,
String password)
throws JMSException
createConnection in interface ConnectionFactoryJMSException
public QueueConnection createQueueConnection()
throws JMSException
createQueueConnection in interface QueueConnectionFactoryJMSException
public QueueConnection createQueueConnection(String userName,
String password)
throws JMSException
createQueueConnection in interface QueueConnectionFactoryJMSException
public TopicConnection createTopicConnection()
throws JMSException
createTopicConnection in interface TopicConnectionFactoryJMSException
public TopicConnection createTopicConnection(String userName,
String password)
throws JMSException
createTopicConnection in interface TopicConnectionFactoryJMSExceptionpublic 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
Exceptionprotected void configureConnection(ActiveMQConnection connection)
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 MessageTransformer getTransformer()
public int getSendTimeout()
public void setSendTimeout(int sendTimeout)
sendTimeout - the sendTimeout to setpublic boolean isSendAcksAsync()
public void setSendAcksAsync(boolean sendAcksAsync)
sendAcksAsync - the sendAcksAsync to setpublic void setTransformer(MessageTransformer transformer)
public void buildFromProperties(Properties properties)
JNDIBaseStorable
buildFromProperties in class JNDIBaseStorablepublic boolean buildFromMap(Map<String,Object> properties)
public void populateProperties(Properties props)
JNDIBaseStorable
populateProperties in class JNDIBaseStorablepublic 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 false.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 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 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 factory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||