From activemq-users-return-2951-apmail-geronimo-activemq-users-archive=geronimo.apache.org@geronimo.apache.org Wed Jul 19 12:36:32 2006 Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 52525 invoked from network); 19 Jul 2006 12:36:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jul 2006 12:36:32 -0000 Received: (qmail 68420 invoked by uid 500); 19 Jul 2006 12:36:32 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 68401 invoked by uid 500); 19 Jul 2006 12:36:31 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 68392 invoked by uid 99); 19 Jul 2006 12:36:31 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jul 2006 05:36:31 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [64.81.65.6] (HELO outside.tacitknowledge.com) (64.81.65.6) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jul 2006 05:36:30 -0700 Received: from adrian (host-212-0-197-247.moldtelecom.md [212.0.197.247]) (authenticated bits=0) by outside.tacitknowledge.com (8.12.11.20060308/8.12.11) with ESMTP id k6JCaLNp027312 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Wed, 19 Jul 2006 05:36:24 -0700 Message-ID: <00e101c6ab2f$e8fdd640$0b01650a@adrian> From: "Adrian Neaga" To: References: <5394170.post@talk.nabble.com> Subject: Re: Consumer does not receive anything after session.rollback() Date: Wed, 19 Jul 2006 15:36:04 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.2663 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N My Spring configuration is as follows: com.channels.mailTopic ---------------------------------------------- ACTIVEMQ config: ---------------------- com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/channels_dev user pass The jmsMailSender code: template.setDeliveryMode(DeliveryMode.PERSISTENT); template.setExplicitQosEnabled(true); if(messageTimeToLive > -1) { template.setTimeToLive(messageTimeToLive); } template.send(destination, new MessageCreator() { public Message createMessage(Session session) throws JMSException { Message message = session.createObjectMessage(simpleMailMessage); log.debug("Sending message:" + message); return message; } }); And the consumer: public void start() throws JMSException { try { ConnectionFactory factory = template.getConnectionFactory(); connection = factory.createConnection(); // we might be a reusable connection in spring // so lets only set the client ID once if its not set synchronized (connection) { if (connection.getClientID() == null) { connection.setClientID(clientId); } } connection.start(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); consumer = session.createConsumer(destination); consumer.setMessageListener(this); log.debug("JMSMailConsumer started"); } catch (JMSException ex) { log.error(ex); throw ex; } } public void onMessage(Message message) { if (message instanceof ObjectMessage) { ObjectMessage objectMessage = (ObjectMessage) message; try { SimpleMailMessage mailMessage = (SimpleMailMessage) objectMessage.getObject(); log.debug("Received JMS mail message " + mailMessage); try { mailSender.send(mailMessage); mailMessageList.add(message); session.commit(); log.debug("Sent the received JMS mail message to " + mailMessage.getTo()); } catch (MailException mailEx) { log.error(mailEx); session.rollback(); } } catch (JMSException e) { e.printStackTrace(); } } } As i worked on this today the problem is not that i dont receive anything at all, the problem is that i receive all the rest only after it redelivers the first failed message: - Got M1 to send - Deliver M1 - Session rolled back so retry ... time passed -Got M2 to send but it is not actually sent, or maybe the consumer just doesnt want to get it - Retry delivering, again rollback ... time passed - Retry..... - After retried max times M2 is finally received by consumer. What i want is M2 to be delivered and received in the mean-time the M1 is retried to be delivered. Thanks for reply !. ----- Original Message ----- From: "James Strachan" To: Sent: Wednesday, July 19, 2006 15:21 Subject: Re: Consumer does not receive anything after session.rollback() > Could you demonstrate your issue in a JUnit test case so we can see > how you are using the JMS API please? > > On 7/19/06, Adrian wrote: >> >> I have a transacted session that in some cases does a rollback() thus >> telling >> the server to redeliver the message later, after such a rollback() >> anything >> sent is not received by the consumer, although the new messages are added >> to >> the database. >> The next time i start the consumer it receives just the message it did >> rollback on (for every message a rollback or a commit is done), nothing >> else. >> The docs say that anything that happens after commit or rollback is in a >> new >> transaction, why dont i receive the messages sent after rollback ? >> >> Thanks. >> -- >> View this message in context: >> http://www.nabble.com/Consumer-does-not-receive-anything-after-session.rollback%28%29-tf1965658.html#a5394170 >> Sent from the ActiveMQ - User forum at Nabble.com. >> >> > > > -- > > James > ------- > http://radio.weblogs.com/0112098/ >