Starting resource change scanner and notifier in drools-server.

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Starting resource change scanner and notifier in drools-server.

Graham Thomson
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

clandestino_bgd
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

Jason Davidson
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

Mark Proctor
It won't detect changes on the classpath. Needs to be file or http.

Mark
On 03/11/2010 21:49, Jason Davidson wrote:
Hello,

Any tips on this?  I'm seeing this same behavior using Drools 5.1.1:

Spring Beans:

  <!-- Drools : -->

  <drools:resource-change-scanner id="scanner" interval="10" />

  <drools:kbase id="ruleKBase">

  </drools:kbase>  

  <drools:kagent id="kagent1" kbase="ruleKBase">

    <drools:resources>

     <drools:resource type="CHANGE_SET" source="classpath:drools-changeset.xml"/>

    </drools:resources>

  </drools:kagent>


Changeset:

<change-set xmlns='http://drools.org/drools-5.0/change-set'

    xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

    xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' > 

    <add>

      <resource source="http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST"

           type='PKG' basicAuthentication="enabled" username="admin" password="admin" />

    </add>     

</change-set> 



At startup I see that the KnowledgeAgent registers a listener but never detects changes:

[2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with interval=60

[2010:11:307 15:11:506:info] ResourceChangeScanner created with default interval=60

[2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with interval=10

[2010:11:307 15:11:528:info] ResourceChangeNotification created

[2010:11:307 15:11:528:debug] ResourceChangeNotification monitor added monitor=org.drools.io.impl.ResourceChangeScannerImpl@616181be

[2010:11:307 15:11:529:debug] KnowledgeAgent building resource map

[2010:11:307 15:11:529:info] KnowledegAgent has started listening for ChangeSet notifications

[2010:11:307 15:11:529:info] KnowledgeAgent created, with configuration:

monitorChangeSetEvents=true scanResources=true scanDirectories=true newInstance=true

[2010:11:307 15:11:530:info] KnowledgeAgent applying ChangeSet

[2010:11:307 15:11:531:debug] KnowledgeAgent processing sub ChangeSet=[ClassPathResource path='drools-changeset.xml']

[2010:11:307 15:11:919:debug] KnowledgeAgent notifier subscribing to resource=[UrlResource path='http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST']

[2010:11:307 15:11:920:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@d2a7c1e to resource=[UrlResource path='http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST']

[2010:11:307 15:11:920:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@603a9c52 to resource=[UrlResource path='http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST']

[2010:11:307 15:11:920:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet


Thanks!

Jason


2010/9/23 Clandes Tino <[hidden email]>
Hi,
I've also faced the same problem.
Hope somebody could give a hint.
 
thanks & best,
milan

--- On Mon, 20/9/10, Graham Thomson <[hidden email]> wrote:

From: Graham Thomson <[hidden email]>
Subject: [rules-users] Starting resource change scanner and notifier in drools-server.
To: [hidden email]
Date: Monday, 20 September, 2010, 15:24



Hi,

I would like to ask for help with setting up drools-server with Guvnor. I am using version 5.1.1 of both.

I am trying to set up an instance of drools-server in Tomcat that periodically loads new updates of packages published in Guvnor (both drools-server and Guvnor run in the same instance of Tomcat).

My change set definition is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns='http://drools.org/drools-5.0/change-set'
  xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
  xs:schemaLocation='http://drools.org/drools-5.0/change-set
  http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'>
  <add>
    <resource source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/<one of my packages>/LATEST'
      type='PKG' basicAuthentication="enabled" username="<username>" password="" />
    <resource source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/<another of my packages>/LATEST"
      type="PKG" basicAuthentication="enabled" username="<username>" password="" />
  </add>
</change-set>

My knowledge-services.xml configuration is as follows (based on the unit test examples highlighted in http://article.gmane.org/gmane.comp.java.drools.user/20992/match=drools+spring):

<?xml version="1.0" encoding="UTF-8"?>
<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:resource-change-scanner id="s1" interval="5" />

  <drools:execution-node id="node1" />

  <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="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>
 
</beans>

On loading drools-server, the resources listed in the change set are loaded and available.

The problem is that when a new package built and published in Guvnor, drools-server does not detect this and update itself. The effect is the same as if a KnowledgeAgent were used locally and

  ResourceFactory.getResourceChangeNotifierService().start();
  ResourceFactory.getResourceChangeScannerService().start();

were not called. This leads me to the assumption that drools-server does not start these services by default.

My question is then can/how do I configure drools-server to start these services such that it will update new changes from Guvnor automatically?


Thanks a lot for any help you can offer,

Cheers,

Graham.

-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
rules-users@...
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

Jason Davidson
CONTENTS DELETED
The author has deleted this message.
flo
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

flo
In reply to this post by Graham Thomson
Bumping this thread - I'm actually observing exactly the same behaviour (all resources are being pulled via http). Anyone got news on this or some advice how to fix this?

Thanks!
Best,
flo
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

salaboy
Which version are you using? In 5.2.0.SNAPSHOT you can create a new session dynamically each time.
Then use some eviction policy to clean up the unneeded ones.
Greetings

- CTO @ http://www.plugtree.com
- MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jbug.com.ar
- Mauricio "Salaboy" Salatino -

On 27/11/2010, at 20:08, flo <[hidden email]> wrote:

>
> Bumping this thread - I'm actually observing exactly the same behaviour (all
> resources are being pulled via http). Anyone got news on this or some advice
> how to fix this?
>
> Thanks!
> Best,
> flo
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Starting-resource-change-scanner-and-notifier-in-drools-server-tp1528921p1979535.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
flo
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

flo
I'm using 5.1.1.34858 FINAL at the moment...

Is there any documentation or hints on how to achieve this behaviour in 5.2.0? The 5.2.0 SNAPSHOT docu doesn't seem to mention any new features (yet)...I took http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-integration/html/index.html as reference...

Thanks,
Best regards,
flo
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

SebRR
In reply to this post by Graham Thomson
Hi all,

I am able to connect with HTTPClient to drools-server 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:resources>
            <drools:resource type="DRL" source="classpath:rule1.drl" />
                </drools:resources>                                               
        </drools:kbase >
       
        <drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>       

</beans>

But my objective is to do the same (HTTP request client) but with the Guvnor repository instead of DRL resource.  So I have configure it to have a CHANGE_SET resource type and in my changeset.xml, I add the Guvnor snapshot (exactely like your config).  

But in this case, I am not able to call it as follow because of :

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
Reply | Threaded
Open this post in threaded view
|

Re: Starting resource change scanner and notifier in drools-server.

ganeshneelekani
In reply to this post by Graham Thomson
Hi

Can any one provide me sample code of using spring annotation and drools-guvnor involves using changeset.xml

Thanks
Ganesh Neelekani