Class JdbcMessageHandler

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class JdbcMessageHandler extends AbstractMessageHandler
A message handler that executes an SQL update. Dynamic query parameters are supported through the SqlParameterSourceFactory abstraction, the default implementation of which wraps the message so that its bean properties can be referred to by name in the query string, e.g.
 INSERT INTO ITEMS (MESSAGE_ID, PAYLOAD) VALUES (:headers[id], :payload)
 

When a message payload is an instance of Iterable, a NamedParameterJdbcOperations.batchUpdate(String, SqlParameterSource[]) is performed, where each SqlParameterSource instance is based on items wrapped into an internal Message implementation with headers from the request message. The item is wrapped only if it is not a Message already.

When a preparedStatementSetter is configured, it is applied for each item in the appropriate JdbcOperations.batchUpdate(String, BatchPreparedStatementSetter) function.

NOTE: The batch update is not supported when keysGenerated is in use. N.B. do not use quotes to escape the header keys. The default SQL parameter source (from Spring JDBC) can also handle headers with dotted names (e.g. business.id)

Since:
2.0
Author:
Dave Syer, Artem Bilan, Trung Pham