[rules-users] Drools server link to Guvnor repository

Sébastien Raickman sebastien.raickman at gmail.com
Tue Mar 15 09:50:07 EDT 2011


Yes I am using 5.1.1 and if I go to the latest xsd
(drools-spring-1.2.0.xsd), there is no attribute called 'knowledgeAgent' .

On Tue, Mar 15, 2011 at 2:09 PM, Esteban Aliverti <
esteban.aliverti at gmail.com> wrote:

> I think 5.1.1 should be fine. Which version are you using?
>
> Best,
>
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Developer @ http://www.plugtree.com
> - Blog @ http://ilesteban.wordpress.com
>
>
> On Tue, Mar 15, 2011 at 9:24 AM, Sébastien Raickman <
> sebastien.raickman at gmail.com> wrote:
>
>> 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 <
>> esteban.aliverti at gmail.com> 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 <sebastien.raickman at gmail.com>
>>>
>>>> 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" />&nbsp; &nbsp; &nbsp; &nbsp; <drools:kbase id="kbase1" node="node1"/>&nbsp; &nbsp; &nbsp; &nbsp;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> &nbsp; &nbsp; &nbsp; &nbsp; <drools:kagent id="kagent1" kbase="kbase1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <drools:resources>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <drools:resource type="CHANGE_SET" source="classpath:changeset.xml" />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </drools:resources>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> &nbsp; &nbsp; &nbsp; &nbsp; </drools:kagent>&nbsp; &nbsp; &nbsp; &nbsp;
>>>> &nbsp; &nbsp; &nbsp; &nbsp; <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>&nbsp; &nbsp; &nbsp; &nbsp;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> </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
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110315/fccbac75/attachment.html 


More information about the rules-users mailing list