Package org.apache.activemq.network.jms
Class OutboundTopicBridge
- java.lang.Object
-
- org.apache.activemq.network.jms.DestinationBridge
-
- org.apache.activemq.network.jms.OutboundTopicBridge
-
- All Implemented Interfaces:
MessageListener
,Service
public class OutboundTopicBridge extends DestinationBridge
Create an Outbound Topic Bridge. By default the bridge uses the same name for both the inbound and outbound topics, however this can be altered by using the public setter methods to configure both inbound and outbound topic names.
-
-
Field Summary
Fields Modifier and Type Field Description protected TopicConnection
consumerConnection
protected String
consumerName
protected TopicSession
consumerSession
protected Topic
consumerTopic
protected TopicPublisher
producer
protected TopicConnection
producerConnection
protected TopicSession
producerSession
protected Topic
producerTopic
protected String
selector
-
Fields inherited from class org.apache.activemq.network.jms.DestinationBridge
consumer, doHandleReplyTo, jmsConnector, jmsMessageConvertor, started
-
-
Constructor Summary
Constructors Constructor Description OutboundTopicBridge()
Default ContructorOutboundTopicBridge(String outboundTopicName)
Constructor that takes a foreign destination as an argument
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MessageConsumer
createConsumer()
protected MessageProducer
createProducer()
protected Connection
getConnectionForProducer()
protected Connection
getConnnectionForConsumer()
TopicConnection
getConsumerConnection()
String
getConsumerName()
Topic
getConsumerTopic()
String
getLocalTopicName()
String
getOutboundTopicName()
TopicConnection
getProducerConnection()
Topic
getProducerTopic()
String
getSelector()
protected void
sendMessage(Message message)
void
setConsumerConnection(TopicConnection consumerConnection)
void
setConsumerName(String consumerName)
void
setConsumerTopic(Topic consumerTopic)
void
setLocalTopicName(String localTopicName)
void
setOutboundTopicName(String outboundTopicName)
Sets the name of the outbound topic name.void
setProducerConnection(TopicConnection producerConnection)
void
setProducerTopic(Topic producerTopic)
void
setSelector(String selector)
void
stop()
-
Methods inherited from class org.apache.activemq.network.jms.DestinationBridge
getConsumer, getJmsMessageConvertor, isDoHandleReplyTo, onMessage, processReplyToDestination, setConsumer, setDoHandleReplyTo, setJmsConnector, setJmsMessageConvertor, start
-
-
-
-
Field Detail
-
consumerTopic
protected Topic consumerTopic
-
producerTopic
protected Topic producerTopic
-
consumerSession
protected TopicSession consumerSession
-
producerSession
protected TopicSession producerSession
-
consumerName
protected String consumerName
-
selector
protected String selector
-
producer
protected TopicPublisher producer
-
consumerConnection
protected TopicConnection consumerConnection
-
producerConnection
protected TopicConnection producerConnection
-
-
Constructor Detail
-
OutboundTopicBridge
public OutboundTopicBridge(String outboundTopicName)
Constructor that takes a foreign destination as an argument- Parameters:
outboundTopicName
-
-
OutboundTopicBridge
public OutboundTopicBridge()
Default Contructor
-
-
Method Detail
-
getOutboundTopicName
public String getOutboundTopicName()
- Returns:
- Returns the outboundTopicName.
-
setOutboundTopicName
public void setOutboundTopicName(String outboundTopicName)
Sets the name of the outbound topic name. If the inbound topic name has not been set already then this method uses the provided topic name to set the inbound topic name as well.- Parameters:
outboundTopicName
- The outboundTopicName to set.
-
getLocalTopicName
public String getLocalTopicName()
- Returns:
- the localTopicName
-
setLocalTopicName
public void setLocalTopicName(String localTopicName)
- Parameters:
localTopicName
- the localTopicName to set
-
stop
public void stop() throws Exception
- Specified by:
stop
in interfaceService
- Overrides:
stop
in classDestinationBridge
- Throws:
Exception
-
createConsumer
protected MessageConsumer createConsumer() throws JMSException
- Specified by:
createConsumer
in classDestinationBridge
- Throws:
JMSException
-
createProducer
protected MessageProducer createProducer() throws JMSException
- Specified by:
createProducer
in classDestinationBridge
- Throws:
JMSException
-
sendMessage
protected void sendMessage(Message message) throws JMSException
- Specified by:
sendMessage
in classDestinationBridge
- Throws:
JMSException
-
getConsumerConnection
public TopicConnection getConsumerConnection()
- Returns:
- Returns the consumerConnection.
-
setConsumerConnection
public void setConsumerConnection(TopicConnection consumerConnection)
- Parameters:
consumerConnection
- The consumerConnection to set.
-
getConsumerName
public String getConsumerName()
- Returns:
- Returns the consumerName.
-
setConsumerName
public void setConsumerName(String consumerName)
- Parameters:
consumerName
- The consumerName to set.
-
getConsumerTopic
public Topic getConsumerTopic()
- Returns:
- Returns the consumerTopic.
-
setConsumerTopic
public void setConsumerTopic(Topic consumerTopic)
- Parameters:
consumerTopic
- The consumerTopic to set.
-
getProducerConnection
public TopicConnection getProducerConnection()
- Returns:
- Returns the producerConnection.
-
setProducerConnection
public void setProducerConnection(TopicConnection producerConnection)
- Parameters:
producerConnection
- The producerConnection to set.
-
getProducerTopic
public Topic getProducerTopic()
- Returns:
- Returns the producerTopic.
-
setProducerTopic
public void setProducerTopic(Topic producerTopic)
- Parameters:
producerTopic
- The producerTopic to set.
-
getSelector
public String getSelector()
- Returns:
- Returns the selector.
-
setSelector
public void setSelector(String selector)
- Parameters:
selector
- The selector to set.
-
getConnnectionForConsumer
protected Connection getConnnectionForConsumer()
- Specified by:
getConnnectionForConsumer
in classDestinationBridge
-
getConnectionForProducer
protected Connection getConnectionForProducer()
- Specified by:
getConnectionForProducer
in classDestinationBridge
-
-