Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache ActiveMQ 5.3 - How to configure a queue to reject duplicate messages?

Tags:

activemq

I need the queue to enforce no-duplicate policy. Is it possible? If so , how? (I've been googling for hours... )

Edit:

The ActiveMQSession implementation has this lines:

        // transform to our own message format here
            ActiveMQMessage msg = ActiveMQMessageTransformation.transformMessage(message, connection);

        // Set the message id.
        if (msg == message) {
            msg.setMessageId(new MessageId(producer.getProducerInfo().getProducerId(), sequenceNumber));
        } else {
            msg.setMessageId(new MessageId(producer.getProducerInfo().getProducerId(), sequenceNumber));
            message.setJMSMessageID(msg.getMessageId().toString());
        }

The ActiveMQMessageTransformation is plugable (you can set it) , but the following if statement is a rather incontrovertible .

Any ideas , except changing their code?

like image 248
Yossale Avatar asked Dec 08 '09 17:12

Yossale


People also ask

How do you clean up ActiveMQ?

Log in as administrator into Apache ActiveMQ. Click Manage ActiveMQ broker, then click Queues. Click Delete in the operations column for the queue that you want to delete.

How do I create a queue in ActiveMQ?

Select Queues from the menu bar of the ActiveMQ admin console. Enter a queue name in the field Queue Name E.g. Test_queue and click on Create. The queue is created and displayed in the Queues section. The JMS Queue is created.

How does ActiveMQ queue work?

How does ActiveMQ work? Written in Java, ActiveMQ translates messages from sender to receiver. It can connect multiple clients and servers and allows messages to be held in queue, instead of requiring both the client and server to be available simultaneously in order to communicate.

How many messages can ActiveMQ handle?

ActiveMQ has a settings which limits number of messages that can be browsed by a client. By default, it's 400. This setting prevents QueueExplorer to read all (or top 1000, Top 10000, etc) messages from the queue.


1 Answers

ActiveMQ has duplicate message detection built in - how are you defining a duplicate ? If the duplicate has the same messageId - it should be discarded

like image 132
Rob Davies Avatar answered Oct 19 '22 22:10

Rob Davies