|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.jdbc.JdbcMessageHandler
public class JdbcMessageHandler
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 FOOS (MESSAGE_ID, PAYLOAD) VALUES (:headers[$id], :payload)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
)
Constructor Summary | |
---|---|
JdbcMessageHandler(DataSource dataSource,
String updateSql)
Constructor taking DataSource from which the DB Connection can be obtained and the select query to
execute to retrieve new rows. |
|
JdbcMessageHandler(JdbcOperations jdbcOperations,
String updateSql)
Constructor taking JdbcOperations instance to use for query execution and the select query to execute to
retrieve new rows. |
Method Summary | |
---|---|
void |
handleMessage(Message<?> message)
Executes the update, passing the message into the SqlParameterSourceFactory . |
void |
setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory)
|
void |
setUpdateSql(String updateSql)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JdbcMessageHandler(DataSource dataSource, String updateSql)
DataSource
from which the DB Connection can be obtained and the select query to
execute to retrieve new rows.
dataSource
- used to create a SimpleJdbcTemplate
updateSql
- query to executepublic JdbcMessageHandler(JdbcOperations jdbcOperations, String updateSql)
JdbcOperations
instance to use for query execution and the select query to execute to
retrieve new rows.
jdbcOperations
- instance to use for query executionupdateSql
- query to executeMethod Detail |
---|
public void setUpdateSql(String updateSql)
public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory)
public void handleMessage(Message<?> message) throws MessageRejectedException, MessageHandlingException, MessageDeliveryException
SqlParameterSourceFactory
.
handleMessage
in interface MessageHandler
message
- the message to be handled
MessageRejectedException
- if the handler doesn't select these
types of messages
MessageHandlingException
- when something went wrong during the
handling
MessageDeliveryException
- when this handler failed to deliver the
reply related to the handling of the message
|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |