Results 1 to 4 of 4

Thread: Configuration per incoming Message

  1. #1

    Default Configuration per incoming Message

    I have a scenario where an xml feed comes in with the following structure

    Code:
    <root>
      <source>Vendor #1</source>
      <objects>
        <object>object 1</object>
        <object>object 2</object>
        <object>object 3</object>
        <object>object 4</object>
      </objects>
    </root>
    I have my spring-integration set up such that the incoming XML is split (using XPathSplitter) and then each <object> node is processed by a Transformer.

    What I need to be able to do is keep track of which <source> the <object> came from when I am transforming it, but that information is currently lost by the time i get to the transformer.

    My initial thought was to subclass the XPathSplitter and have it add a MessageHeader containing the <source> to each of the split messages, but I couldn't figure out where the Headers were actually set in that process.

    Anyone have other ideas?

    Thanks!

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

    Default

    I think what you would want to do is add a Transformer prior to the Splitter. The Transformer could set the value in the header of the pre-split Message.

    Feel free to open a JIRA issue. I think it would be worth adding an XPath-based "header-enricher" in the Spring Integration XML namespace.

  3. #3

    Default

    Am i understanding you correctly that the Headers will propagate between steps.

    i.e.

    Original XML --> Transformer adds Header X --> Splitter --> each split message has a header X ?

    [NOTE: I just tested this and it does appear to be the case... who knew? :-) ] thanks!
    Last edited by nhajratw; Oct 7th, 2009 at 07:54 PM.

  4. #4
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Quote Originally Posted by nhajratw View Post
    who knew?
    Well, we put it there on purpose

Tags for this Thread

Posting Permissions

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