|
I’ve ran into an issue with the
XPath Router. We are currently looking at a few open source ESB products to
determine if they are a viable solution for us. Any assistance is greatly
appreciated. I’m trying to whip together a quick
XPath Router proof of concept. Here’s what I want to do: 1) Receive
XML event from HTTP receiver 2) Route
event based on XPath rules 3) Ultimately
persist to disk Here’s the config I’m using: -------------------------------------------------------------------------------- <beans
xmlns:bwnet="http://broadwing.net/xml"> <container id="jbi"> <components> <component
id="httpReceiver" service="bwnet:httpBinding"
endpoint="httpReceiver"
class="org.servicemix.components.http.HttpConnector"
destinationService="bwnet:xmlRouter"> <property
name="host" value="reyonman"/> <property
name="port" value="8912"/> </component> <component
id="xmlRouter" service="bwnet:xmlRouter"
class="org.servicemix.components.xslt.XsltComponent"> <property
name="xsltResource" value="EventFilter.xslt"/> <property
name="disableOutput" value="true"/> </component> <component
id="filteredEvents" service="bwnet:filteredEvents"
class="org.servicemix.components.file.FileWriter"> <property
name="directory"
value="/apps/servicemix/broadwing.net/filteredEvents"/> <property
name="marshaler"> <bean
class="org.servicemix.components.util.DefaultFileMarshaler"> <property
name="fileName"> <bean
class="org.servicemix._expression_.JaxenStringXPathExpression"> <constructor-arg
value="concat('Event_', //@router-id, '.xml')"/> </bean> </property> </bean> </property> </component> </components> </container> </beans> -------------------------------------------------------------------------------- Here’s EventFilter.xslt (currently
immediately routes straight to bwnet:filteredEvents): -------------------------------------------------------------------------------- <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jbi="xalan://org.servicemix.components.xslt.XalanExtension"
extension-element-prefixes="jbi"
xmlns:bwnet="http://broadwing.net/xml" version="1.0"> <xsl:template
match="/*"> <jbi:forward
service="bwnet:filteredEvents" /> </xsl:template> </xsl:stylesheet> -------------------------------------------------------------------------------- And here’s a sample event: -------------------------------------------------------------------------------- <Event router-id=”231489”
/> -------------------------------------------------------------------------------- When I post the event, the router is
executed, but filteredEvents is never called. However, if I change my XSLT to
use jbi:invoke instead of jbi:forward it works. For example: -------------------------------------------------------------------------------- <jbi:invoke
service="bwnet:filteredEvents"> <jbi:copyProperties/> <xsl:copy-of
select="."/> </jbi:invoke> -------------------------------------------------------------------------------- For a sanity check, I setup the example
found online, using the config file found in the test cases. It seems that the
same thing is happening with it as well. The ‘invokes’ (e.g.
script) are executing and the ‘forwards’ (i.e. trace) are not. _____________________________________________________ |
- [servicemix-user] XPath Router Issue Schweter, Ryan
- Re: [servicemix-user] XPath Router Issue James Strachan
