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

Parallel and fault tolerant message processing for SQS endpoints.

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.15.0
    • camel-aws
    • None
    • Unknown

    Description

      I'm using Camel to implement parallel processing of jobs in an SQS queue, and ran into a few issues with the current implementation of the SQS component:

      1. SqsConsumer uses a blocking/synchronous processor, which prevents parallel processing of multiple messages from a single endpoint.
      2. Having a maxMessagesPerPoll other than one doesn't seem to make sense, because any messages not being actively processed should be left back in the queue for other consumers to have a chance with.
      3. Rollback processing doesn't go back to SQS and set the visibility timeout to zero, which prevents immediate retries.

      I propose the following solutions to these problems:

      1. Use an asynchronous processor in SqsConsumer by way of getAsyncProcessor(). (Messages in SQS aren't guaranteed to be FIFO anyway, so there should be no issue with order of processing.)
      2. Replace maxMessagesPerPoll with maxInFlightMessages. Put a semaphore in SqsConsumer to control the maximum number of in flight messages, and when polling SQS always set the number of available permits as the maximum number of messages to retrieve.
      3. In the onFailure callback for an exchange set the visibility timeout in SQS to zero via ChangeMessageVisibility.

      How does this sound? I'm working on a patch. This is my first work on Camel, so if you see any problems with my approach let me know!

      Thanks,

      • Dan

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ceposta Christian Posta
            dacc Daniel Carleton
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment