Announcement Announcement Module
Collapse
No announcement yet.
Gateway embedded in a chain restores removed header Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gateway embedded in a chain restores removed header

    With 2.0.2.BUILD-SNAPSHOT:

    I have a chain which reads messages from "channel1". On a message I set two headers "h1" and "h2". Then I use an embedded gateway to temporarily divert the message to "channel2". On that channel I remove one of the headers, "h2". The operation seems to be successful, however, after the message returns to the first chain, the removed header is back in the message.

    The following configuration shows the container:

    Code:
      <int:message-history/>
    
      <int:chain input-channel="channel1">
        <int:service-activator ref="logger"/>
        <int:header-enricher default-overwrite="true">
          <int:header name="h1" value="v1"/>
          <int:header name="h2" value="v2"/>
        </int:header-enricher>
        <int:gateway request-channel="channel2" />
        <int:service-activator expression="'end channel 1'"/>
        <int:service-activator ref="logger"/>
      </int:chain>
    
      <int:chain input-channel="channel2">
        <int:service-activator expression="'start channel 2'"/>
        <int:service-activator ref="logger"/>
        <int:header-filter header-names="h2"/>
        <int:service-activator expression="'end channel 2'"/>
        <int:service-activator ref="logger"/>
      </int:chain>
      
      <int:inbound-channel-adapter channel="channel1"
        expression="'start payload'">
        <int:poller fixed-rate="10000"/>
        <int:header name="replyChannel" value="nullChannel"/>
      </int:inbound-channel-adapter>
    The resulting log is the following:

    Code:
    [DEBUG] [2011/08/02 16:00:14,599] [task-scheduler-1] [MessageLogger.log] [Payload=start payload][Headers={replyChannel=nullChannel, timestam
    p=1297198814578, history=channel1, id=a0ae1d81-7eb6-4635-bc7a-6ed4f60507cc}] at (MessageLogger.java:25)
    
    [DEBUG] [2011/08/02 16:00:14,623] [task-scheduler-1] [MessageLogger.log] [Payload=start channel 2][Headers={h2=v2, errorChannel=org.springfr
    amework.integration.core.MessagingTemplate$TemporaryReplyChannel@97cc12, replyChannel=org.springframework.integration.core.MessagingTemplate
    $TemporaryReplyChannel@97cc12, h1=v1, timestamp=1297198814622, history=channel1,channel2, id=5dada1a5-54c7-4c0d-a182-d9d95a8cb423}] at (Mess
    ageLogger.java:25)
    
    [DEBUG] [2011/08/02 16:00:14,625] [task-scheduler-1] [MessageLogger.log] [Payload=end channel 2][Headers={errorChannel=org.springframework.i
    ntegration.core.MessagingTemplate$TemporaryReplyChannel@97cc12, replyChannel=org.springframework.integration.core.MessagingTemplate$Temporar
    yReplyChannel@97cc12, h1=v1, timestamp=1297198814624, history=channel1,channel2, id=f5c5241e-e46e-4217-8a73-6c9aa0e6f2e4}] at (MessageLogger
    .java:25)
    
    [DEBUG] [2011/08/02 16:00:14,629] [task-scheduler-1] [MessageLogger.log] [Payload=end channel 1][Headers={h2=v2, replyChannel=nullChannel, h
    1=v1, timestamp=1297198814629, history=channel1,channel2, id=fd5aec00-a961-4951-adbd-7cd101ba1d24}] at (MessageLogger.java:25)
Working...
X