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

META-INF.spring.camel-context.xml Maven / Gradle / Ivy

There is a newer version: 2.2.149
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:kie="http://drools.org/schema/kie-spring"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring       http://camel.apache.org/schema/spring/camel-spring.xsd
       http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd">

    <!-- Beans used by camel in the example -->
    <bean id="droolsHelper" class="io.fabric8.quickstarts.camel.drools.DroolsCommandHelper"/>
    <bean id="personHelper" class="io.fabric8.quickstarts.camel.drools.PersonHelper"/>

    <!-- Camel Route -->
    <camelContext xmlns="http://camel.apache.org/schema/spring">

        <route trace="false" id="testRoute">
            <description>Example route that will regularly create a Person with a random age and verify their age</description>
            <from uri="timer:testRoute?period=10s"/>
            <bean method="createTestPerson" ref="personHelper"/>
            <to uri="kie:ksession1?action=insertBody" id="AgeVerification"/>
            <choice>
                <when id="CanDrink">
                    <simple>${body.canDrink}</simple>
                    <log logName="Bar" message="Person ${body.name} can go to the bar"/>
                </when>
                <otherwise>
                    <log logName="Home" message="Person ${body.name} is staying home"/>
                </otherwise>
            </choice>
        </route>

        <route trace="false" id="ruleOnBody">
            <description>This route shows an example of passing (inserting) the Body of the message as a POJO to Drools for execution</description>
            <from uri="direct://ruleOnBody"/>
            <to uri="kie:ksession1?action=insertBody"/>
        </route>

        <route trace="false" id="ruleOnCommand">
            <description>This route shows an example of creating a Drools Command wrapping the Body of the message with
                the help of the custom DroolsCommandHelperBean (included in this project), and passing this Drools
                Command to the ruleset for execution.
            </description>
            <from uri="direct://ruleOnCommand"/>
            <bean method="insertAndFireAll" ref="droolsHelper"/>
            <to uri="kie:ksession1?action=execute"/>
        </route>

    </camelContext>

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy