【问题标题】:JBoss Fuse - Maven Archetype Blueprint - Camel - RoutingJBoss Fuse - Maven 原型蓝图 - Camel - 路由
【发布时间】:2015-04-09 19:14:52
【问题描述】:

我正在尝试使用JBoss FuseMaven 构建一个简单的Camel 路由。我正在使用命令mvn archetype:generate 创建一个骨架项目。

当提示说“选择一个数字或应用过滤器(格式:[groupId:]artifactId,区分大小写包含):582:”时,我输入camel

然后我选择这个选项:49: remote -> org.apache.camel.archetypes:camel-archetype-blueprint (Creates a new Camel project with OSGi blueprint support. Ready to be deployed in OSGi.)

请看下面:

Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 我为此选项键入 49

对于 Choose org.apache.camel.archetypes:camel-archetype-blueprint version: 选项,我在 Camel 2.15.1 中按 Enter。

Define value for property 'groupId': :org.me

对于选项: Define value for property 'artifactId': : fuse-ghettoblasting-blueprint

对于选项: Define value for property 'version': 1.0-SNAPSHOT: :1.0

对于选项: Define value for property 'package': org.me: :org.me.demo

我运行此命令mvn clean install 将 pom.xml 和 jar 安装到我的本地 Maven 存储库。

然后我转到 JBoss Fuse 控制台并输入:

JBossFuse:karaf@root> osgi:install mvn:org.me/fuse-ghettoblasting-blueprint/1.0

然后我收到一个捆绑包 ID: Bundle ID: 389

当我输入JBossFuse:karaf@root> list 我看到了捆绑包,但它在蓝图字段中显示Failure,如下所示: ID 状态蓝图 Spring 级别名称 `[389] [活动] [失败] [] [60]骆驼蓝图路线(1.0.0)

我在运行本教程时也有类似的经历:https://codevomit.wordpress.com/2014/12/24/simple-camel-route-in-jboss-fuse/

本教程涉及在运行在 8181 端口的 localhost 上的 ActiveMQ 接口中实际创建路由

是否有专家在阅读本文并知道我缺少什么?为什么蓝图失败了?为什么从队列发送的消息没有记录,如 CodeVomit 教程中所示?

问候,

更新

这是我的 blueprint.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"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">


<!-- connect to the local ActiveMQ broker -->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="brokerURL" value="tcp://localhost:61616" />
  <property name="userName" value="user123" />
  <property name="password" value="user123" />
  <property></property>
</bean>

  <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">

    <route id="queue2queue">
        <from uri="activemq://source-queue" />
        <log message="the message body is: ${body}" loggingLevel="INFO" />
        <to uri="activemq://sink-queue" />
    </route>



  </camelContext>

</blueprint>

【问题讨论】:

  • 如果要连接本地broker,可以省略“activemq”声明。 JBoss Fuse 6.1 中有一个示例,请参阅快速入门 - 有使用 ActiveMQ + Camel 的 JMS 示例。
  • 当您编写“'activemq' 声明”时,您的意思是在&lt;to&gt;&lt;from&gt; 元素中的&lt;route&gt; 元素中吗?感谢您的有用回复!

标签: java maven jboss apache-camel blueprint


【解决方案1】:

您应该使用与 JBoss Fuse 支持/随附的相同版本的 Apache Camel。 Camel 2.15.x 尚不支持,这需要即将发布的 JBoss Fuse 6.2 版本。

您可以使用 Fuse IDE 工具创建使用正确版本的 Camel 的 Fuse 项目。

另一种方法是将原型生成的pom.xml 调整为与 Fuse 相同的 Camel 版本。您可以通过键入 list 从 Fuse shell 中找到 Camel 版本,然后找到应该打印版本的 camel-core 行。

【讨论】:

  • 我尝试了您的“替代”方法,因为 Fuse IDE 的学习曲线非常令人生畏,而且在启动捆绑包时我仍然收到蓝图 [失败]。感谢您通过克劳斯猜测我的程序出了什么问题。 :D
  • 您可以尝试查看日志文件,在 data/logs/fuse.log 文件中。或者从 shell 使用 log:display - 后者只显示 1000 行(我认为)
  • 它在将“jms”快速入门中提到的 cfg.xml 文件复制到 etc 文件夹并使用 id=activemq 删除 bean 元素时起作用。 :) 感谢您的帮助。也许在你的回答中提到这一点,为一些陷入困境的可怜的程序员提供一些可靠的帮助? :D
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-10-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-21
  • 1970-01-01
相关资源
最近更新 更多