当前位置: 首页 > 知识库问答 >
问题:

Camel ActiveMq蓝图

缑桐
2023-03-14

我对骆驼和蓝图都很陌生。

我试图做一个简单的程序,把数据放在队列中。不知道这里出了什么问题。

<?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">

    <bean id="helloBean" class="com.camelSampleBundle.HelloBean">
        <property name="say" value="Hi from Camel" />
    </bean>
    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>
    <camelContext id="blueprintContext" trace="false"
        xmlns="http://camel.apache.org/schema/blueprint">
        <route id="timerToLog">
            <from uri="timer:foo?period=5000" />
            <setBody>
                <constant>Hello World!</constant>
            </setBody>
            <to uri="activemq:camel.q.timer" />
            <log message="The message contains ${body}" />

        </route>
        <!-- <route id="anotherRoute">
            <from uri="activemq:camel.q.timer" />
            <log message="The message contains ${body}" />
            <to uri="mock:result" />
        </route> -->
    </camelContext>

</blueprint>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.camelSampleBundle</groupId>
    <artifactId>camel-sampleBundle</artifactId>
    <packaging>bundle</packaging>
    <version>1.0.0-SNAPSHOT</version>

    <name>Sample Bundle</name>
    <url>http://www.myorganization.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <fuse.version>2.12.0.redhat-610379</fuse.version>
    </properties>

    <repositories>
        <repository>
            <id>release.fusesource.org</id>
            <name>FuseSource Release Repository</name>
            <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
        <repository>
            <id>snapshot.fusesource.org</id>
            <name>FuseSource Snapshot Repository</name>
            <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>release.fusesource.org</id>
            <name>FuseSource Release Repository</name>
            <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </pluginRepository>
        <pluginRepository>
            <id>snapshot.fusesource.org</id>
            <name>FuseSource Snapshot Repository</name>
            <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.10.0.redhat-60024</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-blueprint</artifactId>
            <version>2.10.0.redhat-60024</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jms</artifactId>
            <version>2.10.0.redhat-60024</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-camel</artifactId>
            <version>5.13.2</version>
        </dependency>



        <!-- logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.6</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.6.6</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!-- testing -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-test-blueprint</artifactId>
            <version>2.10.0.redhat-60024</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>install</defaultGoal>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.3</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <!-- to generate the MANIFEST-FILE of the bundle -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>camel-sampleBundle</Bundle-SymbolicName>
                        <Import-Package>*</Import-Package>
                        <Export-Package />
                    </instructions>
                </configuration>
            </plugin>

            <!-- to run the example using mvn camel:run -->
            <plugin>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-maven-plugin</artifactId>
                <version>2.10.0.redhat-60024</version>
                <configuration>
                    <useBlueprint>true</useBlueprint>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>

共有1个答案

田权
2023-03-14

问题出在《骆驼》的版本上。我在pom.xml中更改了camel版本,它运行良好

<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>2.12.0.redhat-610379</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-blueprint</artifactId>
        <version>2.12.0.redhat-610379</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jms</artifactId>
        <version>2.12.0.redhat-610379</version>
    </dependency>
 类似资料:
  • 什么是蓝图? 一个蓝图定义了视图,模板,静态文件以及可以用于应用程序的其它元素的集合。例如,让我们假设下我们有一个管理面板的蓝图。这个蓝图会定义一些包含像 /admin/login 和 /admin/dashboard 路由的视图。它也可能包含服务于这些路由的模板以及静态文件。接着我们可以使用这个蓝图添加一个管理面板到我们的应用程序中,不论我们的应用程序是什么类型的。 为什么要使用蓝图? 蓝图“杀

  • jd.closeBluetoothAdapter(Object object) 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 jd.openBluetoothAdapter 成对调用。 参数 Object object 属性 类型 默认值 必填 说明 success function 否 接口调用成功的回调函数 fail function 否 接口调用失败

  • 蓝牙模块能够使你的作品与 Makeblock 蓝牙适配器 或支持蓝牙4.0的设备建立无线连接,使你能够无线地控制你的作品。 蓝牙的连接设置参看:通过蓝牙连接设备 蓝牙的灯效及含义 闪烁:蓝牙未被连接 常亮:蓝牙已连接,工作正常 灭:断电或故障 参数 尺寸:24×24mm 推荐使用距离:10m以内 蓝牙版本:BT4.0 频带范围:2402~2480MHz 天线增益:1.5dBi 能耗等级:≤4dBm

  • 蓝牙模块能够使你的作品与 Makeblock 蓝牙适配器 或支持蓝牙4.0的设备建立无线连接,使你能够无线地控制你的作品。 蓝牙的连接设置参看:通过蓝牙连接设备 蓝牙的灯效及含义 闪烁:蓝牙未被连接 常亮:蓝牙已连接,工作正常 灭:断电或故障 参数 尺寸:24×24mm 推荐使用距离:10m以内 蓝牙版本:BT4.0 频带范围:2402~2480MHz 天线增益:1.5dBi 能耗等级:≤4dBm

  • 1.1.1. btflinger 1.1.2. 以下为相关的接口: 1.1.1. btflinger btflinger是RokidOS提供的蓝牙服务 1.1.2. 以下为相关的接口: int bluetooth_rokid_open(char *name);//打开蓝牙 int bluetooth_rokid_close(void);//关闭蓝牙 int bluetooth_rokid_us

  • 基于websocket、php和mysql的全功能即时通讯系统。 目前已完成电脑版基础功能,包括:查找添加好友、创建群组,私聊,群聊。