Announcement Announcement Module
No announcement yet.
header-enricher Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • header-enricher

    This snippet is from the documentation:
    <header-enricher input-channel="in" output-channel="out">
    <header name="foo" value="123"/>
    <header name="bar" ref="someBean"/>

    When using the:
    <header name="bar" ref="someBean"/>

    What does the ref=someBean actually do to get the value?
    Is this just a java bean call? ... getBar() in this case?

    For more complex header enrichment is it recommended to use a service-activator and do it by hand as opposed to using the header-enricher?

  • #2
    or is the value of the bar header the actual "someBean" instance?


    • #3
      Yes, but I think you should create a documentation issue for this. We could improve that both in the xsd and the reference guide.

      Instead of using a service-activator, you could also use the 'expression' attribute on the 'header' element. I think that the header element could also have a 'method' attribute and behave similar to a service-activator, but use the return value for the header. If you like that idea, you can create an issue for that too.


      • #4
        Jira issue created for adding a method attribute to the header element:


        • #5
          My use case for this is perhaps a little odd.
          Messages come into Spring Integration via a JMS Queue from various data providers.
          Our messages are a list of "items". Each item has a key.

          One of the first things we do when receiving a message is to create a header property called KEY_LIST which is a string that contains a tokenized list of the keys for all the items of the incoming message. Ultimately the messages go through flows and end up on queues for subscribers to our system. We are using openMQ as our JMS server. If a client subscriber happens to be down for an extended amount of time, the message will expire from their queue. We have openMQ configured to log the KEY_LIST property when a message expires from the queue.

          So we have a service activator that calls a factory to get the appropriate key list creator for the given incoming message type. I was looking at possibly using the header-enricher functionality to replace our home grown service activator.