Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 21517 invoked from network); 31 Jul 2008 14:24:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jul 2008 14:24:33 -0000 Received: (qmail 71106 invoked by uid 500); 31 Jul 2008 14:24:33 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 70734 invoked by uid 500); 31 Jul 2008 14:24:32 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 70723 invoked by uid 99); 31 Jul 2008 14:24:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jul 2008 07:24:32 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jul 2008 14:23:35 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KOZ4T-0000Dv-1Y for users@activemq.apache.org; Thu, 31 Jul 2008 07:24:01 -0700 Message-ID: <18755772.post@talk.nabble.com> Date: Thu, 31 Jul 2008 07:24:00 -0700 (PDT) From: new2mq To: users@activemq.apache.org Subject: Problems with simple peer:// transport config & Spring MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: chris.goodacre@sungard.com X-Virus-Checked: Checked by ClamAV on apache.org I have what I think *must* be a simple and common deployment architecture. I have two webapps running on different machines. At any given time, one will receive an http request that generates an MQ message. I want the other webapp on the other machine to automatically receive this message as well. My understanding is that the peer protocol should fit the bill just fine. My problem is that even in the simplest example I can write, on the same network segment, I can't get it to work (i.e. messages sent by one VM are also received by the that VM, but not by the other). It works if both VMs are on the same box, but that's a deal-breaker for me. I've (obiously) had trouble connecting the dots here. For instance, I see configuration for brokers that allows one to specify the networkConnector and transportConnector; places where discoveryUri looks promising. But I thought that the peer protocol created an embedded broker on the fly -- so how is that configured? Also, connecting Spring config with the activemq config (without xbean) has been frustrating. Here's my Spring config: //////////////////////// // spring-config.xml /////////////////////// peer://mygroupname/mybrokername TestTopic 1 true true All my test code does is load the Spring context. The test app can be run as listener-only or as sender-listener. //////////////////////// // Test Code: TestAMQPeer.java /////////////////////// package com.ssi.exp; import java.util.Map; import java.util.HashMap; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.ApplicationContext; public class TestAMQPeer { public static void main(String[] cmdArgs) throws Exception { System.out.println("Loading Spring context..."); System.out.println("\tThis should create the activemq listener and sender..."); // load the Spring app ctx // listeners should be registered automatically // per my understanding ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config.xml"); // defaults int numMsgs = 5; // send 10 messages int delay = 3; // seconds // listen only by default if ( cmdArgs.length > 0 && null != cmdArgs[0] && cmdArgs[0].equalsIgnoreCase("send") ) { // if running as a sender, start sending messages // this process should receive them, and any other // in the peer group System.out.println("Executing in SENDER mode..."); TestMessageSender sender = (TestMessageSender) ctx.getBean("SenderBean"); for (int i = 0; i < numMsgs; i++) { sender.send(); try { Thread.sleep(delay * 1000l); } catch (InterruptedException ie) {}; // ignore } } } } //////////////////////// // Listen-only output (on machine A) /////////////////////// [goodacre@VM-QA-701-ENT ~]$ /opt/bea/jdk150_06/bin/java -jar test-amq-peer.jar Loading Spring context... This should create the activemq listener and sender... Jul 31, 2008 9:15:07 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@3eca90: display name [org.springframework.context.support.ClassPathXmlApplicationContext@3eca90]; startup date [Thu Jul 31 09:15:07 CDT 2008]; root of context hierarchy Jul 31, 2008 9:15:07 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [spring-config.xml] Jul 31, 2008 9:15:07 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@3eca90]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1df280b Jul 31, 2008 9:15:07 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1df280b: defining beans [jmsTopicConnectionFactory,TestTopic,SenderBean,MessageListener,TestJmsTopicListenerContainer,TestTopicJmsTemplate]; root of factory hierarchy Jul 31, 2008 9:15:08 AM org.apache.activemq.broker.BrokerService getBroker INFO: ActiveMQ 4.0.1 JMS Message Broker (mybrokername) is starting Jul 31, 2008 9:15:08 AM org.apache.activemq.broker.BrokerService getBroker INFO: For help or more information please see: http://incubator.apache.org/activemq/ Jul 31, 2008 9:15:08 AM org.apache.activemq.transport.TransportServerThreadSupport doStart INFO: Listening for connections at: tcp://VM-QA-701-ENT:54820 Jul 31, 2008 9:15:08 AM org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent start WARNING: brokerName not set Jul 31, 2008 9:15:08 AM org.apache.activemq.broker.TransportConnector start INFO: Connector tcp://VM-QA-701-ENT:54820 Started Jul 31, 2008 9:15:08 AM org.apache.activemq.network.NetworkConnector doStart INFO: Network Connector bridge Started Jul 31, 2008 9:15:08 AM org.apache.activemq.broker.BrokerService start INFO: ActiveMQ JMS Message Broker (mybrokername, ID:VM-QA-701-ENT-54819-1217513708221-1:0) started Jul 31, 2008 9:15:08 AM org.apache.activemq.transport.vm.VMTransportFactory bind INFO: binding to broker: mybrokername Jul 31, 2008 9:15:08 AM org.apache.activemq.broker.TransportConnector start INFO: Connector vm://mybrokername Started Jul 31, 2008 9:15:08 AM org.apache.activemq.broker.jmx.ManagementContext$1 run INFO: JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi //////////////////////// // Sender-Listener output (on machine B) /////////////////////// [goodacre@dacar-collector ~]$ /opt/java/bin/java -jar test-amq-peer.jar send Loading Spring context... This should create the activemq listener and sender... Jul 31, 2008 2:03:35 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@121cc40: display name [org.springframework.context.support.ClassPathXmlApplicationContext@121cc40]; startup date [Thu Jul 31 02:03:35 CDT 2008]; root of context hierarchy Jul 31, 2008 2:03:35 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [spring-config.xml] Jul 31, 2008 2:03:35 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@121cc40]: org.springframework.beans.factory.support.DefaultListableBeanFactory@8acf6e Jul 31, 2008 2:03:35 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8acf6e: defining beans [jmsTopicConnectionFactory,TestTopic,SenderBean,MessageListener,TestJmsTopicListenerContainer,TestTopicJmsTemplate]; root of factory hierarchy Jul 31, 2008 2:03:36 AM org.apache.activemq.broker.BrokerService getBroker INFO: ActiveMQ 4.0.1 JMS Message Broker (mybrokername) is starting Jul 31, 2008 2:03:36 AM org.apache.activemq.broker.BrokerService getBroker INFO: For help or more information please see: http://incubator.apache.org/activemq/ Jul 31, 2008 2:03:36 AM org.apache.activemq.transport.TransportServerThreadSupport doStart INFO: Listening for connections at: tcp://dacar-collector:55707 Jul 31, 2008 2:03:36 AM org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent start WARNING: brokerName not set Jul 31, 2008 2:03:36 AM org.apache.activemq.broker.TransportConnector start INFO: Connector tcp://dacar-collector:55707 Started Jul 31, 2008 2:03:36 AM org.apache.activemq.network.NetworkConnector doStart INFO: Network Connector bridge Started Jul 31, 2008 2:03:36 AM org.apache.activemq.broker.BrokerService start INFO: ActiveMQ JMS Message Broker (mybrokername, ID:dacar-collector-35217-1217487816143-1:0) started Jul 31, 2008 2:03:36 AM org.apache.activemq.transport.vm.VMTransportFactory bind INFO: binding to broker: mybrokername Jul 31, 2008 2:03:36 AM org.apache.activemq.broker.TransportConnector start INFO: Connector vm://mybrokername Started Jul 31, 2008 2:03:36 AM org.apache.activemq.broker.jmx.ManagementContext$1 run INFO: JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi Executing in SENDER mode... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Sending message 0[New message at Thu Jul 31 02:03:36 CDT 2008 from thread com.ssi.exp.TestMessageSender@7eb6e2] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Received message # 0 Received [ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false}] at Thu Jul 31 02:03:36 CDT 2008 in listener com.ssi.exp.TestMessageListener@8aeb74 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Sending message 1[New message at Thu Jul 31 02:03:39 CDT 2008 from thread com.ssi.exp.TestMessageSender@7eb6e2] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Received message # 1 Received [ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false}] at Thu Jul 31 02:03:39 CDT 2008 in listener com.ssi.exp.TestMessageListener@8aeb74 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Sending message 2[New message at Thu Jul 31 02:03:42 CDT 2008 from thread com.ssi.exp.TestMessageSender@7eb6e2] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Received message # 2 Received [ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false}] at Thu Jul 31 02:03:42 CDT 2008 in listener com.ssi.exp.TestMessageListener@8aeb74 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Sending message 3[New message at Thu Jul 31 02:03:45 CDT 2008 from thread com.ssi.exp.TestMessageSender@7eb6e2] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Received message # 3 Received [ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false}] at Thu Jul 31 02:03:45 CDT 2008 in listener com.ssi.exp.TestMessageListener@8aeb74 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Sending message 4[New message at Thu Jul 31 02:03:48 CDT 2008 from thread com.ssi.exp.TestMessageSender@7eb6e2] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Received message # 4 Received [ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId = null, originalDestination = null, originalTransactionId = null, producerId = null, destination = null, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false}] at Thu Jul 31 02:03:48 CDT 2008 in listener com.ssi.exp.TestMessageListener@8aeb74 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -- View this message in context: http://www.nabble.com/Problems-with-simple-peer%3A---transport-config---Spring-tp18755772p18755772.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.