【发布时间】:2015-04-09 19:14:52
【问题描述】:
我正在尝试使用JBoss Fuse 和Maven 构建一个简单的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' 声明”时,您的意思是在
<to>和<from>元素中的<route>元素中吗?感谢您的有用回复!
标签: java maven jboss apache-camel blueprint