Hi All,
We use service bus 1.0 in our project as data exchange center. some times, some message will be put into deadletter queue because some reason. i hope this message in deadletter queue is deferred. so we use the defer() method in BrokeredMessage class to change the status.
but unfortunately, the status is not change. in my understand, the value of state field in MessagetTable table will became to 2, because before it change from 0 to 2 after we do defer for one message. but now it don't change, i don't know why, and there is not any exception been throw out, during do defer operation.
below are my simple code about how to defer a deadletter queue message:
QueueClient client = messagingFactory.CreateQueueClient(QueueClient.FormatDeadLetterPath(queueName));
bool canCountinue = false;do
{
BrokeredMessage message = client.Receive();
if (message != null)
{
message.Defer();
canCountinue = true;
}
else
{
canCountinue = false;
}
} while (canCountinue);
client.Close();
so, did any one know what's wrong in my code or there are some precondition need to note before do defer operate?
-----------------------------------------------------------------------------------------------
i found not all deadletter message can not defer. just the message which is been move from queue to deadletter queue by service bus automatic cannot be defer. if you move a message from queue to deadletter queue by manual invoke deadletter() method, then invoke defer() method, this message will be successfully.