org.apache.activemq.network.jms
Class JmsConnector

java.lang.Object
  extended by org.apache.activemq.network.jms.JmsConnector
All Implemented Interfaces:
Service
Direct Known Subclasses:
JmsQueueConnector, JmsTopicConnector

public abstract class JmsConnector
extends java.lang.Object
implements Service

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
protected  java.util.concurrent.ThreadPoolExecutor connectionSerivce
           
protected  ActiveMQConnectionFactory embeddedConnectionFactory
           
protected  java.util.concurrent.atomic.AtomicBoolean failed
           
protected  java.util.concurrent.atomic.AtomicReference<javax.jms.Connection> foreignConnection
           
protected  java.util.concurrent.atomic.AtomicBoolean foreignSideInitialized
           
protected  JmsMesageConvertor inboundMessageConvertor
           
protected  java.util.concurrent.atomic.AtomicBoolean initialized
           
protected  org.springframework.jndi.JndiTemplate jndiLocalTemplate
           
protected  org.springframework.jndi.JndiTemplate jndiOutboundTemplate
           
protected  java.lang.String localClientId
           
protected  java.util.concurrent.atomic.AtomicReference<javax.jms.Connection> localConnection
           
protected  java.lang.String localPassword
           
protected  java.util.concurrent.atomic.AtomicBoolean localSideInitialized
           
protected  java.lang.String localUsername
           
protected  java.lang.String outboundClientId
           
protected  JmsMesageConvertor outboundMessageConvertor
           
protected  java.lang.String outboundPassword
           
protected  java.lang.String outboundUsername
           
protected  LRUCache<javax.jms.Destination,DestinationBridge> replyToBridges
           
protected  int replyToDestinationCacheSize
           
protected  java.util.concurrent.atomic.AtomicBoolean started
           
 
Constructor Summary
JmsConnector()
           
 
Method Summary
protected  void addInboundBridge(DestinationBridge bridge)
           
protected  void addOutboundBridge(DestinationBridge bridge)
           
 void clearBridges()
           
protected abstract  javax.jms.Destination createReplyToBridge(javax.jms.Destination destination, javax.jms.Connection consumerConnection, javax.jms.Connection producerConnection)
           
protected  boolean doConnectorInit()
           
 javax.jms.Connection getForeignConnection()
           
 JmsMesageConvertor getInboundMessageConvertor()
           
 org.springframework.jndi.JndiTemplate getJndiLocalTemplate()
           
 org.springframework.jndi.JndiTemplate getJndiOutboundTemplate()
           
 java.lang.String getLocalClientId()
           
 javax.jms.Connection getLocalConnection()
           
 java.lang.String getLocalPassword()
           
 java.lang.String getLocalUsername()
           
 java.lang.String getName()
           
 java.lang.String getOutboundClientId()
           
 JmsMesageConvertor getOutboundMessageConvertor()
           
 java.lang.String getOutboundPassword()
           
 java.lang.String getOutboundUsername()
           
 ReconnectionPolicy getReconnectionPolicy()
           
 int getReplyToDestinationCacheSize()
           
 boolean init()
           
protected abstract  void initializeForeignConnection()
          Performs the work of connection to the foreign side of the Connection.
protected abstract  void initializeLocalConnection()
          Performs the work of connection to the local side of the Connection.
 boolean isConnected()
           
 boolean isFailed()
           
protected  void removeInboundBridge(DestinationBridge bridge)
           
protected  void removeOutboundBridge(DestinationBridge bridge)
           
 void setBrokerService(BrokerService service)
          One way to configure the local connection - this is called by The BrokerService when the Connector is embedded
 void setInboundMessageConvertor(JmsMesageConvertor jmsMessageConvertor)
           
 void setJndiLocalTemplate(org.springframework.jndi.JndiTemplate jndiTemplate)
           
 void setJndiOutboundTemplate(org.springframework.jndi.JndiTemplate jndiOutboundTemplate)
           
 void setLocalClientId(java.lang.String localClientId)
           
 void setLocalPassword(java.lang.String localPassword)
           
 void setLocalUsername(java.lang.String localUsername)
           
 void setName(java.lang.String name)
           
 void setOutboundClientId(java.lang.String outboundClientId)
           
 void setOutboundMessageConvertor(JmsMesageConvertor outboundMessageConvertor)
           
 void setOutboundPassword(java.lang.String outboundPassword)
           
 void setOutboundUsername(java.lang.String outboundUsername)
           
 void setReconnectionPolicy(ReconnectionPolicy policy)
           
 void setReplyToDestinationCacheSize(int replyToDestinationCacheSize)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jndiLocalTemplate

protected org.springframework.jndi.JndiTemplate jndiLocalTemplate

jndiOutboundTemplate

protected org.springframework.jndi.JndiTemplate jndiOutboundTemplate

inboundMessageConvertor

protected JmsMesageConvertor inboundMessageConvertor

outboundMessageConvertor

protected JmsMesageConvertor outboundMessageConvertor

initialized

protected java.util.concurrent.atomic.AtomicBoolean initialized

localSideInitialized

protected java.util.concurrent.atomic.AtomicBoolean localSideInitialized

foreignSideInitialized

protected java.util.concurrent.atomic.AtomicBoolean foreignSideInitialized

started

protected java.util.concurrent.atomic.AtomicBoolean started

failed

protected java.util.concurrent.atomic.AtomicBoolean failed

foreignConnection

protected java.util.concurrent.atomic.AtomicReference<javax.jms.Connection> foreignConnection

localConnection

protected java.util.concurrent.atomic.AtomicReference<javax.jms.Connection> localConnection

embeddedConnectionFactory

