Package org.apache.activemq.network.jms
Class JmsConnector
java.lang.Object
org.apache.activemq.network.jms.JmsConnector
- All Implemented Interfaces:
org.apache.activemq.Service
- Direct Known Subclasses:
SimpleJmsQueueConnector,SimpleJmsTopicConnector
This bridge joins the gap between foreign JMS providers and ActiveMQ As some
JMS providers are still only in compliance with JMS v1.0.1 , this bridge itself
aimed to be in compliance with the JMS 1.0.2 specification.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ThreadPoolExecutorprotected org.apache.activemq.ActiveMQConnectionFactoryprotected AtomicBooleanprotected AtomicReference<jakarta.jms.Connection>protected AtomicBooleanprotected JmsMesageConvertorprotected AtomicBooleanprotected JndiLookupFactoryprotected JndiLookupFactoryprotected Stringprotected AtomicReference<jakarta.jms.Connection>protected Stringprotected AtomicBooleanprotected Stringprotected Stringprotected JmsMesageConvertorprotected Stringprotected Stringprotected booleanprotected org.apache.activemq.util.LRUCache<jakarta.jms.Destination,DestinationBridge> protected intprotected AtomicBoolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddInboundBridge(DestinationBridge bridge) protected voidaddOutboundBridge(DestinationBridge bridge) voidprotected abstract jakarta.jms.DestinationcreateReplyToBridge(jakarta.jms.Destination destination, jakarta.jms.Connection consumerConnection, jakarta.jms.Connection producerConnection) protected booleanjakarta.jms.Connectionjakarta.jms.ConnectiongetName()intbooleaninit()protected abstract voidPerforms the work of connection to the foreign side of the Connection.protected abstract voidPerforms the work of connection to the local side of the Connection.booleanbooleanisFailed()booleanprotected voidremoveInboundBridge(DestinationBridge bridge) protected voidvoidsetBrokerService(BrokerService service) One way to configure the local connection - this is called by The BrokerService when the Connector is embeddedvoidsetInboundMessageConvertor(JmsMesageConvertor jmsMessageConvertor) voidsetJndiLocalTemplate(JndiLookupFactory jndiTemplate) voidsetJndiOutboundTemplate(JndiLookupFactory jndiOutboundTemplate) voidsetLocalClientId(String localClientId) voidsetLocalPassword(String localPassword) voidsetLocalUsername(String localUsername) voidvoidsetOutboundClientId(String outboundClientId) voidsetOutboundMessageConvertor(JmsMesageConvertor outboundMessageConvertor) voidsetOutboundPassword(String outboundPassword) voidsetOutboundUsername(String outboundUsername) voidsetPreferJndiDestinationLookup(boolean preferJndiDestinationLookup) Sets whether the connector should prefer to first try to find a destination in JNDI before using JMS semantics to create a Destination.voidvoidsetReplyToDestinationCacheSize(int replyToDestinationCacheSize) voidstart()voidstop()
-
Field Details
-
preferJndiDestinationLookup
protected boolean preferJndiDestinationLookup -
jndiLocalTemplate
-
jndiOutboundTemplate
-
inboundMessageConvertor
-
outboundMessageConvertor
-
initialized
-
localSideInitialized
-
foreignSideInitialized
-
started
-
failed
-
foreignConnection
-
localConnection
-
embeddedConnectionFactory
protected org.apache.activemq.ActiveMQConnectionFactory embeddedConnectionFactory -
replyToDestinationCacheSize
protected int replyToDestinationCacheSize -
outboundUsername
-
outboundPassword
-
localUsername
-
localPassword
-
outboundClientId
-
localClientId
-
replyToBridges
protected org.apache.activemq.util.LRUCache<jakarta.jms.Destination,DestinationBridge> replyToBridges -
connectionService
-
-
Constructor Details
-
JmsConnector
public JmsConnector()
-
-
Method Details
-
init
public boolean init() -
doConnectorInit
protected boolean doConnectorInit() -
start
- Specified by:
startin interfaceorg.apache.activemq.Service- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.apache.activemq.Service- Throws:
Exception
-
clearBridges
public void clearBridges() -
createReplyToBridge
protected abstract jakarta.jms.Destination createReplyToBridge(jakarta.jms.Destination destination, jakarta.jms.Connection consumerConnection, jakarta.jms.Connection producerConnection) -
setBrokerService
One way to configure the local connection - this is called by The BrokerService when the Connector is embedded- Parameters:
service-
-
getLocalConnection
public jakarta.jms.Connection getLocalConnection() -
getForeignConnection
public jakarta.jms.Connection getForeignConnection() -
getJndiLocalTemplate
- Returns:
- Returns the jndiTemplate.
-
setJndiLocalTemplate
- Parameters:
jndiTemplate- The jndiTemplate to set.
-
getJndiOutboundTemplate
- Returns:
- Returns the jndiOutboundTemplate.
-
setJndiOutboundTemplate
- Parameters:
jndiOutboundTemplate- The jndiOutboundTemplate to set.
-
getInboundMessageConvertor
- Returns:
- Returns the inboundMessageConvertor.
-
setInboundMessageConvertor
- Parameters:
jmsMessageConvertor- The jmsMessageConvertor to set.
-
getOutboundMessageConvertor
- Returns:
- Returns the outboundMessageConvertor.
-
setOutboundMessageConvertor
- Parameters:
outboundMessageConvertor- The outboundMessageConvertor to set.
-
getReplyToDestinationCacheSize
public int getReplyToDestinationCacheSize()- Returns:
- Returns the replyToDestinationCacheSize.
-
setReplyToDestinationCacheSize
public void setReplyToDestinationCacheSize(int replyToDestinationCacheSize) - Parameters:
replyToDestinationCacheSize- The replyToDestinationCacheSize to set.
-
getLocalPassword
- Returns:
- Returns the localPassword.
-
setLocalPassword
- Parameters:
localPassword- The localPassword to set.
-
getLocalUsername
- Returns:
- Returns the localUsername.
-
setLocalUsername
- Parameters:
localUsername- The localUsername to set.
-
getOutboundPassword
- Returns:
- Returns the outboundPassword.
-
setOutboundPassword
- Parameters:
outboundPassword- The outboundPassword to set.
-
getOutboundUsername
- Returns:
- Returns the outboundUsername.
-
setOutboundUsername
- Parameters:
outboundUsername- The outboundUsername to set.
-
getOutboundClientId
- Returns:
- the outboundClientId
-
setOutboundClientId
- Parameters:
outboundClientId- the outboundClientId to set
-
getLocalClientId
- Returns:
- the localClientId
-
setLocalClientId
- Parameters:
localClientId- the localClientId to set
-
getReconnectionPolicy
- Returns:
- the currently configured reconnection policy.
-
setReconnectionPolicy
- Parameters:
policy- The new reconnection policy thisJmsConnectorshould use.
-
isPreferJndiDestinationLookup
public boolean isPreferJndiDestinationLookup()- Returns:
- the preferJndiDestinationLookup
-
setPreferJndiDestinationLookup
public void setPreferJndiDestinationLookup(boolean preferJndiDestinationLookup) Sets whether the connector should prefer to first try to find a destination in JNDI before using JMS semantics to create a Destination. By default the connector will first use JMS semantics and then fall-back to JNDI lookup, setting this value to true will reverse that ordering.- Parameters:
preferJndiDestinationLookup- the preferJndiDestinationLookup to set
-
isConnected
public boolean isConnected()- Returns:
- returns true if the
JmsConnectoris connected to both brokers.
-
addInboundBridge
-
addOutboundBridge
-
removeInboundBridge
-
removeOutboundBridge
-
getName
-
setName
-
isFailed
public boolean isFailed() -
initializeLocalConnection
Performs the work of connection to the local side of the Connection.This creates the initial connection to the local end of the
JmsConnectorand then sets up all the destination bridges with the information needed to bridge on the local side of the connection.- Throws:
Exception- if the connection cannot be established for any reason.
-
initializeForeignConnection
Performs the work of connection to the foreign side of the Connection.This creates the initial connection to the foreign end of the
JmsConnectorand then sets up all the destination bridges with the information needed to bridge on the foreign side of the connection.- Throws:
Exception- if the connection cannot be established for any reason.
-