现在的位置: 首页 > 综合 > 正文

SQL SERVER SERVICE BROKER – QUEUE Retention

2013年03月13日 ⁄ 综合 ⁄ 共 626字 ⁄ 字号 评论关闭

在创建QUEUE的时候,指定retention也很重要。。

1. 如果retention=on.那么即使message被receive之后,还是留在了queue里面,直到这个conversation被end

ALTER QUEUE [dbo].[targetQueue] WITH STATUS = ON , RETENTION = ON , POISON_MESSAGE_HANDLING (STATUS = ON) 

2. 如果retention=off,则message被receive之后,message就被从queue中remove掉了

在这里,queue中的status也很有趣,一旦被receive之后,就从1变到了0,

Microsoft sql server文档中说到:

Status of the message. The RECEIVE statement returns all messages that have a status of
1. If message retention is on, the status is then set to 0. If message retention is off, the message is deleted from the
queue. Messages in the
queue can contain one of the following values:

0=Retained received message

1=Ready to receive

2=Not yet complete

3=Retained sent message

抱歉!评论已关闭.