Exception queue..

Exception queue..

Postby ramana.bhavaraju » Mon 26 Mar 2012 18:48

Hi,

Is there anyway to dequeue (retrieve an item) from the exception queue, via code.

Thanks,
Ramana
ramana.bhavaraju
 
Posts: 14
Joined: Thu 28 Jan 2010 17:13

Postby Pinturiccio » Wed 28 Mar 2012 13:25

Yes, you can dequeue messages from the exception queue. Each queue table contains a default exception queue. The exception queue is not dequeue-enabled by default, so you have to start this queue. When a message goes to the exception queue, the name of this message is changed to AQ$__E.
I'm posting here a small example where I dequeue a message from the exception queue. Let's consider that tha name of our queue table is QUEUE_TABLE:
Code: Select all
...
OracleQueueAdmin adm = new OracleQueueAdmin("AQ$_QUEUE_TABLE_E", "QUEUE_TABLE", conn);
adm.StartDequeue();
OracleQueue oracleDequeueQueue = new OracleQueue("AQ$_QUEUE_TABLE_MESSAG_E", conn);
OracleQueueMessage msg = oracleDequeueQueue.Dequeue();
...
Pinturiccio
Devart Team
 
Posts: 2024
Joined: Wed 02 Nov 2011 09:44

Postby ramana.bhavaraju » Wed 18 Apr 2012 19:28

Can we dequeue the item from error queue multiple times using code below.

using (OracleQueue exceptionQueue = new OracleQueue(queue.ExceptionQueueName, conn))
{

OracleQueueDequeueOptions options = new OracleQueueDequeueOptions();
options.WaitTimeout = 0;
options.DequeueMode = OracleQueueDequeueMode.Browse;OracleQueueMessage msg = exceptionQueue.Dequeue(options);
}
ramana.bhavaraju
 
Posts: 14
Joined: Thu 28 Jan 2010 17:13

Postby Pinturiccio » Mon 23 Apr 2012 10:41

Your exceptionQueue and options objects are not aware of each other. I have modified your code a bit, and now you can dequeue the item without deleting it from the exception queue.
Code: Select all
using (OracleQueue exceptionQueue = new OracleQueue(queue.ExceptionQueueName, conn))
{
   exceptionQueue.DequeueOptions.WaitTimeout = 0;
   exceptionQueue.DequeueOptions.DequeueMode = OracleQueueDequeueMode.Browse;
   exceptionQueue.Dequeue(options);
}
Pinturiccio
Devart Team
 
Posts: 2024
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for Oracle