All Downloads are FREE. Search and download functionalities are using the official Maven repository.

OSGI-INF.blueprint.route.xml Maven / Gradle / Ivy

There is a newer version: 4.7.0
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
           xsi:schemaLocation="
             http://www.osgi.org/xmlns/blueprint/v1.0.0 https://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">

    <!-- Allow the use of system properties -->
    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>

    <bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
        <argument value="$[spring.rabbitmq.host]"/>
        <argument value="$[spring.rabbitmq.port]"/>
    </bean>

    <bean id="spring-rabbitmq" class="org.apache.camel.component.springrabbit.SpringRabbitMQComponent">
        <property name="connectionFactory" ref="rabbitConnectionFactory"/>
    </bean>

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

        <route id="rabbitRouteSend">
            <from uri="direct:camel-spring-rabbitmq-test"/>
            <setHeader name="theHeader">
                <constant>This is header</constant>
            </setHeader>
            <setBody>
                <constant>Hello Camel</constant>
            </setBody>
            <to uri="spring-rabbitmq:exchangeName?routingKey=routingKey"/>
            <log message="Message sent to RabbitMQ: ${body} headers ${header.theHeader}"/>
        </route>

        <route id="rabbitRouteReceive">
            <from uri="spring-rabbitmq:exchangeName?routingKey=routingKey"/>
            <log message="Message received from RabbitMQ: ${body} headers ${header.theHeader}"/>
            <setBody>
                <constant>OK</constant>
            </setBody>
            <to uri="mock:camel-spring-rabbitmq-test"/>
        </route>
    </camelContext>
</blueprint>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy