Hi Esteban, yes my change set is linked to this resource:
*resource source=" http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/com.mypackage/MySnapshot * I have tried out the 2nd solution but JBoss says --> kAttribute 'knowledgeAgent' is not allowed to appear in element 'drools:ksession' Which version of Drools should I use for this? Thanks On Tue, Mar 15, 2011 at 12:59 PM, Esteban Aliverti < [email protected]> wrote: > I suspect that the ksession defined in spring is created BEFORE the agent > processes the resource. And even after the agent processes the resource, it > will create a new kbase (because you are not using newInstance="false"), so > the defined ksession will remain attached to an empty kbase. > I can think in 2 solutions: > 1.- Remove the ksession definition from the spring context file and > create a new ksession using the kagent: > kagent.newStatelessKnowledgeSession(); > 2.- Configure ksession's kagent from spring (this only works for > stateless ksessions): <drools:ksession id="ksession" type="stateless" > knowledgeAgent="kagent1"> > > By the way, the subject of this email says you re linking drools-server to > Guvnor, but your changeset is not using any Guvnor's URL. Are you manually > downloading the changeset.xml and putting it in your classpath? > > Best Regards, > > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > > Esteban Aliverti > - Developer @ http://www.plugtree.com > - Blog @ http://ilesteban.wordpress.com > > > 2011/3/15 Sébastien Raickman <[email protected]> > >> Hi all, >> >> I would like to connect to drools-server with HTTPClient with the >> following >> config: >> >> <beans xmlns="http://www.springframework.org/schema/beans" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> >> >> >> xmlns:drools="http://drools.org/schema/drools-spring" >> xsi:schemaLocation="http://www.springframework.org/schema/beans >> >> >> >> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd >> http://drools.org/schema/drools-spring >> >> >> >> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd"><drools:execution-node >> id="node1" /> <drools:kbase id="kbase1" >> node="node1"/> >> >> >> >> >> <drools:kagent id="kagent1" >> kbase="kbase1"> >> <drools:resources> <drools:resource >> type="CHANGE_SET" source="classpath:changeset.xml" /> >> </drools:resources> >> >> >> >> >> >> >> </drools:kagent> >> <drools:ksession id="ksession1" type="stateless" >> kbase="kbase1" node="node1"/> >> >> >> >> >> </beans> >> >> >> where my changeset.xml is adding a snapshot deployed with Guvnor. >> >> But I am not able to trig the rule with the following client: >> >> BatchExecutionCommandImpl command = new BatchExecutionCommandImpl(); >> command.setLookup("ksession1"); >> InsertObjectCommand insertObjectCommand = new InsertObjectCommand("TEST"); >> >> FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand(); >> command.getCommands().add(insertObjectCommand); >> command.getCommands().add(fireAllRulesCommand); >> >> String xml = BatchExecutionHelper.newXStreamMarshaller().toXML(command); >> >> HttpClient httpClient = new HttpClient(); >> httpClient.getHostConfiguration().setHost("host", 8080); >> >> PostMethod postMethod = new >> PostMethod("/drools-5.1.1-server/kservice/rest/execute"); >> postMethod.setRequestEntity(new StringRequestEntity(xml, null, null)); >> >> >> try { >> >> httpClient.executeMethod(postMethod); >> int code = postMethod.getStatusCode(); >> System.out.println(code); >> String rep = postMethod.getResponseBodyAsString(); >> System.out.println(rep); >> >> } catch(Exception e) {...} >> >> Do someone have any idea how to achieve this? >> >> Thanks >> >> Sebastien >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
