Wrong Service invoked by Jbossesb ContentBasedRouter using X
helpforbosscomponents Aug 24, 2009 2:35 AMHi Folks
I need your help to resolve the below problem.
I am using the below components
1) Drools 4.0.
2) jboss Applicaion Sserver 4.2.2.GA
3) JBoss ESB - 4.4.GA
In jboss-esb.xml:
I use XpathLangauage.dsl in ContentBasedRouter service
The problem:
1) I use xml as input, service name what I used to NewMyRoutingRules.drl file is not
invoked instead some other service gets invoked.
2) Each time I give the same xml, different service gets invoked.
Scenario:
I pass AlerMessage.xml
rule used in NewMyRoutingRules.drl is
rule "AlertMessage Rule" when xpathEquals "/@AlertMessage", "AlertMessage" then Log : "XPATH Rule: CI_MessageStatus =CI_MessageStatus"; Destination : "DBReplication"; end
rule checks if the name of the xml is AlertMessage then invoke the service called DBReplication
but ContentBasedRouter is invoking randomly any one of the service in the route-to tag of ContentBasedRouter action
Input xml (name is AlertMessage.xml):
<?xml version="1.0" encoding="UTF-8"?> <AlertMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="taf_cat_complete_v5-1-1.xsd"> <MessageHeader> <CI_MessageStatus>CI_MessageStatus</CI_MessageStatus> <MessageReference> <MessageType MessageTypeCode="01"/> <MessageNumber>1</MessageNumber> <MessageDateTime>2001-12-31T12:00:00</MessageDateTime> </MessageReference> <MessageRoutingID>1</MessageRoutingID> <SenderReference>SenderReference</SenderReference> <Sender CI_InstanceNumber="01">01</Sender> <Recipient CI_InstanceNumber="01">01</Recipient> </MessageHeader> <CommitmentETA>2001-12-31T12:00:00</CommitmentETA> <ActualETA>2001-12-31T12:00:00</ActualETA> <WagonNumberFreight>WgnNmFreight</WagonNumberFreight> </AlertMessage>
jboss-esb.xml:
<action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouterAction"> <property name="ruleSet" value="NewMyRoutingRules.drl" /> <property name="ruleReload" value="false" /> <property name="ruleLanguage" value="XPathLanguage.dsl"/> <property name="destinations"> <route-to destination-name="DBReplication" service-category="DB-ReplicationManager" service-name="DBReplicationService" /> <route-to destination-name="Fax" service-category="FaxServiceManager" service-name="FaxService" /> <route-to destination-name="Printer" service-category="PrinterServiceManager" service-name="PrinterService" /> <route-to destination-name="Feedback" service-category="FeedbackManager" service-name="FeedbackService" /> <route-to destination-name="Email" service-category="EmailManager" service-name="EmailService" /> <route-to destination-name="Notification" service-category="NotificationManager" service-name="NotificationService" /> <route-to destination-name="CommonMetadataUpdate" service-category="CommonMetadataUpdateManager" service-name="CommonMetadataUpdateService" /> <route-to destination-name="SharedMetadataUpdate" service-category="SharedMetadataUpdateManager" service-name="SharedMetadataUpdateService" /> <route-to destination-name="RDMUpdate" service-category="RDMUpdateManager" service-name="RDMUpdateService" /> </property> </action>
deployment.xml:
<?xml version="1.0" encoding="UTF-8"?> <jbossesb-deployment> <depends>jboss.esb:deployment=jbrules.esb</depends> .... ...
NewMyRoutingRules.drl:
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 "AlertMessage Rule" when xpathEquals "/@AlertMessage", "AlertMessage" then Log : "XPATH Rule: CI_MessageStatus =CI_MessageStatus"; Destination : "DBReplication"; end rule "PathCancelledMessage Rule" when xpathEquals "/@PathCancelledMessage", "PathCancelledMessage" then Log : "XPATH Rule: CI_MessageStatus =CI_MessageStatus"; Destination : "Feedback"; end
Please help me in resolving the above issue.
Regards
--Rajinikanth