Class JmsConnector

  • All Implemented Interfaces:
    org.apache.activemq.Service
    Direct Known Subclasses:
    SimpleJmsQueueConnector, SimpleJmsTopicConnector

    public abstract class JmsConnector
    extends Object
    implements org.apache.activemq.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.
    • Constructor Detail

      • JmsConnector

        public JmsConnector()
    • Method Detail

      • init

        public boolean init()
      • doConnectorInit

        protected boolean doConnectorInit()
      • start

        public void start()
                   throws Exception
        Specified by:
        start in interface org.apache.activemq.Service
        Throws:
        Exception
      • stop

        public void stop()
                  throws Exception
        Specified by:
        stop in interface org.apache.activemq.Service
        Throws:
        Exception
      • clearBridges

        public void clearBridges()
      • 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 Connection getLocalConnection()
      • getForeignConnection

        public Connection getForeignConnection()
      • getJndiLocalTemplate

        public JndiLookupFactory getJndiLocalTemplate()
        Returns:
        Returns the jndiTemplate.
      • setJndiLocalTemplate

        public void setJndiLocalTemplate​(JndiLookupFactory jndiTemplate)
        Parameters:
        jndiTemplate - The jndiTemplate to set.
      • getJndiOutboundTemplate

        public JndiLookupFactory getJndiOutboundTemplate()
        Returns:
        Returns the jndiOutboundTemplate.
      • setJndiOutboundTemplate

        public void setJndiOutboundTemplate​(JndiLookupFactory jndiOutboundTemplate)
        Parameters:
        jndiOutboundTemplate - The jndiOutboundTemplate to set.
      • getInboundMessageConvertor

        public JmsMesageConvertor getInboundMessageConvertor()
        Returns:
        Returns the inboundMessageConvertor.
      • setInboundMessageConvertor

        public void setInboundMessageConvertor​(JmsMesageConvertor jmsMessageConvertor)
        Parameters:
        jmsMessageConvertor - The jmsMessageConvertor 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 String getLocalPassword()
        Returns:
        Returns the localPassword.
      • setLocalPassword

        public void setLocalPassword​(String localPassword)
        Parameters:
        localPassword - The localPassword to set.
      • getLocalUsername

        public String getLocalUsername()
        Returns:
        Returns the localUsername.
      • setLocalUsername

        public void setLocalUsername​(String localUsername)
        Parameters:
        localUsername - The localUsername to set.
      • getOutboundPassword

        public String getOutboundPassword()
        Returns:
        Returns the outboundPassword.
      • setOutboundPassword

        public void setOutboundPassword​(String outboundPassword)
        Parameters:
        outboundPassword - The outboundPassword to set.
      • getOutboundUsername

        public String getOutboundUsername()
        Returns:
        Returns the outboundUsername.
      • setOutboundUsername

        public void setOutboundUsername​(String outboundUsername)
        Parameters:
        outboundUsername - The outboundUsername to set.
      • getOutboundClientId

        public String getOutboundClientId()
        Returns:
        the outboundClientId
      • setOutboundClientId

        public void setOutboundClientId​(String outboundClientId)
        Parameters:
        outboundClientId - the outboundClientId to set
      • getLocalClientId

        public String getLocalClientId()
        Returns:
        the localClientId
      • setLocalClientId

        public void setLocalClientId​(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.
      • 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 JmsConnector is connected to both brokers.
      • removeInboundBridge

        protected void removeInboundBridge​(DestinationBridge bridge)
      • removeOutboundBridge

        protected void removeOutboundBridge​(DestinationBridge bridge)
      • getName

        public String getName()
      • setName

        public void setName​(String name)
      • isFailed

        public boolean isFailed()
      • initializeLocalConnection

        protected abstract void initializeLocalConnection()
                                                   throws 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:
        Exception - if the connection cannot be established for any reason.
      • initializeForeignConnection

        protected abstract void initializeForeignConnection()
                                                     throws 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:
        Exception - if the connection cannot be established for any reason.