2 Replies Latest reply on Jan 9, 2013 9:28 PM by liang zhao

    ESB Message splitter using smooks.

    Yann Newbie



      I was using in my previous version of SOA platform, the following smooks configuration to split a received ESB message in seveal ones:


      <?xml version="1.0" encoding="UTF-8"?>
      <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
           <resource-config selector="global-parameters">
                <param name="stream.filter.type">DOM</param>
           <!-- Xml Job Splitter -->
           <resource-config selector="BMSMESSAGE/TASK">
                <param name="service-category-name">idtv3_esb_AdaptiveStreaming</param>
                <param name="service-name">JobProcessing</param>
                <param name="send-in-visit-after">true</param>


      This configuration was creating as many new "TASK" messages as there was in the original message XML structure. The produced splitted message was a org.w3c.dom.Element.


      Now the DOMServiceDelegateVisitor is deprecated and I have to find another way to execute this splitting action. It seems that the recomended way of doing a "for each" splitting action using smooks is as following:


      <?xml version="1.0" encoding="UTF-8"?>
      <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
          <!-- Create the split messages for the task items... -->
          <frag:serialize fragment="BMSMESSAGE/TASK" bindTo="TaskItem" />
          <!-- Route each task items split message to an ESB Service... -->
          <esbr:routeBean routeOnElement="BMSMESSAGE/TASK" beanIdRef="TaskItem" toServiceCategory="idtv3_esb_AdaptiveStreaming" toServiceName="JobProcessing" />


      Unfortunately the produced splitted message is no longer an Element (org.w3c.dom) but a String (due to the "serialize" action). Is there another solution to have an Element, or a Document as a result instead of a String ?