Nservicebus MSMQ使用网关到天蓝色队列 [英] Nservicebus msmq to azure queue using gateway
问题描述
使用Bus.SendToQueues时出现错误,问题末尾出现详细错误。
I'm getting an error when using Bus.SendToQueues, detailed error at end of question.
我有一个使用存储帐户和密钥设置的天蓝色队列并且我正在尝试使用Bus.SendToSites使用msmq将本地服务总线处理程序发送消息到azure站点。
I have an azure queue set up with a storage account and key and I'm trying to use Bus.SendToSites to have an on premise servicebus handler using msmq send a message to the azure site.
试图使网关正常运行,因为每个: http://support.nservicebus .com / customer / portal / articles / 859548-the-gateway-and-multi-site-distribution ,而我正在使用以下配置:
Trying to get a gateway going, as per: http://support.nservicebus.com/customer/portal/articles/859548-the-gateway-and-multi-site-distribution, and I'm using this configuration:
App.config:(我是否正确设置了网站?)
App.config: (Am I setting up the site correctly?)
<section name="GatewayConfig" type="NServiceBus.Config.GatewayConfig, NServiceBus.Core" />
<GatewayConfig>
<Sites>
<Site Key="Azure" Address="http://<!--STORAGE ACCOUNT NAME-->.queue.core.windows.net/<!--STORAGE ACCOUNT KEY-->" ChannelType="Http"/>
</Sites>
</GatewayConfig>
处理程序:
Bus.SendToSites(new[] { "Azure" }, message);
在运行时,我得到以下信息:
At runtime, I'm getting the following:
错误:
无法向该地址发送消息:分发服务器的数据地址,用作此端点发送的消息的返回地址。.gateway@ HFORTE
error: Failed to send message to address: The distributor's data address, used as the return address of messages sent by this endpoint..gateway@HFORTE
内部异常:{格式名称无效。}
Inner Exception: {"Format name is invalid."}
堆栈跟踪:
,位于System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle()
,位于System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS属性,ITransaction交易),
,位于System.Messaging.MessageQueue.StaleSafeSendMessage (MQPROPS属性,IntPtr事务)System.Messaging.MessageQueue.SendInternal(对象obj,MessageQueueTransaction internalTransaction,MessageQueueTransactionType transactionType)
在System.Messaging.MessageQueue.Send(对象obj,MessageQueueTransactionType transactionType)
在NServiceBus.Transports.Msmq.MsmqMessageSender.Send(Tra nsportMessage消息,地址地址):第0行
Stacktrace: at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at System.Messaging.MessageQueue.Send(Object obj, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in :line 0
我看到传输是MSMQ-是问题所在,MSMQ和Azure是不同的传输协议,如果这样
I see that the transport is MSMQ - is that the problem, that MSMQ and Azure are different transport protocols, and if so, how is this remedied?
推荐答案
要使用网关,必须在两端都托管NSB-发送方和接收方。网关只是为NSB终结点打开WCF服务,因此您可以使用HTTP协议发送消息。
To use gateways you must have NSB hosted on both sides - sender and receiver. Gateways just open WCF service for NSB endpoint so you can send messages using HTTP protocol.
MSMQ和Azure队列传输无法结合在一个解决方案中,因为IBus实例是单例每ce。我们必须使用RavenDb开发我们自己的桥服务。我们选择Raven是因为它具有RX驱动的事件订阅机制,该机制也易于使用。由于RavenDb是文档数据库,我们还可以按原样保存消息(包装在某些容器中),因为RavenDb是文档数据库。
MSMQ and Azure queue transports cannot be combined in one solution because the IBus instance is a singleton per ce. We had to develop our own "bridge" service using RavenDb. We chose Raven since it has RX-driven event subscription mechanism that is also easy to use. We are also able to save messages (wrapped in some containers) as-is without much dance around since RavenDb is a document database.
这篇关于Nservicebus MSMQ使用网关到天蓝色队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!