HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Oracle Advanced Queuing LIFO

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
oracleadvancedlifoqueuing

Problem

With Oracle's Advanced Queuing is there a way to dequeue messages in a LIFO (last in first out) order? There is an indication through a lack of information that this is not an option, but perhaps there is a way to do this such as queuing in a different order.

Solution

Assuming that you are using PL/SQL to dequeue the message (there may be additional JMS limitations-- I don't know enough about the interplay between JMS and AQ), you should be able to use a priority queue to implement LIFO (though it would be a bit hokey). When you enqueue a message, you can specify a priority


The priority attribute specifies the
priority of the message. It can be any
number, including negative numbers. A
smaller number indicates higher
priority.

If you create a sequence that counts back from some really large number, you could assign an ever increasing priority. Then your prioritized dequeue would get messages in a LIFO order.

Context

StackExchange Database Administrators Q#1415, answer score: 6

Revisions (0)

No revisions yet.