[rules-users] Drools rules

annukaila annu.sifu at gmail.com
Sat Apr 23 05:39:28 EDT 2011


Hi

iam new to drools rules my problem is


iam receiving message in xml format so using drools have to route it my
drools rules work when the xml message is the format as below

<?xml version="1.0" encoding="UTF-8"?>
<IATA>
<messageaudit senderId="125" receiverId="FFCategory"
dateTimeOfMessage="19:00" 
messageVersion="FSU/13/RCS" airwaybill="125-1234565" />
<fsurcs AwbNumber="125-1234565" origin="HYD" destination="KUL"
totalPieces="T40" totalWeight="K200"
statusCodeConsignmentRecieveDFromShipperOrAgent="RCS"
dayAndMonthOfReceipt="02June" actualTimeOfGivenStatusEvent="19:00"
airportCodeOfReceipt="HYD"
totalOrPartNumberOfPices="T40" weightOfTotalOrPartOfPieces="K200"
nameOfAgentOfShipper="Shipper" osi="RcsMessage"/>
</IATA>

but if the xml is the format as below 

<?xml version="1.0" encoding="UTF-8"?>
<IATA>
<messageaudit>
<senderId>125</senderId>
<receiverId>FFCategory</receiverId>
<dateTimeOfMessage>19:00</dateTimeOfMessage>
<messageVersion>FSU/13/RCS</messageVersion>
<airwaybill>125-1234565</airwaybill>
</messageaudit>
<fsurcs>
<AwbNumber>125-1234565</AwbNumber>
<origin>HYD</origin>
<destination>KUL</destination>
<totalPieces>T40</totalPieces>
<totalWeight>K200</totalWeight>
<statusCodeConsignmentRecieveDFromShipperOrAgent>RCS</statusCodeConsignmentRecieveDFromShipperOrAgent>
<dayAndMonthOfReceipt>02June</dayAndMonthOfReceipt>
<actualTimeOfGivenStatusEvent>19:00</actualTimeOfGivenStatusEvent>
<airportCodeOfReceipt>HYD</airportCodeOfReceipt>
<totalOrPartNumberOfPices>T40</totalOrPartNumberOfPices>
<weightOfTotalOrPartOfPieces>K200</weightOfTotalOrPartOfPieces>
<nameOfAgentOfShipper>Shipper</nameOfAgentOfShipper>
<osi>RcsMessage</osi>
</fsurcs>
</IATA>


it is not routing the message means not recognizing the drools and my drools
file is as follows

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 "Blue Routing Rule using XPATH"	
	when
		xpathEquals  "/IATA/messageaudit/@messageVersion" "FSU/13/RCS" 
	then 
	    Log : "Blue Team";
		Destination : "blue";		
end

rule "Red Routing Rule using XPATH"	
	when
		xpathEquals  "/IATA/messageaudit/@messageVersion" "FSU/13/MAN"
	then 
	     Log : "Red Team";
		Destination : "red";		
end

rule "Green Routing Rule using XPATH"	
	when
		xpathEquals  "/IATA/messageaudit/@messageVersion" "FSU/13/DEP"
	then 
	     Log : "Green Team";
		Destination : "green";		
end



please help me hoe to rectify this its very urgent for me and please dnt
mind if i did any mistakes


thanku 
 

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-rules-tp2854688p2854688.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list