You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by turkuaz07 <cv...@gmail.com> on 2014/03/02 21:50:09 UTC
activemq - delete consumed messages
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);
--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-delete-consumed-messages-tp4678437.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: activemq - delete consumed messages
Posted by Gary Tully <ga...@gmail.com>.
The index file db.data is not subject to gc but it will be reused. So it
will grow as large as is necessary to track messages and then stabilise.
On 3 Mar 2014 17:04, "turkuaz07" <cv...@gmail.com> wrote:
> That's right, It defaults to 32mb for log files but I mean db.data file
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/activemq-delete-consumed-messages-tp4678437p4678481.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Re: activemq - delete consumed messages
Posted by turkuaz07 <cv...@gmail.com>.
That's right, It defaults to 32mb for log files but I mean db.data file
--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-delete-consumed-messages-tp4678437p4678481.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: activemq - delete consumed messages
Posted by artnaseef <ar...@artnaseef.com>.
What is the data file size limit? It defaults to 32mb. The active data file is never removed.
Sent from my iPhone
> On Mar 3, 2014, at 12:03 AM, "turkuaz07 [via ActiveMQ]" <ml...@n4.nabble.com> wrote:
>
> Thank you artnaseef, but I have tested a scenario like that;
>
> I sent 1.000.000 object messages to the queue, and my kahadb's db.data file became 480 mb. Then my consumer started to get messages. After a while consuming finished and all messages in the queue reached to the target. But when I checked my db.data file, it was still 480 mb. Thats why I want to delete consumed messages. How can you help me?
>
> 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-tp4678437p4678449.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-tp4678437p4678478.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: activemq - delete consumed messages
Posted by turkuaz07 <cv...@gmail.com>.
Thank you artnaseef, but I have tested a scenario like that;
I sent 1.000.000 object messages to the queue, and my kahadb's db.data file
became 480 mb. Then my consumer started to get messages. After a while
consuming finished and all messages in the queue reached to the target. But
when I checked my db.data file, it was still 480 mb. Thats why I want to
delete consumed messages. How can you help me?
--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-delete-consumed-messages-tp4678437p4678449.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: activemq - delete consumed messages
Posted by artnaseef <ar...@artnaseef.com>.
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...@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.