Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 90515 invoked from network); 4 May 2007 03:57:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 May 2007 03:57:21 -0000 Received: (qmail 15704 invoked by uid 500); 4 May 2007 03:57:27 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 15444 invoked by uid 500); 4 May 2007 03:57:26 -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 15431 invoked by uid 99); 4 May 2007 03:57:26 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2007 20:57:26 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jignesh_shah@persistent.co.in designates 202.54.11.87 as permitted sender) Received: from [202.54.11.87] (HELO bmapps.persistent.co.in) (202.54.11.87) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2007 20:57:19 -0700 Received: from bmapps.persistent.co.in (unknown [127.0.0.1]) by bmapps.persistent.co.in (Symantec Mail Security) with ESMTP id B42EB52808F; Fri, 4 May 2007 09:25:36 +0530 (IST) X-AuditID: 0a4e0006-ac5f3bb000002e5b-41-463aaeb7a63c Received: from mail.persistent.co.in (unknown [10.78.0.1]) by bmapps.persistent.co.in (Symantec Mail Security) with ESMTP id 6DB944E4002; Fri, 4 May 2007 09:25:35 +0530 (IST) Received: from ps2237 (ps2237.persistent.co.in [10.77.201.87]) by mail.persistent.co.in (MOS 3.8.3-GA) with ESMTP id BFR93646 (AUTH jignesh_shah); Fri, 4 May 2007 09:26:51 +0530 (IST) From: "Jignesh ShaH" To: , Cc: Subject: broker on the same machine with the producer and consumer on different machine ---- need help Urgent Date: Fri, 4 May 2007 09:27:12 +0530 Message-ID: <000301c78e00$4bbfbe70$57c94d0a@persistent.co.in> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AceNjU+ts1CdlKvlRFO+AedkuQkp2gAAFAswABxzpiA= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Junkmail-Whitelist: YES (by domain whitelist at mail6.persistent.co.in) X-Brightmail-Tracker: AAAAAA== X-Virus-Checked: Checked by ClamAV on apache.org This is the code of the producer with the explicit Broker running as service on the same machine as the producer : I understand that as there are 2 different conectionfactories as the consumer and the producer are on different machine i.e on different VMs altogether I want the consumer to connect to the broker on other machine which has producer too. ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); System.out.println(connectionFactory.toString()); String str = null ; SimpleMessageConverter convertor = new SimpleMessageConverter(); connectionFactory.setUseAsyncSend(true); connectionFactory.setDispatchAsync(true); connectionFactory.setOptimizeAcknowledge(true); connectionFactory.setOptimizedMessageDispatch(true); ActiveMQPrefetchPolicy prefetchpolicy = new ActiveMQPrefetchPolicy(); prefetchpolicy.setQueuePrefetch(32766); connectionFactory.setPrefetchPolicy(prefetchpolicy); try { QueueConnection connection = connectionFactory.createQueueConnection(); Session session = connection.createQueueSession(false,Session.DUPS_OK_ACKNOWLEDGE); Destination destination = session.createQueue("Xdrqueue"); MessageProducer producer = session.createProducer(destination); BufferedReader reader = new BufferedReader(new FileReader(new File("C://Documents and Settings//jignesh_shah//Desktop//XDR.xml"))); str = reader.readLine(); while(true){ if(reader.readLine()==null) break; else str += reader.readLine(); } System.out.println("First Message sent at : -" + System.currentTimeMillis()); for (int i = 0; i < 10000; i++) { try { producer.send(convertor.toMessage(str+"\n", session)); } catch (MessageConversionException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JMSException e) { e.printStackTrace(); } This is the code for consumer on different machine : package mqclient; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.QueueConnection; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQPrefetchPolicy; import org.springframework.jms.support.converter.MessageConversionException; import org.springframework.jms.support.converter.SimpleMessageConverter; public class Client { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int cnt =0; ActiveMQConnectionFactory connectionfactory = new ActiveMQConnectionFactory("tcp://ps2237:61616"); System.out.println(connectionfactory); connectionfactory.setUseAsyncSend(true); connectionfactory.setDispatchAsync(true); connectionfactory.setOptimizeAcknowledge(true); connectionfactory.setOptimizedMessageDispatch(true); ActiveMQPrefetchPolicy prefetchpolicy = new ActiveMQPrefetchPolicy(); prefetchpolicy.setQueuePrefetch(32766); connectionfactory.setPrefetchPolicy(prefetchpolicy); try { System.out.println("try enetered"); QueueConnection connection = connectionfactory.createQueueConnection(); Session session = connection.createQueueSession(false,Session.DUPS_OK_ACKNOWLEDGE); Destination destination = session.createQueue("Xdrqueue"); MessageConsumer consumer = session.createConsumer(destination); SimpleMessageConverter convertor = new SimpleMessageConverter(); while(true) { System.out.println("loop enetered"); Message message = consumer.receive(); if(message.equals(null)) System.out.println("null message") ; try { String str = (String)convertor.fromMessage(message); } catch (MessageConversionException e) { e.printStackTrace(); } catch (JMSException e) { e.printStackTrace(); } if (cnt >=10000) { System.out.print("Last message received at :- "+ System.currentTimeMillis()); break; } ++cnt; } } catch (JMSException e) { e.printStackTrace(); } } } -----Original Message----- From: James Strachan [mailto:james.strachan@gmail.com] Sent: Thursday, May 03, 2007 7:44 PM To: users@activemq.apache.org Subject: Re: facing problems with explicitas well as embedded broker on the same machine with the producer and consumer on different machine ---- need help Urgent What problems are you seeing? (You're not giving us much to go on)... http://activemq.apache.org/support.html On 5/3/07, Jignesh ShaH wrote: > facing problems with explicit as well as embedded broker on the same machine > with the producer and consumer on different machine ---- need help Urgent > > > > > > What I am doing is running the explicit broker and the producer on the same > machine > > And the consumer on other machine > > > > The connectionfactory references generated are different that's the only > thing I could find out > > > > > > Regards > > Jignesh shah > > > DISCLAIMER > ========== > This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails. > -- James ------- http://macstrac.blogspot.com/ DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.