protected ActiveMQConnectionFactory embeddedConnectionFactory

replyToDestinationCacheSize

protected int replyToDestinationCacheSize

outboundUsername

protected java.lang.String outboundUsername

outboundPassword

protected java.lang.String outboundPassword

localUsername

protected java.lang.String localUsername

localPassword

protected java.lang.String localPassword

outboundClientId

protected java.lang.String outboundClientId

localClientId

protected java.lang.String localClientId

replyToBridges

protected LRUCache<javax.jms.Destination,DestinationBridge> replyToBridges

connectionSerivce

protected java.util.concurrent.ThreadPoolExecutor connectionSerivce
Constructor Detail

JmsConnector

public JmsConnector()
Method Detail

init

public boolean init()

doConnectorInit

protected boolean doConnectorInit()

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception

clearBridges

public void clearBridges()

createReplyToBridge

protected abstract javax.jms.Destination createReplyToBridge(javax.jms.Destination destination,
                                                             javax.jms.Connection consumerConnection,
                                                             javax.jms.Connection producerConnection)

setBrokerService

public void setBrokerService(BrokerService service)
One way to configure the local connection - this is called by The BrokerService when the Connector is embedded

Parameters:
service -

getLocalConnection

public javax.jms.Connection getLocalConnection()

getForeignConnection

public javax.jms.Connection getForeignConnection()

getJndiLocalTemplate

public org.springframework.jndi.JndiTemplate getJndiLocalTemplate()
Returns:
Returns the jndiTemplate.

setJndiLocalTemplate

public void setJndiLocalTemplate(org.springframework.jndi.JndiTemplate jndiTemplate)
Parameters:
jndiTemplate - The jndiTemplate to set.

getJndiOutboundTemplate

public org.springframework.jndi.JndiTemplate getJndiOutboundTemplate()
Returns:
Returns the jndiOutboundTemplate.

setJndiOutboundTemplate

public void setJndiOutboundTemplate(org.springframework.jndi.JndiTemplate jndiOutboundTemplate)
Parameters:
jndiOutboundTemplate - The jndiOutboundTemplate to set.

getInboundMessageConvertor

public JmsMesageConvertor getInboundMessageConvertor()
Returns:
Returns the inboundMessageConvertor.

setInboundMessageConvertor

public void setInboundMessageConvertor(JmsMesageConvertor jmsMessageConvertor)
Parameters:
inboundMessageConvertor - The inboundMessageConvertor to set.

getOutboundMessageConvertor

public JmsMesageConvertor getOutboundMessageConvertor()
Returns:
Returns the outboundMessageConvertor.

setOutboundMessageConvertor

public void setOutboundMessageConvertor(JmsMesageConvertor outboundMessageConvertor)
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

public java.lang.String getLocalPassword()
Returns:
Returns the localPassword.

setLocalPassword

public void setLocalPassword(java.lang.String localPassword)
Parameters:
localPassword - The localPassword to set.

getLocalUsername

public java.lang.String getLocalUsername()
Returns:
Returns the localUsername.

setLocalUsername

public void setLocalUsername(java.lang.String localUsername)
Parameters:
localUsername - The localUsername to set.

getOutboundPassword

public java.lang.String getOutboundPassword()
Returns:
Returns the outboundPassword.

setOutboundPassword

public void setOutboundPassword(java.lang.String outboundPassword)
Parameters:
outboundPassword - The outboundPassword to set.

getOutboundUsername

public java.lang.String getOutboundUsername()
Returns:
Returns the outboundUsername.

setOutboundUsername

public void setOutboundUsername(java.lang.String outboundUsername)
Parameters:
outboundUsername - The outboundUsername to set.

getOutboundClientId

public java.lang.String getOutboundClientId()
Returns:
the outboundClientId

setOutboundClientId

public void setOutboundClientId(java.lang.String outboundClientId)
Parameters:
outboundClientId - the outboundClientId to set

getLocalClientId

public java.lang.String getLocalClientId()
Returns:
the localClientId

setLocalClientId

public void setLocalClientId(java.lang.String localClientId)
Parameters:
localClientId - the localClientId to set

getReconnectionPolicy

public ReconnectionPolicy getReconnectionPolicy()
Returns:
the currently configured reconnection policy.

setReconnectionPolicy

public void setReconnectionPolicy(ReconnectionPolicy policy)
Parameters:
policy - The new reconnection policy this JmsConnector should use.

isConnected

public boolean isConnected()
Returns:
returns true if the JmsConnector is connected to both brokers.

addInboundBridge

protected void addInboundBridge(DestinationBridge bridge)

addOutboundBridge

protected void addOutboundBridge(DestinationBridge bridge)

removeInboundBridge

protected void removeInboundBridge(DestinationBridge bridge)

removeOutboundBridge

protected void removeOutboundBridge(DestinationBridge bridge)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

isFailed

public boolean isFailed()

initializeLocalConnection

protected abstract void initializeLocalConnection()
                                           throws java.lang.Exception
Performs the work of connection to the local side of the Connection.

This creates the initial connection to the local end of the JmsConnector and then sets up all the destination bridges with the information needed to bridge on the local side of the connection.

Throws:
java.lang.Exception - if the connection cannot be established for any reason.

initializeForeignConnection

protected abstract void initializeForeignConnection()
                                             throws java.lang.Exception
Performs the work of connection to the foreign side of the Connection.

This creates the initial connection to the foreign end of the JmsConnector and then sets up all the destination bridges with the information needed to bridge on the foreign side of the connection.

Throws:
java.lang.Exception - if the connection cannot be established for any reason.


Copyright © 2005-2015. All Rights Reserved.