META-INF.spring.camel-context-decision-table.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2005-2014 Red Hat, Inc. Red Hat 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. --> <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="cheeseHelper" class="io.fabric8.example.drools.CheeseHelper"/> <bean id="droolsHelper" class="io.fabric8.example.drools.DroolsCommandHelper"/> <bean id="kiePostProcessor" class="org.drools.osgi.spring.OsgiKModuleBeanFactoryPostProcessor"/> <kie:kmodule id="camel-context-decision-table"> <kie:kbase name="decision" packages="decision"> <kie:ksession name="ksession-dt-1" type="stateless"> <kie:batch> <kie:set-global identifier="list" > <bean class="java.util.ArrayList" /> </kie:set-global> </kie:batch> </kie:ksession> </kie:kbase> </kie:kmodule> <camelContext xmlns="http://camel.apache.org/schema/spring"> <route trace="false" id="testRouteDecisionTable"> <from uri="timer:testRouteDecisionTable?period=10s"/> <bean method="createTestCheese" ref="cheeseHelper"/> <to uri="kie:ksession-dt-1?action=insertBody" id="AgeVerification"/> <choice> <when id="CheeseType"> <simple>${body.type}</simple> <log logName="Chilton" message="Cheese ${body.type} costs ${body.price} EUR."/> </when> <otherwise> <log logName="Cheddar" message="Cheese ${body.type} costs ${body.price} EUR."/> </otherwise> </choice> </route> <route trace="false" id="ruleOnBodyDT"> <from uri="direct://ruleOnBodyDT"/> <to uri="kie:ksession-dt-1?action=insertBody"/> </route> <route trace="false" id="ruleOnCommandDT"> <from uri="direct://ruleOnCommandDT"/> <bean method="insertAndFireAll" ref="droolsHelper"/> <to uri="kie:ksession-dt-1?action=execute"/> </route> </camelContext> </beans>