Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12927

SQS: Optionally wait for transaction complete to send messages in SqsProducer

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 2.22.1
    • Future
    • camel-aws
    • None
    • Unknown

    Description

      Currently, SQS sends messages immediately not waiting for the transaction to commit. Since SQS doesn't support transactional message sending, this behavior is as expected. However, Camel could emulate transaction support for SQS by waiting for the current transaction to commit before sending the message. This would make SQS behave more in line with JMS.

      In SqsConfiguration, add one new property:

      • transacted

      When transactioned=false (default), behavior is as it is today.

      When transaction=true, don't send the message until the transaction completes. In SqsProducer, wrap the call to

      SendMessageResult result = getClient().sendMessage(request);

      like so:

              org.springframework.transaction.support.TransactionSynchronizationManager.registerSynchronization(new org.springframework.transaction.support.TransactionSynchronizationAdapter() {
      
                  @Override
                  public void afterCommit() {
                      SendMessageResult result = getClient().sendMessage(request);
                  }
                  
              });

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            candrews Craig
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: