[rules-users] stream mode

Mauricio Salatino salaboy at gmail.com
Sun Jan 10 19:14:33 EST 2010


It's good to know I always use entry points

2010/1/10 Edson Tirelli <ed.tirelli at gmail.com>

>
>    Not really. The session.insert(...) method will insert the facts/events
> into the "default" entry point. You don't need to use a named entry point if
> you don't want to. What makes the engine treat a POJO as an event is the
> @role(event) metadata in the declare statement.
>
>    Regarding the original question, the engine does not explicitly re-order
> any events/facts. They are processed in the order they are inserted, unless
> you are using partitions (it seems you are not). If order is important for
> you, just make sure you insert them in the proper order and make sure the
> timestamping strategy you are using is adequate.
>
>    Edson
>
> 2010/1/10 Mauricio Salatino <salaboy at gmail.com>
>
> if you don't put any timestamp fusion will automatically assign the
>> timestamp at the insertion time.
>> I see the problem now. You are probably not using the entry points for
>> events.
>> In your rules you need to add for example:
>> Alarm() from entry-point "alarmsEntryPoint"
>>
>> and then you need to insert the events in:
>>
>> ksession.getWorkingMemoryEntryPoint("alarmsEntryPoint").insert(new
>> Alarm());
>>
>> that will treat your POJO as event in fusion.
>> Please read the fusion documentation:
>>
>> http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html_single/index.html#d0e523
>>
>>
>> 2010/1/10 Khalil Hafsi <hafsi at fzi.de>
>>
>>  Hi Mauricio,
>>>
>>> Of course I did. What about the timestamps , agenda and jobs that were
>>> used in the example , are they necessary ?
>>>
>>> Thanks,
>>> k-
>>>
>>> Mauricio Salatino wrote:
>>>
>>> you need to call ksession.fireAllRules() after: ksession.insert(new
>>> Event(a))
>>>
>>>
>>> On Sun, Jan 10, 2010 at 6:29 PM, Khalil Hafsi <hafsi at fzi.de> wrote:
>>>
>>>> Hi Guys,
>>>>
>>>> I am using DROOLS FUSION last version
>>>> It is very important for me that events arrive in the order i fire them
>>>> , this is a part of the code used for stream mode :
>>>> >             KnowledgeBuilder kbuilder =
>>>> > KnowledgeBuilderFactory.newKnowledgeBuilder();
>>>> >
>>>> > kbuilder.add(ResourceFactory.newClassPathResource("pol.drl"),
>>>> > ResourceType.DRL);
>>>> >             if ( kbuilder.hasErrors() ) {
>>>> >                 System.err.println( kbuilder.getErrors().toString() );
>>>> >             }
>>>> >             KnowledgeBaseConfiguration config =
>>>> > KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>>>> >             config.setOption(EventProcessingOption.STREAM);
>>>> >             KnowledgeBase kbase =
>>>> > KnowledgeBaseFactory.newKnowledgeBase(config);
>>>> >
>>>> kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
>>>> >
>>>> >             StatefulKnowledgeSession ksession =
>>>> > kbase.newStatefulKnowledgeSession();
>>>>
>>>> after this part I just start inserting Events into the ksession , i.e
>>>> ksession.insert(new Event(a)) ...
>>>>
>>>> does this suffice to make the the engine in stream mode and hence
>>>> ordered ?
>>>> In the example app , Events were fired as they arrive , but a timestamp
>>>> was given , and also agenda and jobs were used.
>>>> Is that necessary for the engine to work in stream mode ?
>>>> I have a piece of code that gives me different results every time I run
>>>> it ?! it is in stream mode , but for some reason the rule either do not
>>>> fire , or do not print the output. is there a way to debug into this ?
>>>>
>>>> thank you .
>>>> k-
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>
>>>
>>>
>>> --
>>> - http://salaboy.wordpress.com
>>> - http://www.jbug.com.ar
>>> - Salatino "Salaboy" Mauricio -
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>>
>> --
>> - http://salaboy.wordpress.com
>> - http://www.jbug.com.ar
>> - Salatino "Salaboy" Mauricio -
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss by Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100110/23b50673/attachment.html 


More information about the rules-users mailing list