blob: 1b0f91290aa35a931b64cc5cd85d2496703de09c [file] [log] [blame]
<?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"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<!-- START SNIPPET: e1 -->
<!-- bean which creates/destroys the database table for this example -->
<bean id="database-initializer" class="org.apache.camel.example.mybatis.DatabaseInitializationBean" init-method="create" destroy-method="drop">
<property name="url" value="jdbc:derby:memory:mybatis" />
</bean>
<!-- END SNIPPET: e1 -->
<!-- START SNIPPET: e2 -->
<!-- order service our business logic bean that creates new orders -->
<bean id="orderService" class="org.apache.camel.example.mybatis.OrderService"/>
<!-- here is Camel configured with a number of routes -->
<camelContext id="myBatisAndCamel" xmlns="http://camel.apache.org/schema/blueprint" depends-on="database-initializer">
<!-- route that generate new orders and insert them in the database -->
<route id="generateOrder-route">
<from uri="timer:foo?period=5000"/>
<transform>
<method ref="orderService" method="generateOrder"/>
</transform>
<to uri="mybatis:insertOrder?statementType=Insert"/>
<log message="Inserted new order ${body.id}"/>
</route>
<!-- route that process the orders by picking up new rows from the database
and when done processing then update the row to mark it as processed -->
<route id="processOrder-route">
<from uri="mybatis:selectOrders?statementType=SelectList&amp;onConsume=consumeOrder"/>
<to uri="bean:orderService?method=processOrder"/>
<log message="${body}"/>
</route>
</camelContext>
<!-- END SNIPPET: e2 -->
</blueprint>