-
1. Re: Content Based Routing problem
beve Sep 17, 2008 4:18 AM (in response to mike_ap)Hi,
can you post the contents of 'CBRWorkRules.drl'?
Regards,
/Daniel -
2. Re: Content Based Routing problem
mike_ap Sep 17, 2008 8:46 AM (in response to mike_ap)Here it is:
package com.jboss.soa.esb.routing.cbr #list any import classes here. import org.jboss.soa.esb.message.Message; import org.jboss.soa.esb.message.format.MessageType; expander XPathLanguage.dsl #declare any global variables here global java.util.List destinations; rule "Ok Routing Rule using XPATH" when xpathEquals expr "xmldata/record/status", "1" then Log : "Job status ok"; Destination : "ok"; end rule "Invalid Routing Rule using XPATH" when xpathEquals expr "xmldata/record/status", "" then Log : "Empty Job status"; Destination : "invalid"; end
-
3. Re: Content Based Routing problem
beve Sep 17, 2008 9:27 AM (in response to mike_ap)Try:
xpathEquals expr "xmldata/record/status", " "
Notice the extra space there.
Regards,
/Daniel -
4. Re: Content Based Routing problem
mike_ap Sep 17, 2008 9:50 AM (in response to mike_ap)I tried putting different values between the quotes but it still seems to complain about the xpathEquals:
Unexpected token 'xpathEquals'
am I missing any semicolon or something? -
5. Re: Content Based Routing problem
mike_ap Sep 17, 2008 9:55 AM (in response to mike_ap)I also tried replacing xpathEquals with xpathGreaterThan and xpathLessThan and it complains that
Unable to expand: xpathLessThan expr "xmldata/record/status", "1"[13,2]: unknown:13:2 Unexpected token 'xpathGreaterThan'[23,2]: unknown:23:2 Unexpected token 'xpathLessThan'
It seems like it does not load the XPathLanguage.dsl -
6. Re: Content Based Routing problem
beve Sep 17, 2008 9:58 AM (in response to mike_ap)can you send me your .esb archive and I'll take a look?
-
7. Re: Content Based Routing problem
mike_ap Sep 17, 2008 11:48 AM (in response to mike_ap)It looks like XPathLanguage.dsl will work only if the XML has namespaces defined and then you use the "use namespaces" expression.
xpathEquals expr "/order:Order/@statusCode", " " use namespaces "order=http://org.jboss.soa.esb/Order"
How would I change the .dsl file to support XML without namespaces? like this:xpathEquals expr "/Order/@statusCode", " "
Looks like the namespace unaware methods don't work. Could you verify this on your side? -
8. Re: Content Based Routing problem
beve Sep 17, 2008 2:19 PM (in response to mike_ap)Hi,
When using xpath dsl without namespaces we needed the expressions to be different.
So the one without namespaces should be:xpathEquals "/Order/OrderLines/OrderLine/Product/@productId", "1"
and the one that uses namespaces:xpathEquals expr "/order:Order/@statusCode", "2" use namespaces "order=http://org.jboss.soa.esb/Order"
Notice that the namespace aware statements differ in that they need the extra 'expr' in front of the XPath expression. This is do avoid colliding with the non XPath aware statements in the dsl file.
This is mentioned in the "XPath Domain Specific Language" in the ServiceGuide.pdf but I had forgotten about it. Sorry about that.
Regards,
/Daniel -
9. Re: Content Based Routing problem
mike_ap Sep 17, 2008 4:12 PM (in response to mike_ap)Thank you. That did it! At least for the standard xpath methods included in the ESB.
One last question... if I have a newdsl.dsl file and I include it in my rules(.drl) like thisexpander NewDsl.dsl
what is the proper location for the .dsl file? inside of the jbossrules.esb?
I tried putting it inside of my .esb archive but I get a message:Unexpected token 'xpathBoolean'
inside my rule I havexpathBoolean "xmldata/record/id = 12345"
-
10. Re: Content Based Routing problem
beve Sep 17, 2008 4:25 PM (in response to mike_ap)Yes, that is the correct location.
Did you update the dsl in jboss-esb.xml aswell:<property name="ruleLanguage" value="NewDsl.dsl"/>
-
11. Re: Content Based Routing problem
mike_ap Sep 17, 2008 4:28 PM (in response to mike_ap)I didn't realize that it needs to be included both in the .drl file and the jboss-esb.xml.
Thank you!