From 4fd32d2bd4c596fc32552e66ca6ccd9d3de7a618 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 10 Aug 2017 16:52:44 -0400 Subject: [PATCH] Document max-rows-per-poll for the JDBC Gateway StackOverflow https://stackoverflow.com/questions/45611037 --- .../integration/jdbc/JdbcOutboundGateway.java | 10 +++------- src/reference/asciidoc/jdbc.adoc | 6 ++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java index f2b422bd76..f8bddc006a 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java @@ -92,16 +92,12 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im /** * The maximum number of rows to pull out of the query results per poll (if - * greater than zero, otherwise all rows will be packed into the outgoing - * message). - * + * greater than zero, otherwise all rows will be packed into the outgoing message). * The value is ultimately set on the underlying {@link JdbcPollingChannelAdapter}. - * If not specified this value will default to zero. - * + * If not specified this value will default to {@code 1}. * This parameter is only applicable if a selectQuery was provided. Null values * are not permitted. - * - * @param maxRowsPerPoll Must not be null. + * @param maxRowsPerPoll the number of rows to select. Must not be null. */ public void setMaxRowsPerPoll(Integer maxRowsPerPoll) { Assert.notNull(maxRowsPerPoll, "MaxRowsPerPoll must not be null."); diff --git a/src/reference/asciidoc/jdbc.adoc b/src/reference/asciidoc/jdbc.adoc index 37fd53763a..af5492b658 100644 --- a/src/reference/asciidoc/jdbc.adoc +++ b/src/reference/asciidoc/jdbc.adoc @@ -274,6 +274,12 @@ The reply message is then generated from the result, like the inbound adapter, a data-source="dataSource"/> ---- +[IMPORTANT] +===== +By default the component for the SELECT query returns only one, first row from the cursor. +This can be adjusted with the `max-rows-per-poll` option. +Consider to specify `max-rows-per-poll="0"` if you need to return all the rows from the SELECT. + As with the channel adapters, there is also the option to provide `SqlParameterSourceFactory` instances for request and reply. The default is the same as for the outbound adapter, so the request message is available as the root of an expression. If `keys-generated="true"` then the root of the expression is the generated keys (a map if there is only one or a list of maps if multi-valued).