【发布时间】:2013-07-26 00:15:51
【问题描述】:
谁能帮助我配置两个具有相同基本 URI 和 Apache FUSE ESB 的 JAX-RS 服务?我正在使用带有 karaf 容器、Apache Camel 和 CXF (JAX-RS) 的 JBoss FUSE 6.0 版本。配置是使用蓝图完成的。当我只配置一个 JAX-RS 服务时,一切正常。
我正在尝试使用基本 URI http://localhost:9001/rs 提供两个 JAX-RS Bean。第一个bean为http://localhost:9001/rs/rest1,第二个为http://locahost:9001/rs/rest2。
我已经用码头端点定义了两个骆驼上下文。我想我需要两个只使用一个配置的实例,但无法弄清楚如何做到这一点。
这是我的骆驼语境:
<camel:camelContext id="context1">
<camel:endpoint id="ep1" uri="jetty:http://localhost:9001/rs/?matchOnUriPrefix=true"/>
<camel:route autoStartup="true">
<camel:from uri="ep1"/>
<camel:to uri="cxfbean:restBean1"/>
<camel:log message="Message received after REST Processor. "/>
<camel:convertBodyTo type="java.lang.String"/>
<camel:to uri="log:loggingCategory?level=INFO"/>
</camel:route>
</camel:camelContext>
<camel:camelContext id="context2">
<camel:endpoint id="ep2" uri="jetty:http://localhost:9001/rs/?matchOnUriPrefix=true"/>
<camel:route autoStartup="true">
<camel:from uri="ep2"/>
<camel:to uri="cxfbean:restBean2"/>
<camel:log message="Message received after REST Processor. "/>
<camel:convertBodyTo type="java.lang.String"/>
<camel:to uri="log:loggingCategory?level=INFO"/>
</camel:route>
</camel:camelContext>
两个 Bean 都作为服务引用注入,当我评论其中一条路由时,一切正常。
有什么建议可以在骆驼中配置吗?
干杯, 奥利弗
【问题讨论】:
标签: jetty jax-rs apache-camel blueprint-osgi