我的要求是我有不同状态的“项目”。我需要根据这些项目的状态(发送电子邮件,存储文件,更新内部应用程序等)执行各种不同的操作。问题是更新这些状态的应用程序是第三方,所以我无法更新它;进一步困难的是,只有一半的组织正在使用这个系统而另一个正在使用它的未来替代品。我对所使用的两个数据库都有开放访问权限。
我的计划是通过Item
表的每个表示形式的触发器向SQL Service Broker Queue添加消息和ID以及状态。然后,从SSB激活过程调用CLR过程,该过程通过NServiceBus将消息添加到发布队列。
在我尝试使用CREATE ASSEMBLY
在SQL中注册我的程序集之前,这一切似乎都很顺利:
Msg 10327, Level 14, State 1, Line 1
Warning: The Microsoft .NET Framework assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
etc. etc. etc.
CREATE ASSEMBLY for assembly 'System.Web' failed because assembly 'System.Web' is not authorized for PERMISSION_SET = UNSAFE. The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.
Msg 10301, Level 16, State 1, Line 2
Assembly 'log4net' references assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
Msg 6218, Level 16, State 3, Line 3
CREATE ASSEMBLY for assembly 'NServiceBus.Core' failed because assembly 'NServiceBus.Core' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message
Msg 6218, Level 16, State 3, Line 4
CREATE ASSEMBLY for assembly 'NServiceBus' failed because assembly 'NServiceBus' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message
首先,我想知道这是否是一个完全疯狂的想法。我希望按顺序处理消息并异步添加到队列中。 NServiceBus提供了一个主机应用程序,可以在需要时轻松启动新的发布者。替代方案似乎是编写一个监视SSB队列然后发布的Windows服务。我只是喜欢一些意见或建议。谢谢。
答案 0 :(得分:3)
在NServiceBus-Contrib中查看SSB传输。
答案 1 :(得分:1)
我可能会使用Windows服务轮询模型。即使这是非令人兴奋的并且引入延迟,至少你可以使一切都很好并且具有事务性,并且可以在一个易于理解的容器中处理故障。我不确定sql-clr在故障条件下或重负载条件下的表现如何。例如,您是否可以从服务代理中排队,然后丢失消息?
只需2美分
修改强>
@Marco向我指出了以下MS示例,用于将SB消息接收到Windows服务中: http://code.msdn.microsoft.com/Service-Broker-Message-e81c4316