activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eugene Prokopiev <prokop...@stc.donpac.ru>
Subject JMS Bridge problems
Date Mon, 31 Jul 2006 08:05:22 GMT
Hi,

I tried to use JMS Bridge with this configuration:

<beans>
	
	<bean id="mainBroker" class="org.apache.activemq.broker.BrokerService" 
init-method="start" destroy-method="stop">
		<property name="brokerName" value = "mainBroker"/>
		<property name="persistent" value="false"/>
		<property name="transportConnectorURIs">
			<list>
				<value>tcp://localhost:7000</value>
			</list>
		</property>
	</bean>

	<bean id="bridgedBroker" 
class="org.apache.activemq.broker.BrokerService" init-method="start" 
destroy-method="stop">
		<property name="brokerName" value = "bridgedBroker"/>
		<property name="persistent" value="false"/>
		<property name="transportConnectorURIs">
			<list>
				<value>tcp://localhost:7001</value>
			</list>
		</property>
		<property name="jmsBridgeConnectors">
			<list>
				<bean class="org.apache.activemq.network.jms.JmsQueueConnector">
					<property name="outboundQueueConnectionFactory">
						<bean class="org.apache.activemq.ActiveMQConnectionFactory">
							<property name="brokerURL" value="tcp://localhost:7000" />
						</bean>	
					</property>
				</bean>
			</list>
		</property>
	</bean>
		
</beans>

I run this class:

public class BridgeTest {

	public BridgeTest() throws Exception {
		
		Log log = LogFactory.getLog(getClass());
		
		new ClassPathXmlApplicationContext("bridge/context-bridge.xml");
		
		ActiveMQConnection connection = ActiveMQConnection.makeConnection(
			"tcp://localhost:7001");
	    connection.start();
	    Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
	    Destination destination = session.createQueue("messages.input");
	    MessageProducer producer = session.createProducer(destination);
	    producer.send(session.createTextMessage("Test Message"));
	    log.debug("send message");
	    session.close();
	    connection.close();
	
	    connection = ActiveMQConnection.makeConnection(
			"tcp://localhost:7000");
	    connection.start();
	    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
	    destination = session.createQueue("messages.input");
         MessageConsumer consumer = session.createConsumer(destination);
         log.debug("receive message");
         Message message = consumer.receive(5000);
         log.debug("Received: " + message);
	    session.close();
	    connection.close();
	}
	
	public static void main(String[] args) throws Exception {
		new BridgeTest();		
	}

}

and got:

INFO  CollectionFactory              - JDK 1.4+ collections available
INFO  XmlBeanDefinitionReader        - Loading XML bean definitions from 
class path resource [bridge/context-bridge.xml]
INFO  ClassPathXmlApplicationContext - Bean factory for application 
context 
[org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=12893404]: 
org.springframework.beans.factory.support.DefaultListableBeanFactory 
defining beans [mainBroker,bridgedBroker]; root of BeanFactory hierarchy
INFO  ClassPathXmlApplicationContext - 2 beans defined in application 
context 
[org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=12893404]
INFO  ClassPathXmlApplicationContext - Unable to locate MessageSource 
with name 'messageSource': using default 
[org.springframework.context.support.DelegatingMessageSource@df8ff1]
INFO  ClassPathXmlApplicationContext - Unable to locate 
ApplicationEventMulticaster with name 'applicationEventMulticaster': 
using default 
[org.springframework.context.event.SimpleApplicationEventMulticaster@540408]
INFO  DefaultListableBeanFactory     - Pre-instantiating singletons in 
factory 
[org.springframework.beans.factory.support.DefaultListableBeanFactory 
defining beans [mainBroker,bridgedBroker]; root of BeanFactory hierarchy]
INFO  BrokerService                  - ActiveMQ null JMS Message Broker 
(mainBroker) is starting
INFO  BrokerService                  - For help or more information 
please see: http://incubator.apache.org/activemq/
INFO  TransportServerThreadSupport   - Listening for connections at: 
tcp://prokopiev.stc.donpac.ru:7000
INFO  TransportConnector             - Connector 
tcp://prokopiev.stc.donpac.ru:7000 Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker 
(mainBroker, ID:prokopiev.stc.donpac.ru-57776-1154332806928-0:0) started
INFO  BrokerService                  - ActiveMQ null JMS Message Broker 
(bridgedBroker) is starting
INFO  BrokerService                  - For help or more information 
please see: http://incubator.apache.org/activemq/
INFO  TransportServerThreadSupport   - Listening for connections at: 
tcp://prokopiev.stc.donpac.ru:7001
INFO  TransportConnector             - Connector 
tcp://prokopiev.stc.donpac.ru:7001 Started
INFO  ManagementContext              - JMX consoles can connect to 
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO  VMTransportFactory             - binding to broker: bridgedBroker
INFO  TransportConnector             - Connector vm://bridgedBroker Started
INFO  JmsConnector                   - JMS Connector Connector:0 Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker 
(bridgedBroker, ID:prokopiev.stc.donpac.ru-57776-1154332806928-0:1) started
DEBUG BridgeTest                     - send message
DEBUG BridgeTest                     - receive message
DEBUG BridgeTest                     - Received: null

So, I can't see my message at another end of bridge. What's wrong in my 
code?

--
Thanks,
Eugene Prokopiev


Mime
View raw message