I am using Camel for integrating Spring Boot application with other domains. I have a simple route configured using SQL Component for polling and updating DB:
from("sql:"+selectSQL+"?consumer.delay=20000&onConsume="+updateSQL)
.log("---select sql done")
.to("sql:" + insertSQL);
and SQLs are like these:
String selectSQL = "SELECT * FROM T1 WHERE PROCESSED is null and ROWNUM <4 for update skip locked";
String updateSQL = "update T1 set PROCESSED='TRUE' where id = :#id";
String insertSQL = "insert into T2 (col_name...) values (col_value...)";
And I would like these SQLs to run inside 1 transaction for single polling request. I know that I can make route transacted with .transacted("propagationPolicy")
but I can't put it before from
.
Is it possible make every polling try transactional?
PS. I have an workaround with timer component and separate route for each SQL but I wonder is it possible to solve my problem using only 1 route as above.