OracleQueueAdmin class..

OracleQueueAdmin class..

Postby ramana.bhavaraju » Wed 22 Feb 2012 20:23

Hi,

I am trying to fetch the MaxRetries property on the OracleQueueAdmin class, but it always returns back 0.0 (not sure why this is double data type in the first place). Below is the code. please let me know what i am doing wrong. Also, please let me know how do i get the retrycount on a item in the queue (via c# code), as i need to know how many tries i have before the item moves to exception queue.


using (OracleQueueAdmin adminQueue = new OracleQueueAdmin("ORDERRESULTS_QUEUE", oracleConnection))
{
double d = adminQueue.Options.MaxRetries;
}

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

Postby Pinturiccio » Fri 24 Feb 2012 13:50

ramana.bhavaraju wrote:Below is the code. please let me know what i am doing wrong.

First of all, you should specify the QueueTableName property of the OracleQueueAdmin class. Then, if you want to get the MaxRetries property of 'ORDERRESULTS_QUEUE' queue, you have to call the adminQueue.ReadQueueProperties() method. This methods reads options for a queue, specified in the QueueName property, from a server.
For more information, please refer to http://www.devart.com/dotconnect/oracle ... rties.html

We will get the following code:
Code: Select all
using (OracleQueueAdmin adminQueue = new OracleQueueAdmin("ORDERRESULTS_QUEUE", oracleConnection))
{
adminQueue.QueueTableName = "Your queue table name";
adminQueue.ReadQueueProperties();
double d = adminQueue.Options.MaxRetries;
}

ramana.bhavaraju wrote:Also, please let me know how do i get the retrycount on a item in the queue (via c# code), as i need to know how many tries i have before the item moves to exception queue.

You can find the retry count with an OracleQueue instance. You can use the following code:
Code: Select all
OracleQueue OraQueue = new OracleQueue("ORDERRESULTS_QUEUE", oracleConnection);
Console.WriteLine(OraQueue.EnqueueMessageProperties.Attempts);

For more information, please refer to http://www.devart.com/dotconnect/oracle ... empts.html
Pinturiccio
Devart Team
 
Posts: 1852
Joined: Wed 02 Nov 2011 09:44

The attempts count did not work..

Postby ramana.bhavaraju » Mon 26 Mar 2012 17:20

The first code worked, but the attempts count is always returning back a zero. Also i am surprised that the API is on the Queue object and not on the item, as i expected each item in the queue to have a different attempt count. Please let me know what i am doing wrong. Below is the code i am using.

using (OracleQueue queue = new OracleQueue("ORDERRESULTS_QUEUE", oracleConnection))
{

int attempt = queue.EnqueueMessageProperties.Attempts;
}
ramana.bhavaraju
 
Posts: 14
Joined: Thu 28 Jan 2010 17:13

Postby Pinturiccio » Tue 27 Mar 2012 12:01

ramana.bhavaraju wrote:The first code worked, but the attempts count is always returning back a zero.

The value of the Attempts property will increase only when dequeuing message fails. If dequeuing is completed normally then the message is dequeued and Attempts does not change. So the MaxRetries property shows how many times you can fail in dequeue and the Attempts property shows how many times you have already failed.
ramana.bhavaraju wrote:Also i am surprised that the API is on the Queue object and not on the item, as i expected each item in the queue to have a different attempt count.

Attempts is a property of the OracleQueueMessageProperties class. The OracleQueueMessageProperties of the OracleQueueMessageProperties class the information that AQ uses to manage individual messages. You have access to the OracleQueueMessageProperties class via the QueueOracle instance.
Code: Select all
queue.EnqueueMessageProperties

This code allows you getting or setting the message property for the message connected with OracleQueue object.
Pinturiccio
Devart Team
 
Posts: 1852
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for Oracle