From users-return-15260-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Fri Aug 01 06:34:15 2008 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 57866 invoked from network); 1 Aug 2008 06:34:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Aug 2008 06:34:15 -0000 Received: (qmail 36051 invoked by uid 500); 1 Aug 2008 06:34:14 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 36032 invoked by uid 500); 1 Aug 2008 06:34:14 -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 36021 invoked by uid 99); 1 Aug 2008 06:34:13 -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 23:34:13 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rajdavies@gmail.com designates 64.233.182.184 as permitted sender) Received: from [64.233.182.184] (HELO nf-out-0910.google.com) (64.233.182.184) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Aug 2008 06:33:16 +0000 Received: by nf-out-0910.google.com with SMTP id g16so341786nfd.16 for ; Thu, 31 Jul 2008 23:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=pLRfQU3SYukXRk9omnADjm6zSWQ0LE8J3FO0ipq4aW4=; b=lBvXuB/ay50Womjx+2mc/Px3czr9YlnYzLVwRWGKkaQpe7kRux9XDI8m9Vix9mu7rI ZsgIqleBdbGCVPz4pJGmYJN+ip6aE45MTxODc5vWH4LscTUxMWj1Bg/s9YrsnU8PKp/W jMftIPQjfgx8G3JOkfb6mBVU0WJ84v5icb8bU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=P1eOHJtsylhMTKHWEeqhPatVsTooPC48NK7Q2P8fvd//La5akIWrK+WQ6/C5Eu630f pc8NxhQ+5fOxMRY2mJvsSeZqJBOM3qbFVzvR+RlquU5mPmhcnPA/2F1z4qJlO4HKIP2T 4ymueBrq1wNrMu0svU/xYN837oeVs5SBbQT0s= Received: by 10.210.80.2 with SMTP id d2mr12197590ebb.7.1217572421946; Thu, 31 Jul 2008 23:33:41 -0700 (PDT) Received: from ?192.168.1.251? ( [86.144.172.35]) by mx.google.com with ESMTPS id g9sm1871355gvc.0.2008.07.31.23.33.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 31 Jul 2008 23:33:40 -0700 (PDT) Message-Id: From: Rob Davies To: users@activemq.apache.org In-Reply-To: <18755772.post@talk.nabble.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v928.1) Subject: Re: Problems with simple peer:// transport config & Spring Date: Fri, 1 Aug 2008 07:33:32 +0100 References: <18755772.post@talk.nabble.com> X-Mailer: Apple Mail (2.928.1) X-Virus-Checked: Checked by ClamAV on apache.org Hi new2mq, I wonder if you're running into some gotcha's with the Spring JmsTemplate - and that you should be using a PooledConnectionFactory - see http://activemq.apache.org/spring-support.html - to avoid the peer:// protocol from having to create its embedded broker, establish its network connection, search for other peers etc for every message - for every message sent, received etc. cheers, Rob On 31 Jul 2008, at 15:24, new2mq wrote: > > 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 > /////////////////////// > > "http://www.springframework.org/dtd/spring-beans.dtd"> > > class="org.apache.activemq.ActiveMQConnectionFactory"> > > peer://mygroupname/mybrokername > > > > class="org.apache.activemq.command.ActiveMQTopic"> > > TestTopic > > > > > > > > > > > class="com.ssi.exp.TestMessageListener" /> > > class > = > "org.springframework.jms.listener.DefaultMessageListenerContainer102"> > > 1 > > ref="jmsTopicConnectionFactory"/> > > > > true > > > > class="org.springframework.jms.core.JmsTemplate102"> > > > > > > > > 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. >