Results 1 to 6 of 6

Thread: Adding custom headers to messages

  1. #1

    Default Adding custom headers to messages

    Hi,

    I have a general question regarding headers: what are the ways to add custom headers to a message?
    The ones I know of:
    1. Header enricher: good only for adding headers with static values?
    2. Transformer: I'm using a transformer bean with a single method that accepts the Message interface. This is nice, but too coupled to Spring.


    Are there any other ways?

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    The header-enricher now supports any expression to be evaluated against the Message as well, so it should be sufficient. Simply add 'expression' rather than 'value'.

    Hope that helps.
    -Mark

  3. #3

    Default Adding custom headers to messages

    Thanks Mark!

    It's good to know that the header enricher supports dynamic values as well.
    Is it possible to map method arguments (let say of a gateway interface) to the payload/header using annotations or something of that sort?

    Thanks.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Yes, the gateway supports @Payload and @Header annotations on method-arguments. The @Payload can even contain an expression to be evaluated against the annotated argument.

  5. #5

    Default

    Thanks! I'll check that out.

  6. #6

    Default

    Works perfect! Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •