sql - 从 SQL Server Service Broker 提取消息

标签 sql .net sql-server nservicebus

如何从 SQL Server Service Broker 提取消息?我正在使用nservicebus。

我的 SQL Server Service Broker 队列中有消息,但我不确定如何处理它们。

非常感谢

最佳答案

这段代码会对你有所帮助。 声明@messageType SYSNAME 声明@conversationHandle UNIQUEIDENTIFIER 声明@Handle UNIQUEIDENTIFIER 声明 @MessageBody Nvarchar(max)

DECLARE @conversation_group_id UNIQUEIDENTIFIER ;

WAITFOR(
GET CONVERSATION GROUP @conversation_group_id
     FROM [UpdateReceiveQueue]
     );

WAITFOR (
      RECEIVE TOP(1)
            @messageType=message_type_name,
            @MessageBody=message_body,
            @conversationHandle=conversation_handle
            FROM [UpdateReceiveQueue] where conversation_group_id = @conversation_group_id
),timeout 2000;    

print @MessageBody

请使用此link获取更多信息。

关于sql - 从 SQL Server Service Broker 提取消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16544080/

相关文章:

mysql - SQL/MySQL : Two statements in one query

PHPMYadmin 表迁移

c# - 闹钟应用帮助(AI)

c# - 在 Web API 2 的自定义绑定(bind)器中使用默认 IModelBinder

sql-server - 如何将图像插入到sql server数据库中?

sql - 30/60/90天求和查询

SQL Azure 链接数据库

.net - 多线程最佳实践

sql - 在 SQL Server 中替换

sql-server - SQL 服务器 2008 : Unique constraint for values non-related with columns