Apache Camel:保持路由信息完全独立于 Java 代码

发布于 2024-09-25 23:38:06 字数 889 浏览 8 评论 0原文

首先感谢目前参与Camel开发的人们,我感谢他们所付出的辛勤工作。

我正在寻求一些设计建议。

架构是这样的: 我有一堆 Java 类,在实例化时需要相互连接并使用 Apache Camel 发送消息。设计约束要求我创建一个框架,使所有路由信息、生产者、消费者、端点等都应该成为camel-context.xml的一部分。

个人应该有能力修改这样的文件并完全改变现有的路线,而无需提供Java代码。(不会提供Java代码,只提供编译后的Jar)

例如在一个设置中, Bean A -> Bean B->Bean C-> 文件 -> 电子邮件。 在另一个 Bean B->Bean A->Bean C->ftp->文件->电子邮件 我们尝试了各种方法,但是如果原始 bean 没有实现为 Java DSL,消息率会非常高,因为camel 在第一个示例中不断调用 Bean A,在第二个示例中调用 Bean B(它们是来源)。

Bean A 和 Bean B 发起消息并且是事件驱动的。如果发生所需的事件,bean 会发出通知消息。

我的转换非常简单,根本不需要 Java DSL 的强大功能。 总而言之,我有以下问题:

1)考虑到上述限制,我是否确保所有路由信息,包括目标地址,一切都是骆驼上下文文件的一部分?

2)是否有我可以查看的示例来保持路由信息完全独立于java代码?

3)如何确保Camel不会不断调用原始bean?

4) Camel 是否不断调用原始 bean 或它发送的任何 bean?无论 bean 在整个消息传递队列中的位置如何,都可以发送消息?

我已经没有选择尝试各种方法来设置它。任何帮助将不胜感激。

First of all thanks to folks who are currently involved in the development of Camel, I am grateful for all the hard work they have put in.

I am looking for some design advice.

The architecture is something like this:
I have a bunch of Java classes which when instantiated are required to connect to each other and send messages using Apache Camel. The design constraints require me to create a framework such that all routing information, producers, consumers, endpoints etc should be a part of the camel-context.xml.

An individual should have the capability to modify such a file and completely change the existing route without having the Java code available to him.(The Java code would not be provided, only the compiled Jar would be)

For example in One setup,
Bean A ->Bean B->Bean C->file->email.
in another
Bean B->Bean A->Bean C->ftp->file->email
We have tried various approached, but if the originating bean is not implemented as a Java DSL, the messages rate is very high because camel constantly invokes Bean A in the first example and Bean B in the second(they being the source).

Bean A and Bean B originate messages and are event driven. In case the required event occurs, the beans send out a notification message.

My transformations are very simple and I do not require the power of Java DSL at all.
To summarize, I have the following questions:

1) Considering the above constraints, I do I ensure all routing information, including destination addresses, everything is a part of the camel context file?

2) Are there example I can look at for keeping the routing information completely independent of the java code?

3) How do I ensure Camel does not constantly invoke the originating bean?

4) Does Camel constantly invoke just the originating bean or any bean it sends & messages to irrespective of the position of the bean in the entire messaging queue?

I have run out of options trying various ways to set this up. Any help would be appreciated.

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

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

发布评论

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

评论(2

不寐倦长更 2024-10-02 23:38:07

如果您考虑使用 FuseESB 的 ServiceMix,您可能希望将路由分为两部分。

第一部分是触发路由的事件驱动程序 bean。它可以将消息推送到 ServiceNMR(请参阅 http://camel.apache.org/nmr.html)。

另一部分将留给框架用户使用 Spring DSL。它只会监听 NMR 上的消息(通过另一条路线推送)并用它做任何他们想做的事情。

当然,端点定义可以使用 servicemix 配置服务进行属性化(请参阅 http://camel.apache。 org/properties.html#Properties-UsingBlueprintpropertyplaceholderwithCamelroutes)

If you consider using ServiceMix of FuseESB, you might want to separate your routes in two parts.

First part would be the Event-driver bean that trigger the route. It could push messages to the ServiceNMR (see http://camel.apache.org/nmr.html).

The other part would be left to the framework users, using Spring DSL. It would just listen to message on the NMR (push by the other route) and do whatever they want with it.

Of course endpoint definition could be propertized using servicemix configuration service (see http://camel.apache.org/properties.html#Properties-UsingBlueprintpropertyplaceholderwithCamelroutes)

相权↑美人 2024-10-02 23:38:06

在 Camel wiki 页面上阅读有关隐藏中间件的信息。这允许您让客户端使用接口来发送/接收消息,但完全不知道 Camel(根本不使用 Camel API)。

最好考虑购买《Camel in Action》一书并阅读第 14 章,其中讨论了这一点。
http://www.manning.com/ibsen/

购买《曼宁》书籍可节省 41%:骆驼在行动或 ActiveMQ 的实际应用。使用代码 s2941。 10 月 6 日到期。 http://www.manning.com/ibsen/

Read about hiding the middleware on the Camel wiki pages. This allows you to let clients use an interface to send/receive messages but totally unaware of Camel (no Camel API used at all).

Even better consider buying the Camel in Action book and read chapter 14 which talks about this.
http://www.manning.com/ibsen/

Save 41% on Manning books: Camel in Action or ActiveMQ in Action. Use code s2941. Expires 6th oct. http://www.manning.com/ibsen/

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