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

camel-jpa doesn't handle exclusive locks for concurrent consumers when setting consumeDelete to false

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

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.18.3
    • None
    • camel-jpa
    • None
    • Java JDK 1.8.0_121
      Spring 4 (reproduced with Spring Boot 1.5.3)
      RedHat RHEL 7.1 x86_64
      Oracle 11G

    • Unknown

    Description

      Deploying 4 instances of the same app containing a camel-jpa consumer polling on the same database, I noticed that several servers can consume the same entities.

      The polling is currently done as follow :

      1. Poll without lock on the `maxResult` first rows
      2. On each row :
        1. Apply a lock select ... for update (NOWAIT)
        2. Consume entity
        3. Release the lock (commit)
        4. New Transaction
        5. Process exchange
        6. End Transaction

      What can happen with several instances of the consuming on the same database is :

      1. Server 1 polls the 10 first rows
      2. Server 2 polls the same 10 first rows
      3. Server 1 locks row 1 for update and consume it
      4. Server 2 locks row 1 for update as the previous lock is already released and consumes it

      This demand is related to my previous post on the user forum : http://camel.465427.n5.nabble.com/JPA-consumer-component-is-not-handling-multiple-server-concurrent-polling-td5797937.html

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            teikitel TEIKITEETINI-VAYSSE Loic

            Dates

              Created:
              Updated:

              Slack

                Issue deployment