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

URI option mapMailMessage doesn't obey peek=true option

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.15.3
    • 2.15.6, 2.16.2, 2.17.0
    • camel-mail
    • None
    • Patch Available
    • Novice

    Description

      URI option mapMailMessage=true as is the default with Mail Component fetches IMAP-messages without peek=true option. This results to faulty rollback logic since in case of an exception and rollback, messages are already marked with flag SEEN and won't be rolled back to UNSEEN.

      Messages are marked with peek-option in processBatch-method but mapping mail messages to Camel messages happens before that method call in createExchanges-method.

      I've attached a patch where peek option is set to the messages already in the poll-method which resolves the issue. Unfortunately I couldn't write a proper jUnit test for this scenario since org.jvnet.mock_javamail.Mailbox doesn't seem to support marking messages as SEEN even if they have been fetched. However, I have attached traces of faulty and fixed run with a test route (that route is also included).

      Attachments

        1. camel-mail.mapMailMessages-peek.patch
          2 kB
          Jussi Nupponen
        2. MapMailMessagesBugRoute.java
          1 kB
          Jussi Nupponen
        3. trace-bug.log
          6 kB
          Jussi Nupponen
        4. trace-fixed.log
          6 kB
          Jussi Nupponen

        Activity

          People

            davsclaus Claus Ibsen
            jnupponen Jussi Nupponen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: