|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.activemq.jndi.JNDIBaseStorable
org.codehaus.activemq.ActiveMQConnectionFactory
A ConnectionFactory is an an Administed object, and is used for creating Connections.
This class also implements QueueConnectionFactory and TopicConnectionFactory and is an Administered object. You can use this connection to create both QueueConnections and TopicConnections.
ConnectionFactory
Field Summary | |
protected BrokerContainer |
brokerContainer
|
protected String |
brokerName
|
protected String |
brokerURL
|
protected String |
clientID
|
protected String |
password
|
protected boolean |
useAsyncSend
Should we use an async send for persistent non transacted messages ? |
protected String |
userName
|
Constructor Summary | |
ActiveMQConnectionFactory()
Default Constructor for ActiveMQConnectionFactory |
|
ActiveMQConnectionFactory(BrokerContainer container)
Constructs a ConnectionFactory with an already configured and started BrokerContainer
ready for use in embedded mode. |
|
ActiveMQConnectionFactory(BrokerContainer container,
String brokerURL)
Constructs a ConnectionFactory with an already configured and started BrokerContainer
ready for use in embedded mode and the brokerURL connection. |
|
ActiveMQConnectionFactory(String brokerURL)
|
|
ActiveMQConnectionFactory(String userName,
String password,
String brokerURL)
|
Method Summary | |
protected void |
buildFromProperties(Properties props)
Set the properties that will represent the instance in JNDI |
protected BrokerConnector |
createBrokerConnector(String url)
|
protected BrokerContainerFactory |
createBrokerContainerFactory()
|
Connection |
createConnection()
Create a JMS Connection |
Connection |
createConnection(String userName,
String password)
|
protected String |
createMulticastClientID()
Creates the clientID for the multicast client (used to dispatch local messages over a multicast bus) |
QueueConnection |
createQueueConnection()
Create a JMS QueueConnection |
QueueConnection |
createQueueConnection(String userName,
String password)
|
TopicConnection |
createTopicConnection()
Create a JMS TopicConnection |
TopicConnection |
createTopicConnection(String userName,
String password)
|
protected TransportChannel |
createTransportChannel(String theURLString)
Factory method to create a TransportChannel from a URL |
protected URI |
createURI(String uri)
|
protected URI |
createURI(String protocol,
URI uri)
|
protected TransportChannel |
ensureMulticastChannelIsAvailable(URI remoteLocation,
TransportChannel channel,
BrokerConnector brokerConnector,
boolean created)
|
protected TransportChannel |
ensureServerIsAvailable(URI remoteLocation,
TransportChannel channel,
BrokerConnector brokerConnector,
boolean created)
|
protected boolean |
getBoolean(Properties props,
String key)
Helper method to return the property value as a boolean flag |
protected boolean |
getBoolean(Properties props,
String key,
boolean defaultValue)
Helper method to return the property value as a boolean flag |
BrokerContainer |
getBrokerContainer()
|
BrokerContainerFactory |
getBrokerContainerFactory()
|
BrokerContext |
getBrokerContext()
Returns the context used to store broker containers and connectors which defaults to using the singleton |
String |
getBrokerName()
The name of the broker to use if creating an embedded broker |
String |
getBrokerURL()
|
String |
getBrokerXmlConfig()
|
String |
getClientID()
|
protected BrokerContainer |
getContainer(String brokerName)
|
Broker |
getEmbeddedBroker()
|
JMSStatsImpl |
getFactoryStats()
|
String |
getPassword()
|
Stats |
getStats()
|
String |
getUserName()
|
WireFormat |
getWireFormat()
|
boolean |
isUseAsyncSend()
|
boolean |
isUseEmbeddedBroker()
Is an embedded broker used by this connection factory |
(package private) void |
onConnectionClose(ActiveMQConnection connection)
Called when a connection is closed so that we can shut down any embedded brokers cleanly |
(package private) void |
onConnectionCreate(ActiveMQConnection connection)
|
protected void |
populateProperties(Properties props)
Initialize the instance from properties stored in JNDI |
static void |
registerBroker(String theURLString,
BrokerConnector brokerConnector)
|
void |
setBrokerContainerFactory(BrokerContainerFactory brokerContainerFactory)
|
void |
setBrokerContext(BrokerContext brokerContext)
|
void |
setBrokerName(String brokerName)
|
void |
setBrokerURL(String brokerURL)
|
void |
setBrokerXmlConfig(String brokerXmlConfig)
Sets the XML configuration file used to configure the ActiveMQ broker via Spring if using embedded mode. |
void |
setClientID(String clientID)
|
void |
setPassword(String password)
|
void |
setUseAsyncSend(boolean useAsyncSend)
|
void |
setUseEmbeddedBroker(boolean useEmbeddedBroker)
Allows embedded brokers to be associated with a connection factory |
void |
setUserName(String userName)
|
void |
setWireFormat(WireFormat wireFormat)
Allows a custom wire format to be used; otherwise the default Java wire format is used which is designed for minimum size and maximum speed on the Java platform |
void |
start()
Called to start the service |
void |
stop()
A hook to allow any embedded JMS Broker's to be closed down |
static void |
unregisterBroker(String theURLString)
|
Methods inherited from class org.codehaus.activemq.jndi.JNDIBaseStorable |
getProperties, getReference, setProperties |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected BrokerContainer brokerContainer
protected String userName
protected String password
protected String brokerURL
protected String clientID
protected String brokerName
protected boolean useAsyncSend
Constructor Detail |
public ActiveMQConnectionFactory()
public ActiveMQConnectionFactory(String brokerURL)
public ActiveMQConnectionFactory(String userName, String password, String brokerURL)
public ActiveMQConnectionFactory(BrokerContainer container)
ConnectionFactory
with an already configured and started BrokerContainer
ready for use in embedded mode.
container
- public ActiveMQConnectionFactory(BrokerContainer container, String brokerURL)
ConnectionFactory
with an already configured and started BrokerContainer
ready for use in embedded mode and the brokerURL connection.
container
- Method Detail |
public Stats getStats()
getStats
in interface StatsCapable
public JMSStatsImpl getFactoryStats()
public String getBrokerURL()
public void setBrokerURL(String brokerURL)
brokerURL
- The brokerURL to set.public String getClientID()
public void setClientID(String clientID)
clientID
- The clientID to set.public String getPassword()
public void setPassword(String password)
password
- The password to set.public String getUserName()
public void setUserName(String userName)
userName
- The userName to set.public boolean isUseEmbeddedBroker()
public void setUseEmbeddedBroker(boolean useEmbeddedBroker)
useEmbeddedBroker
- public String getBrokerName()
public void setBrokerName(String brokerName)
public boolean isUseAsyncSend()
public void setUseAsyncSend(boolean useAsyncSend)
useAsyncSend
- The useAsyncSend to set.public WireFormat getWireFormat()
public void setWireFormat(WireFormat wireFormat)
wireFormat
- public String getBrokerXmlConfig()
public BrokerContainer getBrokerContainer()
public void setBrokerXmlConfig(String brokerXmlConfig)
brokerXmlConfig
- is the filename which is assumed to be on the classpath unless a URL
is specified. So a value of foo/bar.xml
would be assumed to be on the classpath
whereas file:dir/file.xml
would use the file system.
Any valid URL string is supported.setUseEmbeddedBroker(boolean)
public BrokerContainerFactory getBrokerContainerFactory() throws JMSException
JMSException
public void setBrokerContainerFactory(BrokerContainerFactory brokerContainerFactory)
public BrokerContext getBrokerContext()
public void setBrokerContext(BrokerContext brokerContext)
public Connection createConnection() throws JMSException
createConnection
in interface ConnectionFactory
JMSException
- if an error occurs creating the Connectionpublic Connection createConnection(String userName, String password) throws JMSException
createConnection
in interface ConnectionFactory
userName
- password
-
JMSException
- if an error occurs creating the Connectionpublic QueueConnection createQueueConnection() throws JMSException
createQueueConnection
in interface QueueConnectionFactory
JMSException
- if an error occurs creating the Connectionpublic QueueConnection createQueueConnection(String userName, String password) throws JMSException
createQueueConnection
in interface QueueConnectionFactory
userName
- password
-
JMSException
- if an error occurs creating the Connectionpublic TopicConnection createTopicConnection() throws JMSException
createTopicConnection
in interface TopicConnectionFactory
JMSException
- if an error occurs creating the Connectionpublic TopicConnection createTopicConnection(String userName, String password) throws JMSException
createTopicConnection
in interface TopicConnectionFactory
userName
- password
-
JMSException
- if an error occurs creating the Connectionpublic void start() throws JMSException
Service
start
in interface Service
JMSException
public void stop() throws JMSException
stop
in interface Service
JMSException
public Broker getEmbeddedBroker() throws JMSException
JMSException
public static void registerBroker(String theURLString, BrokerConnector brokerConnector)
public static void unregisterBroker(String theURLString)
protected void buildFromProperties(Properties props)
buildFromProperties
in class JNDIBaseStorable
props
- protected void populateProperties(Properties props)
populateProperties
in class JNDIBaseStorable
props
- protected boolean getBoolean(Properties props, String key)
props
- key
-
protected boolean getBoolean(Properties props, String key, boolean defaultValue)
props
- key
- defaultValue
-
protected BrokerContainerFactory createBrokerContainerFactory() throws JMSException
JMSException
protected TransportChannel createTransportChannel(String theURLString) throws JMSException
JMSException
protected BrokerContainer getContainer(String brokerName) throws JMSException
JMSException
protected BrokerConnector createBrokerConnector(String url) throws JMSException
JMSException
protected TransportChannel ensureServerIsAvailable(URI remoteLocation, TransportChannel channel, BrokerConnector brokerConnector, boolean created) throws JMSException
JMSException
protected TransportChannel ensureMulticastChannelIsAvailable(URI remoteLocation, TransportChannel channel, BrokerConnector brokerConnector, boolean created) throws JMSException
JMSException
protected String createMulticastClientID()
protected URI createURI(String protocol, URI uri) throws JMSException
JMSException
protected URI createURI(String uri) throws JMSException
JMSException
void onConnectionClose(ActiveMQConnection connection) throws JMSException
connection
-
JMSException
void onConnectionCreate(ActiveMQConnection connection)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |