You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Maniek <ma...@gmail.com> on 2008/04/12 17:03:06 UTC
Content-based-router - problem with direction
Hi
I've got a small problem with "content-based-router". I would like to
send message which has a priority 1 to pipeline1 and message which has
a priority 0 to pipeline2, but everything I send it goes to pipeline2.
Is this a good configuriation "content-based-router"?
Mario
xbean.xml file:
<eip:content-based-router service="Guest:router" endpoint="router">
<eip:rules>
<eip:routing-rule>
<eip:predicate>
<eip:xpath-predicate xpath="/tns:Guest/@priority = '1'"/>
</eip:predicate>
<eip:target>
<eip:exchange-target service="Guest:pipeline1" endpoint="pipeline1"
/>
</eip:target>
</eip:routing-rule>
<eip:routing-rule>
<eip:target>
<eip:exchange-target service="Guest:pipeline2" endpoint="pipeline2"
/>
</eip:target>
</eip:routing-rule>
</eip:rules>
</eip:content-based-router>
<eip:xpath-splitter service="airClient:xpathSplitter"
endpoint="xpath" xpath="/AirClients/*">
<eip:target>
<eip:exchange-target service="airClient:router" endpoint="router" />
</eip:target>
</eip:xpath-splitter>
XML messages which is sended across spliter to router
<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:tns='http://esbtoolkit.com/service2/types'>
<env:Body>
<Guests>
<tns:Guest>
<tns:priority>0</tns:priority>
<tns:surname>Smith</tns:surname>
</tns:Guest>
<tns:Guest>
<tns:priority>1</tns:priority>
<tns:surname>Johnson</tns:surname>
</tns:Guest>
</Guests>
</env:Body>
</env:Envelope>
--
View this message in context: http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16650238.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Content-based-router - problem with direction
Posted by Guillaume Nodet <gn...@gmail.com>.
The needed class is part of servicemix-core and it seems your version is too
old and does not contain this required class.
On Mon, Apr 14, 2008 at 1:06 PM, Maniek <ma...@gmail.com> wrote:
>
> Hi
>
> Thanks for advice, but I've changed it into this version:
> <eip:namespace-context id="nsContext">
> <eip:namespaces>
> <eip:namespace
> prefix="tns">http://esbtoolkit.com/service2/types</eip:namespace>
> </eip:namespaces>
> </eip:namespace-context>
>
> <eip:content-based-router service="Guest:router" endpoint="router">
> <eip:rules>
> <eip:routing-rule>
> <eip:predicate>
> <eip:xpath-predicate xpath="/tns:Guest/tns:priority = '1'"
> namespaceContext="#nsContext"/>
> </eip:predicate>
> <eip:target>
> <eip:exchange-target service="Guest:pipeline1" endpoint="pipeline1"
> />
> </eip:target>
> </eip:routing-rule>
> <eip:routing-rule>
> </eip:rules>
> </eip:content-based-router>
>
> and "servicemix" refuses deploy project and returns error:
> "Caused by:
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Class that bean class
> [org.apache.servicemix.eip.support.NamespaceContextImpl] depends on not
> found
> Offending resource: file
>
> [C:\ESB\fuse-esb-3.3.0.6\bin\data\smx\service-assemblies\service2\version_9\sus\servicemix-eip\service2-eip-su\xbean.xml]
> Bean 'nsContext'; nested exception is java.lang.NoClassDefFoundError:
> org/apache/servicemix/jbi/jaxp/NamespaceContextImpl
>
> Should I implement "NamespaceContextImpl" or something like that? Any idea
> what can be wrong?
>
>
>
> Gert Vanthienen wrote:
> >
> > L.S.,
> >
> > And on top of that, you will probably have to add a namespaceContext
> > attribute to your xpath-predicate element and refer to a
> > NamespaceContext that defines the tns prefix you use in the XPath. Have
> > a look at
> >
> http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ContentBasedrouter
> > for an example for specifying the attribute, on the bottom of the same
> > page you'll find a sample definition for a namespacecontext.
> >
> > Regards,
> >
> > Gert
> >
> > Chris Custine wrote:
> >> Your example doesn't match up very well because it looks like you have
> >> swapped Guest for airClient in a few places (your splitter sends to
> >> airClient:router but your service is called Guest:router for example).
> I
> >> suspect this is a cut and paste error in the email more than anything
> or
> >> else your router wouldn't even be invoked.
> >>
> >> Aside from that, I think your XPath is wrong. You are checking the
> value
> >> of
> >> an *attribute* called priority but the example xml needs to check for
> an
> >> *element* called priority and the tns namespace is missing. So
> >> everything
> >> is failing the test and going to the default. Try changing your XPath
> to
> >> this:
> >>
> >> <eip:predicate>
> >> <eip:xpath-predicate xpath="/tns:Guest/tns:priority = '1'"/>
> >> </eip:predicate>
> >>
> >> Chris
> >>
> >>
> >> On Sat, Apr 12, 2008 at 9:03 AM, Maniek <ma...@gmail.com> wrote:
> >>
> >>
> >>> Hi
> >>>
> >>> I've got a small problem with "content-based-router". I would like to
> >>> send message which has a priority 1 to pipeline1 and message which has
> >>> a priority 0 to pipeline2, but everything I send it goes to pipeline2.
> >>> Is this a good configuriation "content-based-router"?
> >>>
> >>> Mario
> >>>
> >>> xbean.xml file:
> >>> <eip:content-based-router service="Guest:router" endpoint="router">
> >>> <eip:rules>
> >>> <eip:routing-rule>
> >>> <eip:predicate>
> >>> <eip:xpath-predicate xpath="/tns:Guest/@priority = '1'"/>
> >>> </eip:predicate>
> >>> <eip:target>
> >>> <eip:exchange-target service="Guest:pipeline1"
> >>> endpoint="pipeline1"
> >>> />
> >>> </eip:target>
> >>> </eip:routing-rule>
> >>> <eip:routing-rule>
> >>>
> >>> <eip:target>
> >>> <eip:exchange-target service="Guest:pipeline2"
> >>> endpoint="pipeline2"
> >>> />
> >>> </eip:target>
> >>> </eip:routing-rule>
> >>> </eip:rules>
> >>> </eip:content-based-router>
> >>>
> >>> <eip:xpath-splitter service="airClient:xpathSplitter"
> >>> endpoint="xpath" xpath="/AirClients/*">
> >>> <eip:target>
> >>> <eip:exchange-target service="airClient:router" endpoint="router"
> />
> >>> </eip:target>
> >>> </eip:xpath-splitter>
> >>>
> >>> XML messages which is sended across spliter to router
> >>> <?xml version='1.0' encoding='UTF-8'?>
> >>> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
> >>> xmlns:tns='http://esbtoolkit.com/service2/types'>
> >>> <env:Body>
> >>> <Guests>
> >>> <tns:Guest>
> >>> <tns:priority>0</tns:priority>
> >>> <tns:surname>Smith</tns:surname>
> >>> </tns:Guest>
> >>> <tns:Guest>
> >>> <tns:priority>1</tns:priority>
> >>> <tns:surname>Johnson</tns:surname>
> >>> </tns:Guest>
> >>> </Guests>
> >>> </env:Body>
> >>> </env:Envelope>
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16650238.html
> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> > -----
> > ---
> > Gert Vanthienen
> > http://www.anova.be
> >
>
> --
> View this message in context:
> http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16676130.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
Re: Content-based-router - problem with direction
Posted by Maniek <ma...@gmail.com>.
Hi
Thanks for advice, but I've changed it into this version:
<eip:namespace-context id="nsContext">
<eip:namespaces>
<eip:namespace
prefix="tns">http://esbtoolkit.com/service2/types</eip:namespace>
</eip:namespaces>
</eip:namespace-context>
<eip:content-based-router service="Guest:router" endpoint="router">
<eip:rules>
<eip:routing-rule>
<eip:predicate>
<eip:xpath-predicate xpath="/tns:Guest/tns:priority = '1'"
namespaceContext="#nsContext"/>
</eip:predicate>
<eip:target>
<eip:exchange-target service="Guest:pipeline1" endpoint="pipeline1"
/>
</eip:target>
</eip:routing-rule>
<eip:routing-rule>
</eip:rules>
</eip:content-based-router>
and "servicemix" refuses deploy project and returns error:
"Caused by:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Class that bean class
[org.apache.servicemix.eip.support.NamespaceContextImpl] depends on not
found
Offending resource: file
[C:\ESB\fuse-esb-3.3.0.6\bin\data\smx\service-assemblies\service2\version_9\sus\servicemix-eip\service2-eip-su\xbean.xml]
Bean 'nsContext'; nested exception is java.lang.NoClassDefFoundError:
org/apache/servicemix/jbi/jaxp/NamespaceContextImpl
Should I implement "NamespaceContextImpl" or something like that? Any idea
what can be wrong?
Gert Vanthienen wrote:
>
> L.S.,
>
> And on top of that, you will probably have to add a namespaceContext
> attribute to your xpath-predicate element and refer to a
> NamespaceContext that defines the tns prefix you use in the XPath. Have
> a look at
> http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ContentBasedrouter
> for an example for specifying the attribute, on the bottom of the same
> page you'll find a sample definition for a namespacecontext.
>
> Regards,
>
> Gert
>
> Chris Custine wrote:
>> Your example doesn't match up very well because it looks like you have
>> swapped Guest for airClient in a few places (your splitter sends to
>> airClient:router but your service is called Guest:router for example). I
>> suspect this is a cut and paste error in the email more than anything or
>> else your router wouldn't even be invoked.
>>
>> Aside from that, I think your XPath is wrong. You are checking the value
>> of
>> an *attribute* called priority but the example xml needs to check for an
>> *element* called priority and the tns namespace is missing. So
>> everything
>> is failing the test and going to the default. Try changing your XPath to
>> this:
>>
>> <eip:predicate>
>> <eip:xpath-predicate xpath="/tns:Guest/tns:priority = '1'"/>
>> </eip:predicate>
>>
>> Chris
>>
>>
>> On Sat, Apr 12, 2008 at 9:03 AM, Maniek <ma...@gmail.com> wrote:
>>
>>
>>> Hi
>>>
>>> I've got a small problem with "content-based-router". I would like to
>>> send message which has a priority 1 to pipeline1 and message which has
>>> a priority 0 to pipeline2, but everything I send it goes to pipeline2.
>>> Is this a good configuriation "content-based-router"?
>>>
>>> Mario
>>>
>>> xbean.xml file:
>>> <eip:content-based-router service="Guest:router" endpoint="router">
>>> <eip:rules>
>>> <eip:routing-rule>
>>> <eip:predicate>
>>> <eip:xpath-predicate xpath="/tns:Guest/@priority = '1'"/>
>>> </eip:predicate>
>>> <eip:target>
>>> <eip:exchange-target service="Guest:pipeline1"
>>> endpoint="pipeline1"
>>> />
>>> </eip:target>
>>> </eip:routing-rule>
>>> <eip:routing-rule>
>>>
>>> <eip:target>
>>> <eip:exchange-target service="Guest:pipeline2"
>>> endpoint="pipeline2"
>>> />
>>> </eip:target>
>>> </eip:routing-rule>
>>> </eip:rules>
>>> </eip:content-based-router>
>>>
>>> <eip:xpath-splitter service="airClient:xpathSplitter"
>>> endpoint="xpath" xpath="/AirClients/*">
>>> <eip:target>
>>> <eip:exchange-target service="airClient:router" endpoint="router" />
>>> </eip:target>
>>> </eip:xpath-splitter>
>>>
>>> XML messages which is sended across spliter to router
>>> <?xml version='1.0' encoding='UTF-8'?>
>>> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
>>> xmlns:tns='http://esbtoolkit.com/service2/types'>
>>> <env:Body>
>>> <Guests>
>>> <tns:Guest>
>>> <tns:priority>0</tns:priority>
>>> <tns:surname>Smith</tns:surname>
>>> </tns:Guest>
>>> <tns:Guest>
>>> <tns:priority>1</tns:priority>
>>> <tns:surname>Johnson</tns:surname>
>>> </tns:Guest>
>>> </Guests>
>>> </env:Body>
>>> </env:Envelope>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16650238.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>>
>
>
>
> -----
> ---
> Gert Vanthienen
> http://www.anova.be
>
--
View this message in context: http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16676130.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Content-based-router - problem with direction
Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,
And on top of that, you will probably have to add a namespaceContext
attribute to your xpath-predicate element and refer to a
NamespaceContext that defines the tns prefix you use in the XPath. Have
a look at
http://servicemix.apache.org/servicemix-eip.html#servicemix-eip-ContentBasedrouter
for an example for specifying the attribute, on the bottom of the same
page you'll find a sample definition for a namespacecontext.
Regards,
Gert
Chris Custine wrote:
> Your example doesn't match up very well because it looks like you have
> swapped Guest for airClient in a few places (your splitter sends to
> airClient:router but your service is called Guest:router for example). I
> suspect this is a cut and paste error in the email more than anything or
> else your router wouldn't even be invoked.
>
> Aside from that, I think your XPath is wrong. You are checking the value of
> an *attribute* called priority but the example xml needs to check for an
> *element* called priority and the tns namespace is missing. So everything
> is failing the test and going to the default. Try changing your XPath to
> this:
>
> <eip:predicate>
> <eip:xpath-predicate xpath="/tns:Guest/tns:priority = '1'"/>
> </eip:predicate>
>
> Chris
>
>
> On Sat, Apr 12, 2008 at 9:03 AM, Maniek <ma...@gmail.com> wrote:
>
>
>> Hi
>>
>> I've got a small problem with "content-based-router". I would like to
>> send message which has a priority 1 to pipeline1 and message which has
>> a priority 0 to pipeline2, but everything I send it goes to pipeline2.
>> Is this a good configuriation "content-based-router"?
>>
>> Mario
>>
>> xbean.xml file:
>> <eip:content-based-router service="Guest:router" endpoint="router">
>> <eip:rules>
>> <eip:routing-rule>
>> <eip:predicate>
>> <eip:xpath-predicate xpath="/tns:Guest/@priority = '1'"/>
>> </eip:predicate>
>> <eip:target>
>> <eip:exchange-target service="Guest:pipeline1"
>> endpoint="pipeline1"
>> />
>> </eip:target>
>> </eip:routing-rule>
>> <eip:routing-rule>
>>
>> <eip:target>
>> <eip:exchange-target service="Guest:pipeline2"
>> endpoint="pipeline2"
>> />
>> </eip:target>
>> </eip:routing-rule>
>> </eip:rules>
>> </eip:content-based-router>
>>
>> <eip:xpath-splitter service="airClient:xpathSplitter"
>> endpoint="xpath" xpath="/AirClients/*">
>> <eip:target>
>> <eip:exchange-target service="airClient:router" endpoint="router" />
>> </eip:target>
>> </eip:xpath-splitter>
>>
>> XML messages which is sended across spliter to router
>> <?xml version='1.0' encoding='UTF-8'?>
>> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
>> xmlns:tns='http://esbtoolkit.com/service2/types'>
>> <env:Body>
>> <Guests>
>> <tns:Guest>
>> <tns:priority>0</tns:priority>
>> <tns:surname>Smith</tns:surname>
>> </tns:Guest>
>> <tns:Guest>
>> <tns:priority>1</tns:priority>
>> <tns:surname>Johnson</tns:surname>
>> </tns:Guest>
>> </Guests>
>> </env:Body>
>> </env:Envelope>
>> --
>> View this message in context:
>> http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16650238.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>>
>
>
Re: Content-based-router - problem with direction
Posted by Chris Custine <cc...@apache.org>.
Your example doesn't match up very well because it looks like you have
swapped Guest for airClient in a few places (your splitter sends to
airClient:router but your service is called Guest:router for example). I
suspect this is a cut and paste error in the email more than anything or
else your router wouldn't even be invoked.
Aside from that, I think your XPath is wrong. You are checking the value of
an *attribute* called priority but the example xml needs to check for an
*element* called priority and the tns namespace is missing. So everything
is failing the test and going to the default. Try changing your XPath to
this:
<eip:predicate>
<eip:xpath-predicate xpath="/tns:Guest/tns:priority = '1'"/>
</eip:predicate>
Chris
On Sat, Apr 12, 2008 at 9:03 AM, Maniek <ma...@gmail.com> wrote:
>
> Hi
>
> I've got a small problem with "content-based-router". I would like to
> send message which has a priority 1 to pipeline1 and message which has
> a priority 0 to pipeline2, but everything I send it goes to pipeline2.
> Is this a good configuriation "content-based-router"?
>
> Mario
>
> xbean.xml file:
> <eip:content-based-router service="Guest:router" endpoint="router">
> <eip:rules>
> <eip:routing-rule>
> <eip:predicate>
> <eip:xpath-predicate xpath="/tns:Guest/@priority = '1'"/>
> </eip:predicate>
> <eip:target>
> <eip:exchange-target service="Guest:pipeline1"
> endpoint="pipeline1"
> />
> </eip:target>
> </eip:routing-rule>
> <eip:routing-rule>
>
> <eip:target>
> <eip:exchange-target service="Guest:pipeline2"
> endpoint="pipeline2"
> />
> </eip:target>
> </eip:routing-rule>
> </eip:rules>
> </eip:content-based-router>
>
> <eip:xpath-splitter service="airClient:xpathSplitter"
> endpoint="xpath" xpath="/AirClients/*">
> <eip:target>
> <eip:exchange-target service="airClient:router" endpoint="router" />
> </eip:target>
> </eip:xpath-splitter>
>
> XML messages which is sended across spliter to router
> <?xml version='1.0' encoding='UTF-8'?>
> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
> xmlns:tns='http://esbtoolkit.com/service2/types'>
> <env:Body>
> <Guests>
> <tns:Guest>
> <tns:priority>0</tns:priority>
> <tns:surname>Smith</tns:surname>
> </tns:Guest>
> <tns:Guest>
> <tns:priority>1</tns:priority>
> <tns:surname>Johnson</tns:surname>
> </tns:Guest>
> </Guests>
> </env:Body>
> </env:Envelope>
> --
> View this message in context:
> http://www.nabble.com/Content-based-router---problem-with-direction-tp16650238p16650238.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>