INT-2289 - Make update optional for JDBC Outbound Gateway
For reference: https://jira.springsource.org/browse/INT-2289
This commit is contained in:
committed by
Gary Russell
parent
884a4e5bb3
commit
bc244eff8f
@@ -195,9 +195,10 @@
|
||||
SQL query and then respond with the result sending it to a reply channel.
|
||||
The message payload and headers are available by default as input
|
||||
parameters to the query, for instance:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<int-jdbc:outbound-gateway
|
||||
update="insert into foos (id, status, name) values (:headers[id], 0, :payload[foo])"
|
||||
request-channel="input" reply-channel="output" data-source="dataSource" />]]></programlisting></para>
|
||||
request-channel="input" reply-channel="output" data-source="dataSource" />]]></programlisting>
|
||||
|
||||
<para>The result of the above would be to insert a record into the "foos"
|
||||
table and return a message to the output channel indicating the number of
|
||||
@@ -223,6 +224,21 @@
|
||||
query="select * from foos where id=:headers[$id]"
|
||||
request-channel="input" reply-channel="output" data-source="dataSource"/>]]></programlisting>
|
||||
|
||||
<para>
|
||||
Since <emphasis>Spring Integration 2.2</emphasis> the update SQL query is
|
||||
no longer mandatory. You can now solely provide a select query, using
|
||||
either the <emphasis>query attribute</emphasis> or
|
||||
the <emphasis>query sub-element</emphasis>. This is extremely useful if you
|
||||
need to actively retrieve data using e.g. a generic Gateway or a
|
||||
Payload Enricher. The reply message is then generated from the result, like
|
||||
the inbound adapter, and passed to the reply channel.
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<int-jdbc:outbound-gateway
|
||||
query="select * from foos where id=:headers[id]"
|
||||
request-channel="input"
|
||||
reply-channel="output"
|
||||
data-source="dataSource"/>]]></programlisting>
|
||||
|
||||
<para>As with the channel adapters, there is also the option to provide
|
||||
<classname>SqlParameterSourceFactory</classname> instances for request and
|
||||
reply. The default is the same as for the outbound adapter, so the request
|
||||
|
||||
@@ -57,6 +57,14 @@
|
||||
<listitem>JdbcCallOperations Cache Statistics</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section id="2.2-jdbc-gateway-update-optional">
|
||||
<title>JDBC Adapter - Outbound Gateway</title>
|
||||
<para>
|
||||
When using the JDBC Outbound Gateway, the update query is no longer
|
||||
mandatory. You can now provide solely a select query using the request
|
||||
message as a source of parameters.
|
||||
</para>
|
||||
</section>
|
||||
<section id="2.2-tx">
|
||||
<title>Transaction Synchronization</title>
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user