It is also important to specify a retention when creating a queue ..
1. If retention = on. Then, even if the message is receive, it will remain in the queue until the conversation is ended
Alter queue [DBO]. [targetqueue] with status = on, retention = on, poison_message_handling (status = on)
2. If retention = off, after the message is receive, the message is removed from the queue.
Here, the status in the queue is also interesting. Once it is received, it is changed from 1 to 0,
The Microsoft SQL Server document says:
Status of the message. The receive statement returns all messages that have a status
1. If message retention is on, the status is then set to 0. If message retention is off, the message is deleted from
Queue. messages in
Queue can contain one of the following values:
0= Retained received message
1= Ready to receive
2= Not yet complete
3= Retained sent message