卡拉夫使用春季骆驼路线,但没有使用java DSL骆驼路线

时间:2013-09-04 10:22:53

标签: spring apache-camel apache-karaf smpp blueprint-osgi

我开发了一个在karaf中使用camel smpp路由的项目 一开始我用春天来写我的骆驼路线。这很好。
后来我尝试使用java DSL来编写camel smpp路由,但是我所做的一切,结果就是这样。

org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[smpp://username@localhost:2775?pa... because of Failed to resolve endpoint: smpp://username@localhost:2775?password=apassword due to: No component found with scheme: smpp

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:   smpp://username@localhost:2775?password=apassword due to: No component found with scheme: smpp

我甚至尝试过蓝图来调用创建java DSL camel路由的bean,但仍然可以使用上面的内容。

来自karaf控制台:

karaf@root> list | grep smpp
[ 171] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jsmpp (2.1.0.4)
[ 172] [Active     ] [            ] [       ] [   50] camel-smpp (2.11.0)
karaf@root> features:list | grep smpp
[installed  ] [2.11.0         ] camel-smpp                              camel-2.11.0

我想要的是这个来自bean的片段,无论是春天还是蓝图:

context.addRoutes(new RouteBuilder() {
    public void configure() {
        fromF("smpp://%s@%s:%s?password=%s", username, destination, port, password)
        .bean(new SmsReceiver(), "printPdus");
    }
});             
context.start();

如何使java DSL smpp路由工作?为什么smpp路由在春天工作但java DSL smpp不工作?我应该安装或搜索什么?

2 个答案:

答案 0 :(得分:0)

请参阅使用Java代码部分的http://camel.apache.org/spring页面如何从spring xml文件中引用<豆>这是Java RouteBuilder类。这是让它在OSGi中运行的方法。

答案 1 :(得分:0)

似乎您正在直接使用驼峰上下文并且您将路由添加到上下文实例(创建如何?)。如果创建DefaultCamelContext实例,则需要配置特定的组件解析程序(请参阅org.apache.camel.core.osgi.OsgiComponentResolver)。