INTSAMPLES-33 Add initial Jdbc sample

This commit is contained in:
Gunnar Hillert
2011-11-03 01:02:57 -04:00
parent 0422b81415
commit f366d53869
11 changed files with 476 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?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:int="http://www.springframework.org/schema/integration"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc-2.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<int:channel id="requestChannel"/>
<int:channel id="replyChannel"/>
<jdbc:embedded-database id="datasource" type="H2">
<jdbc:script location="classpath:setup-tables.sql"/>
</jdbc:embedded-database>
<!-- See also:
http://static.springsource.org/spring-integration/reference/htmlsingle/#gateway-proxy
http://www.eaipatterns.com/MessagingGateway.html -->
<int:gateway default-request-timeout="5000"
default-reply-timeout="5000"
default-request-channel="requestChannel"
default-reply-channel="replyChannel"
service-interface="org.springframework.integration.samples.jdbc.service.UserService">
<int:method name="convertToUpperCase"/>
</int:gateway>
<int-jdbc:outbound-gateway data-source="datasource"
update="UPDATE DUMMY SET DUMMY_VALUE='test'"
request-channel="requestChannel" query="select * from users where username=:payload"
reply-channel="replyChannel" row-mapper="rowMapper">
</int-jdbc:outbound-gateway>
<bean id="rowMapper" class="org.springframework.integration.samples.jdbc.UserMapper"/>
</beans>