| package org.apache.servicemix.drools | |
| import org.apache.servicemix.drools.model.Exchange; | |
| global org.apache.servicemix.drools.model.JbiHelper jbi; | |
| rule "Unspecified id" | |
| when | |
| me : Exchange( status == Exchange.ACTIVE, in : in != null ) | |
| eval( in.xpath("/bar:test/@id <= 0") ) | |
| then | |
| jbi.fault( "<fault>Id must be > 0</fault>" ); | |
| end | |
| rule "Route to target1" | |
| when | |
| me : Exchange( status == Exchange.ACTIVE, in : in != null ) | |
| eval( in.xpath("/bar:test/@id = 1") ) | |
| then | |
| jbi.route( "service::target1" ); | |
| end | |
| rule "Route to target2" | |
| when | |
| me : Exchange( status == Exchange.ACTIVE, in : in != null ) | |
| eval( in.xpath("/bar:test/@id = 2") ) | |
| then | |
| jbi.route( "service::target2" ); | |
| end | |
| rule "Route to target3" | |
| when | |
| me : Exchange( status == Exchange.ACTIVE, in : in != null ) | |
| eval( in.getProperty("prop") != null ) | |
| then | |
| jbi.route( "service::target3" ); | |
| end | |