Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E8FED1100F for ; Thu, 24 Jul 2014 19:57:20 +0000 (UTC) Received: (qmail 59711 invoked by uid 500); 24 Jul 2014 19:57:20 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 59668 invoked by uid 500); 24 Jul 2014 19:57:20 -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 59605 invoked by uid 99); 24 Jul 2014 19:57:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jul 2014 19:57:19 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tabish121@gmail.com designates 209.85.216.54 as permitted sender) Received: from [209.85.216.54] (HELO mail-qa0-f54.google.com) (209.85.216.54) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jul 2014 19:57:18 +0000 Received: by mail-qa0-f54.google.com with SMTP id k15so3480048qaq.41 for ; Thu, 24 Jul 2014 12:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=StIWdZFzUgY1oKMolLgIB3ceMmAmGqGjaymBiz+aHxM=; b=SP32Mp8ZqXkj8OXnXF6Z1ja4tbYXnhrlroDpEa3wWj87l6ZKBuRI/WD+i/KB+EGOe0 kGiXhWS+upfj8o8RvJN5qjKwG7512bChI5Qv1lZMp23MjiLtFJxQYkFm2jp6FypX+jbr ljWl6k34O2rxo5nmOf8enZ5MMPxYzLy+vjDEPr8bJgeWmXzA9IFjzDSeqavel1BFbGR6 Hc3/rmPDBEtKabW/obbdcxQBU2saogv+fgG++zD0T54SUo9mhD72zDOkwk6kxaVkmI7F TdFQSqIfnFUm5hz2MTGTDU9nQJt4WpPgCdByryq9SqgPrHP5RydtD9YNw5iQ3Kxu7/rF NIAg== X-Received: by 10.140.41.116 with SMTP id y107mr18341715qgy.78.1406231813367; Thu, 24 Jul 2014 12:56:53 -0700 (PDT) Received: from [192.168.2.150] (c-98-218-173-79.hsd1.va.comcast.net. [98.218.173.79]) by mx.google.com with ESMTPSA id l8sm10271248qao.10.2014.07.24.12.56.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jul 2014 12:56:52 -0700 (PDT) Message-ID: <53D16504.9070508@gmail.com> Date: Thu, 24 Jul 2014 15:56:52 -0400 From: Timothy Bish User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: users@activemq.apache.org Subject: Re: can message.acknowledge be transacted? References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 07/24/2014 03:37 PM, Jose María Zaragoza wrote: > 2014-07-23 13:13 GMT+02:00 Gary Tully : >> yes, but not in that way. message.acknowledge(); is not transactional. >> You need to manage the operations with a transacted session >> that is shared across the producer and consumer. >> >> consumer.receive(); >> producer.send() .... >> session.commit() > > A newbie question > > who performs session.commit() ? producer side or consumer side ? > if it's performed by producer side , does consumer send ACK to AMQ > broker ( to acknowledge all messages ) when producer commits it's > session ? > > Regards > >> >> On 23 July 2014 06:13, Kevin Burton wrote: >>> I have a task processing a message, which creates about a dozen other >>> messages and then manually acknowledges the current message it's processing. >>> >>> so it's like >>> >>> producer.send( message0 ); >>> producer.send( message1 ); >>> message.acknowledge(); >>> >>> can I put those all in one transaction? >>> >>> -- >>> >>> Founder/CEO Spinn3r.com >>> Location: *San Francisco, CA* >>> blog: http://burtonator.wordpress.com >>> … or check out my Google+ profile >>> >>> >> >> >> -- >> http://redhat.com >> http://blog.garytully.com Depends on what you are doing, if you are producing and consuming from the same application using producers and consumers creating from the same session then your application commits the session when it decides that all produced and consumed messages need to be committed (work is done). If producer and consumer were created from different sessions then each session must have commit called when you decide it's time. For two different applications one producing and one consuming then each must commit on it's own, the producer commits when it's ready for all sent messages to be committed (messages are not dispatched to a consumer until the session is committed). The consumer likewise must commit it's session once it has completed processing all the messages that your application decides comprise a unit of work. -- Tim Bish Sr Software Engineer | RedHat Inc. tim.bish@redhat.com | www.fusesource.com | www.redhat.com skype: tabish121 | twitter: @tabish121 blog: http://timbish.blogspot.com/