在 .NET 上使用 Spring NMS 在 ActiveMQ 和 Camel 上进行请求回复所需的建议

发布于 2024-09-01 07:09:39 字数 778 浏览 3 评论 0原文

我正在尝试使用 Spring 和 NMS 在 .NET 上使用 ActiveMQ 和 Camel(在代理中运行)。总的来说,这些组件工作得很好。我有一个用于发送/接收的骆驼路由,以及 .NET 中的一些代码来处理这个问题 - 就像一个魅力。

我试图解决的问题是请求-答复集成模式。 Camel 支持这一点,我的配置中有这个路由:

  <route>
    <from uri="activemq:foo"/>
    <to uri="activemq:bar" pattern="InOut"/>      
  </route>

理论上,Camel 应该在这样的路由中设置 NMSReplyTo 和 CorrelationID,以便回复知道要返回到哪里。

我按照这篇非常有用的文章了解如何在 .NET 中将事物连接在一起。在本文中,代码显式设置了回复的位置,因为它没有使用 Camel。

我的问题是如何利用 Camel 路线,因此我基本上不必在代码中复制它(这会破坏基于配置的集成模式的目的)。我尝试删除代码中的 NMSReplyTo 和 CorrelationID,但回复永远不会返回给发件人。这几乎就像 Camel 路线没有被应用程序“内化”一样。

想法?建议?

谢谢, 切特

I am trying to use the ActiveMQ and Camel (running in broker) on .NET using Spring and NMS. In general, these components work brilliantly. I have a camel route for send/receive, and some code in .NET to handle this - works like a charm.

The issue I am trying to resolve is for a request-reply integration pattern. Camel support this, and I have this route in my config:

  <route>
    <from uri="activemq:foo"/>
    <to uri="activemq:bar" pattern="InOut"/>      
  </route>

In theory, Camel is supposed to set the NMSReplyTo and CorrelationID in such a route so the reply knows where to go back to.

I followed this VERY helpful article to understand how to wire things together in .NET. In the article, the code explicitly sets the location of the reply, since it is not using Camel.

My question is how do I take advantage of the Camel route, so I don't have to essentially duplicate it in code (which would defeat the purpose of a config based integration pattern). I tried removing the NMSReplyTo and CorrelationID in my code, but the reply never gets back to the sender. It's almost like the Camel route is not 'internalized' by the application.

Thoughts? Suggestions?

Thanks,
Chet

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜尕妞 2024-09-08 07:09:39

take a look at this pattern and the associated unit test...should help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文