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

getBody(Class<T> type) on originalMessage returns null

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.18.2
    • 2.18.3, 2.19.0
    • camel-core
    • None
    • Unknown

    Description

      It seems that the purpose of getBody(Class<T> type) is to convert the message body to the requested type. When this is used on a getUnitOfWork().getOriginalInMessage() message though the conversion doesn't happen. Debugging indicates this is because the message's exchange variable is null.

      For example requesting a string type when using a File queue fails as a conversion from GenericFile to String is required.

      It seems like the exchange should be set/copied when the originalInMessage is created (in the DefaultUnitOfWork constructor) so this functionality can work.

      Reference to mailing list dicussion: http://mail-archives.apache.org/mod_mbox/camel-dev/201702.mbox/ajax/%3Ce8b612e0-60ab-1a51-b024-87b48e024c51%40me.uk.eu.org%3E

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            tristanh Tristan Hill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: