是否有适用于 WCF 的 Pub/Sub 的 nServiceBus 示例?
这是一个非常常见的模式,我发现它的实现是一场噩梦!
--
WcfIntegration 示例几乎就是我正在寻找的示例,因为它通过 WCF 端点接收消息。然而,它会自行接收消息。我想要一个单独的订户。
所以我想做的是合并 WcfIntegration 和 pub/sub 示例。
真正的需要是网站调用类库,然后类库调用发布者的 WCF 端点。
然后,订阅者选择接收发布者发布的消息,并对其执行任何操作。
——
罗布
It's a really common pattern and I'm finding it a nightmare to implement!
--
The WcfIntegration sample is almost what I'm looking for in that it receives messages via a WCF endpoint. However, it receives messages back on itself. I want a separate subscriber.
So what I'm trying to do is merge the WcfIntegration and pub/sub samples.
The real need is for a website to call a class library, which then calls the WCF endpoint of the publisher.
A subscriber then picks receives a message that the publisher publishes, and does whatever with it.
--
Rob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我的本地示例中,我将消息映射到我自己。对于您来说,这将是:
您还需要将您的发布移动到实际的处理程序。目前,它只发生一次(在启动时):
确保您的基础设施已准备就绪,即队列是事务性的,并且 MSDTC 正在运行。
我敢打赌,由于没有映射,一旦调用服务,它就不知道将消息放在哪里(它在内部调用
Bus.Send()
)。我没有查看订阅者,因为这似乎不是问题。IEventMessageService
; NSB handles that for you.In my local example, I mapped the messages to myself. For you this would be:
You also need to move your Publish to the actual handler. Right now, it is only happening once (at startup):
Make sure your infrastructure is primed, i.e. the queue is transactional, and MSDTC is running.
I'm willing to bet that since there is no mapping, once the service is called, it doesn't know where to put the messages (it calls
Bus.Send()
internally). I didn't look at the subscribers since that didn't seem to be the issue.我终于让它在这里工作了:-
http://code. google.com/p/nservicebus-wcf-pubsub/downloads/list
欢迎任何人改进代码。
I've finally got it to work here:-
http://code.google.com/p/nservicebus-wcf-pubsub/downloads/list
Anyone is welcome to improve the code.