INTSAMPLES-97 - Add Postgres Stored Procedure Sample
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?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"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
|
||||
destroy-method="close">
|
||||
<property name="driverClassName" value="org.postgresql.Driver" />
|
||||
<property name="url"
|
||||
value="jdbc:postgresql:integration" />
|
||||
<property name="username" value="postgres" />
|
||||
<property name="password" value="postgres" />
|
||||
</bean>
|
||||
|
||||
<int:channel id="findCoffeeProcedureRequestChannel" />
|
||||
<int:channel id="findAllProcedureRequestChannel" />
|
||||
|
||||
<int:gateway id="gateway" default-request-timeout="4000"
|
||||
default-reply-timeout="4000"
|
||||
service-interface="org.springframework.integration.service.CoffeeService">
|
||||
<int:method name="findCoffeeBeverage" request-channel="findCoffeeProcedureRequestChannel" />
|
||||
<int:method name="findAllCoffeeBeverages" request-channel="findAllProcedureRequestChannel" />
|
||||
</int:gateway>
|
||||
|
||||
<int-jdbc:stored-proc-outbound-gateway
|
||||
id="outbound-gateway-storedproc-find-coffee" data-source="dataSource"
|
||||
request-channel="findCoffeeProcedureRequestChannel" is-function="true"
|
||||
skip-undeclared-results="true" stored-procedure-name="FIND_COFFEE"
|
||||
expect-single-result="true">
|
||||
<int-jdbc:sql-parameter-definition name="coffee_name" type="INTEGER" direction="IN"/>
|
||||
<int-jdbc:parameter name="coffee_name" expression="payload" />
|
||||
</int-jdbc:stored-proc-outbound-gateway>
|
||||
|
||||
<int-jdbc:stored-proc-outbound-gateway
|
||||
id="outbound-gateway-storedproc-find-all" data-source="dataSource" ignore-column-meta-data="true"
|
||||
request-channel="findAllProcedureRequestChannel" expect-single-result="true"
|
||||
stored-procedure-name="FIND_ALL_COFFEE_BEVERAGES">
|
||||
<int-jdbc:returning-resultset name="ref"
|
||||
row-mapper="org.springframework.integration.support.CoffeBeverageMapper" />
|
||||
</int-jdbc:stored-proc-outbound-gateway>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Loggers -->
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.samples">
|
||||
<level value="INFO" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="INFO" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
Reference in New Issue
Block a user