You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jeffreyzlee <je...@gmail.com> on 2006/04/25 11:36:39 UTC

question about drools component

Hi,
I tried drools component, and got exception:
(null: 3, 49): cvc-elt.1: Cannot find the declaration of element 'rule-set'. 
what is reason for that?
The files are as follow:

 DroolsiRulesTest.java
~~~~~~~~~~~~~~~~~

public class DroolsWithJbiRulesTest {
	public static void main(String[] args) {
		AbstractXmlApplicationContext  context = new
ClassPathXmlApplicationContext("droolsexample.xml");
        ServiceMixClient client =
(ServiceMixClient)context.getBean("client");
}}


droolsexample.xml
~~~~~~~~~~~

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0" 
	   xmlns:foo="http://servicemix.org/cheese/">
  <sm:container id="jbi" embedded="true">
    <sm:activationSpecs>
      <sm:activationSpec componentName="droolsRouter"
service="foo:droolsRouter" destinationService="foo:trace">
      	<sm:component>
      	 <bean
class="org.apache.servicemix.components.drools.DroolsComponent">
          <property name="ruleBaseResource" value="droolsrules.xml" />
         </bean>
        </sm:component>
      </sm:activationSpec>
      <sm:activationSpec componentName="trace" service="foo:trace">
				<sm:component>
					<bean
class="org.apache.servicemix.components.util.StreamWriterComponent" />
				</sm:component>
	</sm:activationSpec>
     </sm:activationSpecs>
  </sm:container>
  <bean id="client"
class="org.apache.servicemix.client.DefaultServiceMixClient">
    <constructor-arg ref="jbi"/>
  </bean>
</beans>


droolsrules.xml:
~~~~~~~~~

<rule-set name="cheese rules"
  xmlns="http://drools.org/rules"
  xmlns:java="http://drools.org/semantics/java">

  <application-data
identifier="jbi">org.apache.servicemix.components.drools.JbiHelper</application-data>
  <application-data
identifier="context">javax.jbi.component.ComponentContext</application-data>
  <application-data
identifier="deliveryChannel">javax.jbi.messaging.DeliveryChannel</application-data>

  <rule name="Ignore 2 message">
    <parameter identifier="exchange">
      <class>javax.jbi.messaging.MessageExchange</class>
    </parameter>
    <java:condition>"2".equals("2") </java:condition>
    <java:consequence>
        // lets try send a message
        jbi.forwardToService("http://servicemix.org/cheese/", "foo.trace");
    </java:consequence>
  </rule>
</rule-set>
   

good day,
Jeff
--
View this message in context: http://www.nabble.com/question-about-drools-component-t1504457.html#a4079347
Sent from the ServiceMix - User forum at Nabble.com.