Announcement Announcement Module
Collapse
No announcement yet.
Adding custom headers to messages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          Thanks! I'll check that out.

          Comment


          • #6
            Works perfect! Thanks again.

            Comment

            Working...
            X