Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle AQ same message is delivered twice

I created a AQ in oracle and wrote 2 JMS consumers in Java to listen to the queue. I have observed sometimes that if I produce some message in to queue; the count of dequeued messages from queue is greater than what enqueued. It means that some messages are consumed twice.

I have created queue with property:- multiple_consumers => FALSE

And JMS consumers are working in CLIENT_ACKNOWLEDGE mode

Please help me learn the possible reasons for such behavior and it's solution. So, that I can replicate the problem and solve above issue and ensure that the number of message enqueued is equal to number of message dequeued in case of multiple JMS consumers listening to same AQ .

like image 404
dinesh028 Avatar asked May 10 '13 06:05

dinesh028


People also ask

What is enqueue and dequeue in Oracle?

When two messages are enqued with the same priority, the message which was enqued earlier will be dequeued first. However, if two messages are of different priorities, the message with the lower value (higher priority) will be dequeued first.

Can a queue receive messages from many senders?

A queue is a destination to which producers send messages and a source from which receivers consume messages. Each message is delivered to only one receiver. Multiple receivers may listen on a queue, but each message in the queue may only be consumed by one of the queue's receivers.

What is enqueue in queue messaging system?

Enqueued messages are said to be propagated when they are reproduced on another queue, which can be in the same database or in a remote database. Applications often use data in different formats. A transformation defines a mapping from one data type to another.

What is AQ tables in Oracle?

The AQ$ Queue_Table_Name view describes the queue table in which message data is stored. This view is automatically created with each queue table and should be used for querying the queue data. The dequeue history data (time, user identification and transaction identification) is only valid for single-consumer queues.


1 Answers

Without having seen your code, CLIENT_ACKNOWLEDGE typically says you are sending acknowledgements manually. If you do not send an ack, the message won't get deleted and the broker will try to redeliver it at a later stage (like when you restart the connection or similar). This might be the cause of your concern.

like image 172
Petter Nordlander Avatar answered Oct 06 '22 19:10

Petter Nordlander