| Start |
|---|
Simple Producer/Consumer OverviewCreate a queue that we can send a message to. Oracle will notify our stored procedure that a message has been enqueued and should be worked. We'll also add some subprograms we can use in an emergency to stop messages from being deqeued, allow dequeuing again, and run a simple batch job to work through all of the messages. These examples were tested on Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production. Create QueueWe will create a message type, a queue table that can hold the messages, and a queue. Messages in the queue will be dequeued first by priority then be their enqueue time. If anything goes wrong working the message and the dequeue is rolled-back AQ will make the message available for dequeue 3600 seconds later. It will do this 48 times before moving it an exception queue. Now that we have a place to put the messages lets create a package to manage and work messages in the queue. Next tell AQ that when a message is enqueued to MESSAGE_Q (and committed) notify our procedure it has work to do. AQ will start up a job in its own session to handle this. Start Queue and Send a MessageRemarks |
Read Article
https://develop.horje.com/learn/1434/reference