Page 1 of 1

Exception queue..

Posted: Mon 26 Mar 2012 18:48
by ramana.bhavaraju
Hi,

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

Thanks,
Ramana

Posted: Wed 28 Mar 2012 13:25
by Pinturiccio
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();
...

Posted: Wed 18 Apr 2012 19:28
by ramana.bhavaraju
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);
}

Posted: Mon 23 Apr 2012 10:41
by Pinturiccio
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);
}