0

How can I inject a sql to query property in int-jdbc:outbound-gateway?

Background: I receive an amqp message with a where clause to query a table and do some logic. Where clause could be anything like state in ('ca','ma) or zipcode = '01760' Is there an example on using int-jdbc:outbound-gateway passing a query that can change based on the received message?

For example: we receive amqp message: 1: {"whereClause":"State in ('ca','ma')"} 2: {"whereClause":"id = 1"}

How can I inject to query prop in int-jdbc:outbound-gateway as below?

query="SELECT id FROM account where State in ('ca','ma')" query="SELECT id FROM account where id = 1"

1 Answer 1

2

No, you can't do that with out-of-the-box Spring Integration JDBC components.

The query property is final and can't be changed at runtime.

Consider to use <service-activator> with JdbcTemplate.query() direct usage.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.