Spring Integration
  1. Spring Integration
  2. INT-1881

Adding support for nested <header> sub-elements (e.g., bean, script etc.) when configuring the <header-enricher>

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.0.4
    • Component/s: Core
    • Labels:
      None

      Description

      Add support for calculating the header value from Groovy (or others?) script like SpEL.
      Sample:

       <header-enricher>
                  <header name="logId" ref="logRequestResponseAction" method="log"/>
                  <header name="TEST_HEADER">
                      <groovy:script>
                          <![CDATA[
                                  new XmlParser().parseText(headers.requestXml).with {
                                      return new Date(Date.parse("yyyy-MM-dd'T'HH:mm:ss", headerData.messageDescription.requestDate.text()).time + 300 * 1000)
                                  }
                                  ]]>
                      </groovy:script>
                  </header>
              </header-enricher>
      

      I do not think it should be full support for nested beans, as shown by Oleg, because in this case the header value will be calculated only once - when the application is starting.
      And it will look like StaticHeaderValueMessageProcessor strategy.
      In other words, it would be redundant.

        Issue Links

          Activity

          Hide
          Oleg Zhurakousky added a comment -

          Processing beans could now be declared as sub-elements of <header> as such:

          <int:header-enricher  input-channel="inputB" output-channel="outputB">
          	<int:header name="TEST_HEADER">
                      <int-groovy:script>
                      	<![CDATA[
          					return "groovy"
          				]]>
                      </int-groovy:script>
                  </int:header>
          </int:header-enricher>
          
          <int:header-enricher  input-channel="inputA" output-channel="outputA">
          		<int:header name="TEST_HEADER">
                      <int-groovy:script location="org/GroovyHeaderEnricherTests.groovy"/>
                  </int:header>
          </int:header-enricher>
          
          <int:header-enricher  input-channel="inputA" output-channel="outputA">
          	<int:header name="TEST_HEADER">
                      <bean. . . ./>
                  </int:header>
          </int:header-enricher>
          

          etc...

          Show
          Oleg Zhurakousky added a comment - Processing beans could now be declared as sub-elements of <header> as such: < int :header-enricher input-channel= "inputB" output-channel= "outputB" > < int :header name= "TEST_HEADER" > < int -groovy:script> <![CDATA[ return "groovy" ]]> </ int -groovy:script> </ int :header> </ int :header-enricher> < int :header-enricher input-channel= "inputA" output-channel= "outputA" > < int :header name= "TEST_HEADER" > < int -groovy:script location= "org/GroovyHeaderEnricherTests.groovy" /> </ int :header> </ int :header-enricher> < int :header-enricher input-channel= "inputA" output-channel= "outputA" > < int :header name= "TEST_HEADER" > <bean. . . ./> </ int :header> </ int :header-enricher> etc...

            People

            • Assignee:
              Oleg Zhurakousky
              Reporter:
              Artem Bilan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: