Q:

Lifetime of messages in a message queue

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:

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.

