diff --git a/src/reference/docbook/channel-adapter.xml b/src/reference/docbook/channel-adapter.xml index efc27b46dd..f76908bbeb 100644 --- a/src/reference/docbook/channel-adapter.xml +++ b/src/reference/docbook/channel-adapter.xml @@ -13,7 +13,7 @@
- Configuring Inbound Channel Adapter + Configuring An Inbound Channel Adapter An "inbound-channel-adapter" element can invoke any method on a Spring-managed Object and send a non-null return value to a MessageChannel after converting it to a Message. @@ -38,43 +38,45 @@ Poller Configuration - Some inbound-channel-adapter types are backed by a SourcePollingChannelAdapter which - means they contain Poller configuration which will poll the MessageSource (invoke a custom method - which produces the value that becomes a Message payload) based on the configuration - specified in the Poller. + Some inbound-channel-adapter types are backed by a SourcePollingChannelAdapter which + means they contain Poller configuration which will poll the MessageSource (invoke a custom method + which produces the value that becomes a Message payload) based on the configuration + specified in the Poller. - For example: - + + For example: + ]]> - In the the first configuration the polling task will be invoked once per poll and during such task (poll) - the method (which results in the production of the Message) will be invoked once based on the - max-messages-per-poll attribute value. In the second configuration the polling task will be invoked - 10 times per poll or until it returns 'null' thus possibly producing 10 Messages per poll while each poll happens + + In the the first configuration the polling task will be invoked once per poll and during such task (poll) + the method (which results in the production of the Message) will be invoked once based on the + max-messages-per-poll attribute value. In the second configuration the polling task will be invoked + 10 times per poll or until it returns 'null' thus possibly producing 10 Messages per poll while each poll happens at 1 second intervals. However what if the configuration looks like this: + ]]> - Note there is no max-messages-per-poll specified. As you'll learn later the identical poller configuration - in the PollingConsumer (e.g., service-activator, filter, router etc.) would have a default - value of -1 for max-messages-per-poll which means "execute poling task non-stop unless polling method + + Note there is no max-messages-per-poll specified. As you'll learn later the identical poller configuration + in the PollingConsumer (e.g., service-activator, filter, router etc.) would have a default + value of -1 for max-messages-per-poll which means "execute poling task non-stop unless polling method returns null (e.g., no more Messages in the QueueChannel)" and then sleep for 1 second. However in the SourcePollingChannelAdapter it is a bit different. - The default value for max-messages-per-poll will be set to 1 by default unless you explicitly set it to - a negative value (e.g., -1). It is done so to make sure that poller can react to a LifeCycle events (e.g., start/stop) - and prevent it from potentially spinning in the infinite loop if the implementation of the custom + The default value for max-messages-per-poll will be set to 1 by default unless you explicitly set it to + a negative value (e.g., -1). It is done so to make sure that poller can react to a LifeCycle events (e.g., start/stop) + and prevent it from potentially spinning in the infinite loop if the implementation of the custom method of the MessageSource has a potential to never return null and happened to be non-interruptible. - However if you are sure that your method can return null and you need the behavior where you want to poll - for as many sources as available per each poll, then you should explicitly set max-messages-per-poll + However if you are sure that your method can return null and you need the behavior where you want to poll + for as many sources as available per each poll, then you should explicitly set max-messages-per-poll to negative value. + ]]> - - -
diff --git a/src/reference/docbook/jdbc.xml b/src/reference/docbook/jdbc.xml index 9927428aed..76908c29f9 100644 --- a/src/reference/docbook/jdbc.xml +++ b/src/reference/docbook/jdbc.xml @@ -49,10 +49,12 @@ row in the query result. Optionally, this can be changed by adding a reference to a RowMapper instance (see the Spring - JDBC documentation for more detailed information about row mapping). - If you want to convert rows in the SELECT query result to - individual messages you can use a downstream splitter. - + JDBC documentation for more detailed information about row mapping). + + + If you want to convert rows in the SELECT query result to + individual messages you can use a downstream splitter. + The inbound adapter also requires a reference to either a JdbcTemplate instance or @@ -105,6 +107,46 @@ the transaction rolls back and the input data is reverted to its original state. +
+ Max-rows-per-poll versus Max-messages-per-poll + + The JDBC Inbound Channel Adapter defines an attribute + max-rows-per-poll. When you + specify the adapter's Poller, you can also + define a property called max-messages-per-poll. While + these two attributes look similar, their meaning is + quite different. + + max-messages-per-poll specifies the number of times + the query is executed per polling interval, whereas max-rows-per-poll + specifies the number of rows returned for each execution. + + + Under normal circumstances, you would likely not want to set the Poller's + max-messages-per-poll property when using + the JDBC Inbound Channel Adapter. Its default value + is 1, which means that the JDBC + Inbound Channel Adapter's + receive() + method is executed exactly once for each poll interval. + + + Setting the max-messages-per-poll + attribute to a larger value means that the query is executed that many times + back to back. + For more information regarding the max-messages-per-poll + attribute, please see . + + + In contrast, the max-rows-per-poll attribute, + if greater than 0, specifies + the maximum number of rows that will be used from the query result set, + per execution of the receive() method. + If the attribute is set to 0, then all rows will + be included in the resulting message. If not explicitly set, the + attribute defaults to 0. + +
@@ -799,6 +841,15 @@ + + When you declare a Poller, you may notice the Poller's + max-messages-per-poll attribute. For information about + how it relates to the max-rows-per-poll attribute + of the Stored Procedure Inbound Channel Adapter, + please see + for a thourough discussion. The meaning of the attributes + is the same as for the JDBC Inbound Channel Adapter. +
Stored Procedure Outbound Channel Adapter