tags:

views:

295

answers:

2

How do you control the lifetime of a message in a message queue? What is the default lifetime? I tried running message queues locally and I find that the messages disappear on a system restart. Doesn't this defeat the purpose of the message queue in building loosely coupled applications. Does it mean when messages are sent to another machine for processing it will not be available the next day. Some guidance here is highly appreciated as I am not clear on these aspects of the message queuing system.

A: 

What are you setting the TimeToBeReceived property to?

The message queues are stored on the disk, so rebooting shouldn't get rid of them unless they've expired.

Also be aware that if you send a message to a queue that doesn't exist it will be discarded - make sure you set up the queue before using it.

Adam Davis
A: 

There are two kind of non-transactional messages. There is express message and recoverable message. The express message will be gone on a server( or msmq service I think) restart. The express message is the default kind in .net api and in com api. To make the message persistent you have to set the Recoverable property to true. Here is the plumber explanation.

There are other properties to control the lifetime of the message. But their default is forever.

Remember also that those are message properties and not queue properties.

Igal Serban