JDBC outbound channel adapter
Sends messages to a database using an SQL query.
Executes an SQL query for each incoming message. The message payload and headers are available by as input parameters to the query.
SQL data source
Reference to a JDBC data source, usually including some form of connection pooling, used for accessing the database.
Required
Query
An SQL query to execute when a message is received; usually an INSERT, UPDATE or DELETE query.
If the database logic is too complex to express using a single query, consider using a JDBC stored procedure outbound channel adapter instead. If the query result should be returned as a message, you'd probably want to use a JDBC outbound gateway.
Note that you can use the message payload and headers from the input message as parameters in the query by using the colon prefix notation.
Example of a query using header and payload values from the input message:
INSERT INTO mytable (id, createddate, contents) values (:headers[id], :headers[timestamp], :payload)
Required
Keys generated
Flag to indicate whether primary keys are generated by the query.
Advice can be added to change the behaviour of this endpoint, for example to add retry logic in case of failures. The following types of advice are available:
Retry advice: allows configuration of sophisticated retry scenarios; this includes specifying policies for retry attemps, backoff periods between attempts and the recovery strategy when retries are exhausted Circuit breaker: if a certain number of consecutive attempts fails, new requests will fail fast and no attempt will be made to invoke the request handler again until some time has expired Expression evaluating advice: general advice that evaluates a configurable SpEL expression on successful and/or failed attempts, and optionally can send a message to a success channel and/or failure channel
By adding multiple advices to this endpoint you can create even more complex combined behaviour. For example, if you add a circuit breaker and a retry advice, you can create a scenario where the circuit breaker only opens when all retries are exhaused. Note that the order of the advice types is important, as switching the order will change the combined behaviour: the first item in the list will be the top of the advice chain, meaning it will be the last advice that is evaluated. Also note that if any advice "traps" exceptions, all advices higher up in the chain won't know about any failures.
Channel
Channel to consume messages from.
Required
Id
Name that uniquely identifies this flow component.
Required