Oracle Advanced Queuing LIFO

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.


To get LIFO behavior in Oracle, you could implement a stack using a PL/SQL object:

A stack holds an ordered collection of data items. Stacks have a top and a bottom. Items can be added or removed only at the top. So, the last item added to a stack is the first item removed. (Think of the stack of clean serving trays in a cafeteria.) The operations push and pop update the stack while preserving last in, first out (LIFO) behavior.

Stacks have many applications. For example, they are used in systems programming to prioritize interrupts and to manage recursion. The simplest implementation of a stack uses an integer array, with one end of the array representing the top of the stack.

Then you would need to wrap your enqueue/dequeue functions so instead of passing through to AQ, they would instead go to your stack rather than the AQ tables.