且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache Camel 代理不工作

更新时间:2022-10-31 16:41:33

更新:啊,刚刚明白你的问题.一开始就有点第一了.

Update: Ah, just understood your question. Was a bit first in the first place.

在进行代理时,Camel 将调用(到哪个方法/接口和哪些参数)转换为一个 BeanInvocation 对象.然后通过选择的 Camel 端点(在您的情况下为 seda)进行处理.但是您正在尝试将其打印到标准输出,而不是调用 AccountingInterface 的 bean 实例(例如 AccountingUpdateACORDUtil 在您的情况下).

When doing Proxying Camel translates the call (to which method/interface and what arguments) into a BeanInvocation object. That is then passed over the Camel endpoint of choice (seda in your case) to be processed. But you are trying to print it to std out rather than invoke a bean instance of AccountingInterface (such as AccountingUpdateACORDUtil in your case).

不,不同的方法将调用相同的 URL,但在 BeanInvocation 中使用不同的方法.这当然可以通过在 Camel 路由中路由您的请求来实现,例如首先将其发送到一个简单的 direct:routeAccoutingRequest 然后查看调用的方法以确定它应该选择哪个端点构造.

And no, different methods will call the same URL but with .. well, different methods in the BeanInvocation. This can of course be achieved by routing your request in a Camel route such as first sending it to a simple direct:routeAccoutingRequest then look at the invoked method to figure out which endpoint it should go to in a choice construct.

您可以使用带有 ProducerTemplates 的普通对象构建自己的逻辑,以实现发送字符串、调用不同方法等任务.代理用于代理 bean 调用.

You can build your own logic using a plain object with ProducerTemplates to achive things such as sending Strings, invoking different methods etc. The proxy is for proxying bean invocations.