Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 8671 invoked from network); 24 Jan 2011 21:36:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jan 2011 21:36:56 -0000 Received: (qmail 26956 invoked by uid 500); 24 Jan 2011 21:36:56 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 26840 invoked by uid 500); 24 Jan 2011 21:36:55 -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 26832 invoked by uid 99); 24 Jan 2011 21:36:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jan 2011 21:36:55 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tabish121@gmail.com designates 209.85.161.43 as permitted sender) Received: from [209.85.161.43] (HELO mail-fx0-f43.google.com) (209.85.161.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jan 2011 21:36:47 +0000 Received: by fxm18 with SMTP id 18so5613575fxm.2 for ; Mon, 24 Jan 2011 13:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:to:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=GbFo2x5Tqhkcp2GUvMcU5m4GrmLigIC3mFnAPXQ4kMc=; b=TqvNNiWLobwvgY5LJ+zoISdhLSDfqWV/6zEkHsiueuD2FUumDI2hQM0tQE7Q8gHRBz hAXkZw2hBz/SacS7M4QwmmfIVokJMAe974k5oZ8gNBM9IrXDlWwsmIfU8zwpnceDj2Or XHpvQP+ZrQtSvne6zvc0VP3oI6PJaOBNE1YiM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; b=ukUS2nMLwUSgWmCh16zLe/gAhFoiAVNgiEo8qaXa5/KDufNxMFbirIVas0mnUSK5wG ITWGDjKJ+cHJJnEPHgnuCODQ9CPvalinYPAAEtwgtCDUYdyoEpN2oHfCd2wW0eb8b3Uk ZNk5+cogz+B7N36FAynYkfZD0FaikOAHTmMwU= Received: by 10.223.78.205 with SMTP id m13mr4781745fak.79.1295904987025; Mon, 24 Jan 2011 13:36:27 -0800 (PST) Received: from [192.168.2.150] (c-69-143-50-138.hsd1.va.comcast.net [69.143.50.138]) by mx.google.com with ESMTPS id e17sm4772373fak.34.2011.01.24.13.36.25 (version=SSLv3 cipher=RC4-MD5); Mon, 24 Jan 2011 13:36:26 -0800 (PST) Subject: Re: Messages Never Arrive At Broker From: Timothy Bish To: users@activemq.apache.org In-Reply-To: References: <139DAFB0-15AF-4170-BFAD-0DAE5DB3BA4A@gmail.com> <1295903096.2654.10.camel@office> Content-Type: text/plain; charset="UTF-8" Date: Mon, 24 Jan 2011 16:36:23 -0500 Message-ID: <1295904983.2654.12.camel@office> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 (2.32.1-1.fc14) Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, 2011-01-24 at 16:29 -0500, Bojan Rajkovic wrote: > On Jan 24, 2011, at 4:04:56PM, Timothy Bish wrote: > > > On Mon, 2011-01-24 at 15:36 -0500, Bojan Rajkovic wrote: > >> Hi all, > >> > >> Apologies for potential double-posts—Nabble doesn't seem to be working right, so I decided to try the ML directly. > >> > >> I'm using ActiveMQ 5.4.2, with queues and non-persistent messaging. The operating system is SLES 10 (Linux 2.6.18), JVM 1.6, running a 64-bit server VM. I'm not using any application server on the producer end, just creating a connection factory manually. > >> > >> A Java producer is being used to send messages to STOMP-based consumers (primarily Flex/Flash, but maybe also JavaScript in the future). The STOMP clients also produce some messages, and those arrive fine, and the Java consumer is able to pick them up and react to them (including sending a message back—this happens on a different queue than the problem queue though). However, when the Java producer begins to send messages, no messages arrive in the problem queue. The pending count never increases, and the STOMP consumers never get any messages. Producer flow control is turned off, and as mentioned earlier, messages are not persistent. They're also set to expire after 2.5 seconds. > >> > >> My code looks like this: > >> Message m; > >> > >> try { > >> m = sess.createTextMessage(inputMessage); > >> } catch (JMSException e) { > >> l.error("Error creating ActiveMQ message. Error message: ", e); > >> return; > >> } > >> > >> try { > >> producer.send(m); > >> l.info ("Message sent to broker."); > >> } catch (JMSException e) { > >> l.error("Error sending ActiveMQ message. Error message: ", e); > >> return; > >> } > >> l is a log4j Logger, and sess is a session obtained from an ActiveMQConnectionFactory. The factory is set up as such: ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl), and async dispatch/sending is disabled (though having it enabled didn't help either). > >> > >> A different queue (with a different producer) works just fine—the JMS producer is able to send a message to the queue, and it's received on the STOMP end. Is there any reason why my JMS producer wouldn't work on one queue, and would work for another, when STOMP works fine for both producing and consuming? I was getting some dead letter queue errors earlier, but resolved them by telling the dead letter queue to not handle messages that expire. If my messages are going to the dead letter queue, how can I establish why, so that I can fix the issue? > >> > >> Cheers, > >> Bojan Rajkovic > > > > Can you post all of the JMS producer code, showing how you create the > > Connection / Session / Producer, there's not quite enough to go on here. > > > > Regards > > > > > > -- > > Tim Bish > > ------------ > > FuseSource > > Email: tim.bish@fusesource.com > > Web: http://fusesource.com > > Twitter: tabish121 > > Blog: http://timbish.blogspot.com/ > > Here's the code, modulo error handling/logging noise: > > > ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl); > > Connection conn = null; > > > > conn = factory.createConnection(userName, passWord); > > conn.start(); > > > > MessageProducer producer = null; > > Session sess = null; > > > > sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); > > > > Queue dataQueue = null; > > > > dataQueue = sess.createQueue(messageQueueName); > > > > producer = sess.createProducer(dataQueue); > > producer.setTimeToLive(messageExpirationTime); > > producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > > > > Socket localSocket = null; > > BufferedReader in = null; > > > > localSocket = new Socket("localhost", 9090); > > in = new BufferedReader(new InputStreamReader(localSocket.getInputStream())); > > > > String inputMessage; > > > > while (doRun) { > > inputMessage = in.readLine(); > > Message m; > > > > m = sess.createTextMessage(inputMessage); > > producer.send(m); > > } > > I can reliably reproduce the lack of messages anytime that messageExpirationTime is non-zero (that is, anytime the messages are given a TTL). If I set the message expiration time to 0, messages go through. However, this is not desirable, because I need messages to expire—I'd rather not have to filter stale messages on the frontend if I don't have to. I did find out in the meantime that I can fairly reliably detect when the frontend (a web app) is going away, so I can send my producer a STOP message and only have a few stale messages at most. However, I'd still like to figure out why giving messages a TTL causes them to not be received, just in case there's an ActiveMQ bug. > > Thanks for your help! > > Cheers, > Bojan Rajkovic Either your TTL is to short and therefore not making it past the broker or, the clocks are not sync'd between the producer machine and the machine that's running the broker. If the clocks are out of sync then the messages could be timed out early. Regards -- Tim Bish ------------ FuseSource Email: tim.bish@fusesource.com Web: http://fusesource.com Twitter: tabish121 Blog: http://timbish.blogspot.com/