activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From artnaseef <...@artnaseef.com>
Subject Re: activemq - delete consumed messages
Date Mon, 03 Mar 2014 05:56:00 GMT
Deletion is handled automatically. Each datafile remains until all of the messages it contains
are no longer needed. 

Sent from my iPhone

> On Mar 2, 2014, at 1:50 PM, "turkuaz07 [via ActiveMQ]" <ml-node+s2283324n4678437h95@n4.nabble.com>
wrote:
> 
> I am using ActiveMQ in my app. My question is how to delete messages that ı consumed
successfully from kahadb. Because if it is not deleted, my db.data file is growing up constantly.

> 
> I just wanna delete messages from db.data file after consumer got the message, but how
? 
> 
> Here is my consumer; 
> 
>     ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:8182");

>     Connection connection = connectionFactory.createConnection(); 
>     connection.start(); 
>     Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
>     Destination destination = session.createQueue("TEST.FOO"); 
>     MessageConsumer consumer = session.createConsumer(destination); 
> 
>     MessageListener listner = new MessageListener() { 
>         int count = 0; 
> 
>         public void onMessage(Message message) { 
>             if (message instanceof ObjectMessage) { 
>                 ObjectMessage objectMessage = (ObjectMessage) message; 
>                 ResponseDuration responseDuration = null; 
>                 try { 
>                     responseDuration = (ResponseDuration) objectMessage.getObject();

>                     System.out.println("Received Time : " + new Date() + "Received: "
+ responseDuration.toString()); 
>                 } catch (JMSException e1) { 
>                     // TODO Auto-generated catch block 
>                     e1.printStackTrace(); 
>                 } 
> 
>                 try { 
>                     ResponseDurationOperations.insertResponseDurations(responseDuration);

>                     count++; 
>                     System.out.println("Count = " + count); 
>                 } catch (SQLException e) { 
>                     // TODO Auto-generated catch block 
>                     e.printStackTrace(); 
>                 } 
>             } 
>         } 
>     }; 
>     consumer.setMessageListener(listner); 
> 
> 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-tp4678437.html
> To start a new topic under ActiveMQ - User, email ml-node+s2283324n2341805h3@n4.nabble.com

> To unsubscribe from ActiveMQ - User, click here.
> NAML




--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-delete-consumed-messages-tp4678437p4678445.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message