[servicemix-user] XSLT/XPath routing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[servicemix-user] XSLT/XPath routing

Matt DeHoust
I am using ServiceMix 2.0 with the following configuration.

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0"
xmlns:spring="http://xbean.org/schemas/spring/1.0"
xmlns:sm="http://servicemix.org/config/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xbean.org/schemas/spring/1.0 ../../conf/spring-beans.xsd http://servicemix.org/config/1.0 ../../conf/servicemix.xsd"
       xmlns:my="http://servicemix.org/demo/">
  <!-- the JBI container -->
  <sm:container spring:id="jbi" useMBeanServer="true"
  createMBeanServer="true" dumpStats="true" statsInterval="10"
  flowName="st" monitorInstallationDirectory="false">
    <sm:activationSpecs>
      <!-- lets kick off a timer  every 5 seconds -->
      <sm:activationSpec componentName="timer" service="my:timer"
      destinationService="my:router">
        <sm:component>
          <spring:bean class="org.servicemix.components.quartz.QuartzComponent">
            <property name="triggers">
              <map>
                <entry>
                  <key>
                    <bean class="org.quartz.SimpleTrigger">
                      <property name="repeatInterval"
                      value="5000" />
                      <property name="repeatCount" value="-1" />
                    </bean>
                  </key>
                  <bean class="org.quartz.JobDetail">
                    <property name="name" value="My Example Job" />
                    <property name="group" value="ServiceMix" />
                  </bean>
                </entry>
              </map>
            </property>
          </spring:bean>
        </sm:component>
      </sm:activationSpec>
      <sm:activationSpec componentName="router"
      service="my:router">
        <sm:component>
          <spring:bean class="org.servicemix.components.xslt.XsltComponent">
            <property name="xsltResource"
            value="classpath:just-copy.xsl" />
            <property name="disableOutput" value="true" />
          </spring:bean>
        </sm:component>
      </sm:activationSpec>
      <sm:activationSpec componentName="trace" service="my:trace">
        <sm:component>
          <spring:bean class="org.servicemix.components.util.TraceComponent" />
        </sm:component>
      </sm:activationSpec>
    </sm:activationSpecs>
  </sm:container>
</beans>

The QuartzComponent creates a message every five seconds, the content of which looks something like this.

<?xml version = '1.0'?>
<timer>
    <name>My Example Job</name>
    <group>ServiceMix</group>
    <fullname>ServiceMix.My Example Job</fullname>
    <description/>
    <fireTime>Tue Nov 08 16:03:29 EST 2005</fireTime>
</timer>

The XsltComponent's just-copy.xsl looks like this.

<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:jbi="<a href="xalan://org.servicemix.components.xslt.XalanExtension">xalan://org.servicemix.components.xslt.XalanExtension"
        extension-element-prefixes="jbi"
        xmlns:my="http://servicemix.org/demo/"
        version="1.0">
    <xsl:template match="/">
        <jbi:invoke service="my:trace">
            <jbi:copyProperties/>
            <xsl:copy-of select="/"/>
        </jbi:invoke>       
    </xsl:template>
</xsl:stylesheet>

For some reason no messages ever appear on the console as if jbi:invoke were never being called. If I replace the destinationService of my:timer with my:trace, then I see trace messages every five seconds. Any ideas why messages seem to never leave my:router?

Thanks,
Matt

Reply | Threaded
Open this post in threaded view
|

[servicemix-user] Re: XSLT/XPath routing

Matt DeHoust
Turns out I had a misconfiguration in my environment. Some critical XML processing libraries were missing or outdated. The XSLT component works fine. Sorry for the false alarm.

On 11/8/05, Matt DeHoust <[hidden email]> wrote:
I am using ServiceMix 2.0 with the following configuration.

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="<a href="http://xbean.org/schemas/spring/1.0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://xbean.org/schemas/spring/1.0 "
xmlns:spring="<a href="http://xbean.org/schemas/spring/1.0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://xbean.org/schemas/spring/1.0 "
xmlns:sm="<a href="http://servicemix.org/config/1.0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://servicemix.org/config/1.0"
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation="<a href="http://xbean.org/schemas/spring/1.0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://xbean.org/schemas/spring/1.0 ../../conf/spring-beans.xsd <a href="http://servicemix.org/config/1.0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://servicemix.org/config/1.0 ../../conf/servicemix.xsd"
       xmlns:my="<a href="http://servicemix.org/demo/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://servicemix.org/demo/">
  <!-- the JBI container -->
  <sm:container spring:id="jbi" useMBeanServer="true"
  createMBeanServer="true" dumpStats="true" statsInterval="10"
  flowName="st" monitorInstallationDirectory="false">
    <sm:activationSpecs>
      <!-- lets kick off a timer  every 5 seconds -->
      <sm:activationSpec componentName="timer" service="my:timer"
      destinationService="my:router">
        <sm:component>
          <spring:bean class="org.servicemix.components.quartz.QuartzComponent">
            <property name="triggers">
              <map>
                <entry>
                  <key>
                    <bean class="org.quartz.SimpleTrigger">
                      <property name="repeatInterval"
                      value="5000" />
                      <property name="repeatCount" value="-1" />
                    </bean>
                  </key>
                  <bean class="org.quartz.JobDetail">
                    <property name="name" value="My Example Job" />
                    <property name="group" value="ServiceMix" />
                  </bean>
                </entry>
              </map>
            </property>
          </spring:bean>
        </sm:component>
      </sm:activationSpec>
      <sm:activationSpec componentName="router"
      service="my:router">
        <sm:component>
          <spring:bean class="org.servicemix.components.xslt.XsltComponent">
            <property name="xsltResource"
            value="classpath:just-copy.xsl" />
            <property name="disableOutput" value="true" />
          </spring:bean>
        </sm:component>
      </sm:activationSpec>
      <sm:activationSpec componentName="trace" service="my:trace">
        <sm:component>
          <spring:bean class="org.servicemix.components.util.TraceComponent" />
        </sm:component>
      </sm:activationSpec>
    </sm:activationSpecs>
  </sm:container>
</beans>

The QuartzComponent creates a message every five seconds, the content of which looks something like this.

<?xml version = '1.0'?>
<timer>
    <name>My Example Job</name>
    <group>ServiceMix</group>
    <fullname>ServiceMix.My Example Job</fullname>
    <description/>
    <fireTime>Tue Nov 08 16:03:29 EST 2005</fireTime>
</timer>

The XsltComponent's just-copy.xsl looks like this.

<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/1999/XSL/Transform "
        xmlns:jbi="xalan://org.servicemix.components.xslt.XalanExtension"
        extension-element-prefixes="jbi"
        xmlns:my="<a href="http://servicemix.org/demo/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://servicemix.org/demo/"
        version="1.0">
    <xsl:template match="/">
        <jbi:invoke service="my:trace">
            <jbi:copyProperties/>
            <xsl:copy-of select="/"/>
        </jbi:invoke>       
    </xsl:template>
</xsl:stylesheet>

For some reason no messages ever appear on the console as if jbi:invoke were never being called. If I replace the destinationService of my:timer with my:trace, then I see trace messages every five seconds. Any ideas why messages seem to never leave my:router?

Thanks,
Matt