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 8BD8F10E63 for ; Mon, 3 Mar 2014 05:57:12 +0000 (UTC) Received: (qmail 32993 invoked by uid 500); 3 Mar 2014 05:57:11 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 32779 invoked by uid 500); 3 Mar 2014 05:57:10 -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 32766 invoked by uid 99); 3 Mar 2014 05:57:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Mar 2014 05:57:08 +0000 X-ASF-Spam-Status: No, hits=3.5 required=5.0 tests=HTML_MESSAGE,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [216.139.250.139] (HELO joe.nabble.com) (216.139.250.139) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Mar 2014 05:57:03 +0000 Received: from [192.168.236.139] (helo=joe.nabble.com) by joe.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WKLrL-0006Jc-93 for users@activemq.apache.org; Sun, 02 Mar 2014 21:56:15 -0800 Date: Sun, 2 Mar 2014 21:56:00 -0800 (PST) From: artnaseef To: users@activemq.apache.org Message-ID: In-Reply-To: <1393793409727-4678437.post@n4.nabble.com> References: <1393793409727-4678437.post@n4.nabble.com> Subject: Re: activemq - delete consumed messages MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_137777_19153728.1393826160264" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_137777_19153728.1393826160264 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Deletion is handled automatically. Each datafile remains until all of the m= essages it contains are no longer needed.=20 Sent from my iPhone > On Mar 2, 2014, at 1:50 PM, "turkuaz07 [via ActiveMQ]" wrote: >=20 > I am using ActiveMQ in my app. My question is how to delete messages that= =C4=B1 consumed successfully from kahadb. Because if it is not deleted, my= db.data file is growing up constantly.=20 >=20 > I just wanna delete messages from db.data file after consumer got the mes= sage, but how ?=20 >=20 > Here is my consumer;=20 >=20 > ActiveMQConnectionFactory connectionFactory =3D new ActiveMQConnectio= nFactory("tcp://localhost:8182");=20 > Connection connection =3D connectionFactory.createConnection();=20 > connection.start();=20 > Session session =3D connection.createSession(false, Session.AUTO_ACKN= OWLEDGE);=20 > Destination destination =3D session.createQueue("TEST.FOO");=20 > MessageConsumer consumer =3D session.createConsumer(destination);=20 >=20 > MessageListener listner =3D new MessageListener() {=20 > int count =3D 0;=20 >=20 > public void onMessage(Message message) {=20 > if (message instanceof ObjectMessage) {=20 > ObjectMessage objectMessage =3D (ObjectMessage) message;= =20 > ResponseDuration responseDuration =3D null;=20 > try {=20 > responseDuration =3D (ResponseDuration) objectMessage= .getObject();=20 > System.out.println("Received Time : " + new Date() + = "Received: " + responseDuration.toString());=20 > } catch (JMSException e1) {=20 > // TODO Auto-generated catch block=20 > e1.printStackTrace();=20 > }=20 >=20 > try {=20 > ResponseDurationOperations.insertResponseDurations(re= sponseDuration);=20 > count++;=20 > System.out.println("Count =3D " + count);=20 > } catch (SQLException e) {=20 > // TODO Auto-generated catch block=20 > e.printStackTrace();=20 > }=20 > }=20 > }=20 > };=20 > consumer.setMessageListener(listner);=20 >=20 > If you reply to this email, your message will be added to the discussion = below: > http://activemq.2283324.n4.nabble.com/activemq-delete-consumed-messages-t= p4678437.html > To start a new topic under ActiveMQ - User, email ml-node+s2283324n234180= 5h3@n4.nabble.com=20 > To unsubscribe from ActiveMQ - User, click here. > NAML -- View this message in context: http://activemq.2283324.n4.nabble.com/activem= q-delete-consumed-messages-tp4678437p4678445.html Sent from the ActiveMQ - User mailing list archive at Nabble.com. ------=_Part_137777_19153728.1393826160264--