zhfeng commented on PR #9286:
URL: https://github.com/apache/camel/pull/9286#issuecomment-1418523212

   @turing85 I also investigate `transacted()` issue and it seems that you need 
to set `TransactionTemplate` when creating `JdbcMessageIdRepository`
   
   1. Add `came-quarkus-jta` in the `pom.xml` which can leverage the 
`quarkus-narayana-jta` to provide the JTA transaction support.
   2. Make some changes in `Route.java` to add `TransactionTemplate`
   ```java
    public Route(@SuppressWarnings("CdiInjectionPointsInspection") DataSource 
dataSource,
                 @SuppressWarnings("CdiInjectionPointsInspection") 
TransactionManager transactionManager) {
       TransactionTemplate template = new TransactionTemplate(new 
JtaTransactionManager(transactionManager));
       idempotentRepository =
           constructRepository(dataSource, template);
     }
   
     private static JdbcMessageIdRepository constructRepository(DataSource 
dataSource, TransactionTemplate template) {
       final JdbcMessageIdRepository repository =
           new JdbcMessageIdRepository(dataSource, template, ROUTE_ID);
       repository.setCreateTableIfNotExists(true);
       return repository;
     }
   ```
   I test it locally and it should work with `transacted`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to