2

这部分难题是我的噩梦,我在 2 个不同的 tomcat 实例上部署了 ServiceMix 和 2 个 Java 应用程序:

第一个应用程序:

http://localhost:8080/textmsgClient

第二个应用程序:

http://localhost:8181/textmsgServer

现在我的两个应用程序需要通信,尽管我希望通过 ServiceMix 进行通信,所以我可以做一些日志和所有事情。

我已经在./deploy目录中创建了一个蓝图 XML 文件,但我应该在其中放置哪些路由?

我不能这样做:

  <route>
    <from uri="http://localhost:8080/textmsgClient"/>
    <log message="Test log"/>
    <to uri="http://localhost:8181/textmsgServer"/>
  </route>

那么正确的做法是什么?

顺便说一句,我的 XML 文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint
    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
      http://www.osgi.org/xmlns/blueprint/v1.0.0
      http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <route>
        <from uri="file:camel/input"/>
        <log message="Moving ${file:name} to the output directory"/>
        <to uri="file:camel/output"/>
      </route>
    </camelContext>

</blueprint>
4

1 回答 1

2

看看Camel Components的列表。不知道您在服务之间发送什么类型的数据,很难推荐使用哪一种。但是,您可以想象的几乎所有数据类型都有一个组件,甚至支持您自己制作!

编辑 一个例子可能是:

<route>
    <from uri="direct:textmsgClient"/>
    <log message="Test log"/>
    <to uri="direct:textmsgServer"/>
</route>
于 2014-06-23T12:59:40.027 回答