惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
G
Google Developers Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
爱范儿
爱范儿
罗磊的独立博客
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
C
Check Point Blog
美团技术团队
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - vuejs3

[转]Android试验:如果View的ID相同会出现什么效果? 父子关系排序,无确定根节点 Silverlight 操作技巧 [文摘]怎么使用Sticky Footer代码(让页脚紧贴页面底部的方法) Sharepoint development toolbox 通过对象模型上传List Template - vuejs3 - 博客园 在文档库中隐藏多文件上传/Disable the Upload Multiple Document option in Document Library - vuejs3 [转]SharePoint Document Library and List – File Upload ASP.NET 2.0 TreeView控件在IE7中断开的连接线 Team Foundation Server讲义 通过CertEnroll在CA上(1创建证书请求2得到证书3安装证书) 如何在WSS中利用KeywordQuery创建搜索查询 SharePoint Web Service的身份验证 SharePoint开发中对ListViewWebPart的几个操作 【转】免费SharePoint资源 Enum操作技巧 LINQ概述-通用和便利的信息查询方式 NetShopForge网上商店程序(VB)源码—讨论-发布 Microsoft AJAX添加自定义智能感知(intellisense)
More on SQL Server Service Broker
vuejs3 · 2011-01-30 · via 博客园 - vuejs3

In earlier posts I already blogged about creating some simple queuing solutions with SQL Server Service Broker. Last week I spend some time actually implementing my research in a customer project and of course ran into two 'interesting' issues.

  1. It is possible for the Service Broker to somehow die on you, whilst appearing to be up and running and with RETENTION=ON sent message appear to be in the queue.

    When using the SQL Profiler it becomes clear that messages don't get processed because the Service Broker is not enabled.

    You can use the following statement to enable Service Broker:

    alter database PFA_DATA set ENABLE_BROKER

    I had to do it on two machines and on of them gave me the following error:

    Msg 9772, Level 16, State 1, Line 2
    The Service Broker in database "PFA_DATA" cannot be enabled because there is already an enabled Service Broker with the same ID.
    Msg 5069, Level 16, State 1, Line 2
    ALTER DATABASE statement failed.

    So instead I used:

    alter database PFA_DATA set NEW_BROKER

    After this the Service Broker was up and running and message started getting delivered.

    If the query takes extremely long to complete restart SQL Server and try again.

    One potential cause for this is when you restore a database.

  2. In my earlier post I just blatantly used WITH CLEANUP to avoid getting EndDialog messages.
    The documentation however states:

    WITH CLEANUP
    Remove all messages and catalog view entries for this side of the conversation without notifying the other side of the conversation. Microsoft SQL Server drops the conversation endpoint, all messages for the conversation in the transmission queue, and all messages for the conversation in the service queue. Use this option to remove conversations which cannot complete normally. For example, if the remote service has been permanently removed, you use WITH CLEANUP to remove conversations to that service.

    So use this sparingly.

    I've discovered a much cleaner way to handle it.
    When sending a message you can use "END CONVERSATION @dialog" to specify that as far as the sender is concerned the dialog is over. In other words: a fire and forget message.
    When the receiving side of the conversation receives the messages and performs its "END CONVERSATION" statement, Service Broker will detect that no acknowledgement (EndDialog) needs to be send.

posted on 2011-01-30 11:28  vuejs3  阅读(518)  评论()    收藏  举报