ESB Message splitter using smooks.
yperey Nov 6, 2012 5:27 AMHello,
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> </resource-config> <!-- Xml Job Splitter --> <resource-config selector="BMSMESSAGE/TASK"> <resource>org.jboss.soa.esb.visitors.DOMServiceDelegateVisitor</resource> <param name="service-category-name">idtv3_esb_AdaptiveStreaming</param> <param name="service-name">JobProcessing</param> <param name="send-in-visit-after">true</param> </resource-config> </smooks-resource-list>
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" xmlns:frag="http://www.milyn.org/xsd/smooks/fragment-routing-1.2.xsd" xmlns:esbr="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.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" /> </smooks-resource-list>
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 ?
thanks,
Yann.