[rules-users] How can generated facts/events be published?

Tina Vießmann tviessmann at stud.hs-bremen.de
Sun Aug 29 15:24:54 EDT 2010


  Thank you, Wolfgang! :)

Let's say:
I'm generating StatusMessage objects during the rule processing. They 
will be published. But they are also need for further processing (so 
they can not be deleted after publishing).
The StatusMessage objects defined as simple POJOs.

If I'm publishing the StatusMessage objects using a rule like
     rule 'publish StatusMessages'
         when
             $msg : StatusMessage( )
         then
             // publish
     end
In this case every StatusMessage would be send again and again.
My first impression for a solution would be to define a Boolean field 
'send' that signals if the object has been send. But the field would 
just be needed for Drools internal processing. So I thought of defining 
this additional field using the declare statement. But if I remember 
correctly from previous tries, such a things are not possible because 
the declare statement with the additional field is the definition of a 
new type... Am I right so far?

Do you have a idea how I can solve my problem of sending an fact/event 
just once but keep it in the memory for further processing?

Thank sou!
Tina


> The usual method:
> You establish a TopicPublisher as a global declared in your .drl file.
>    global TopicPublisher topicPublisher
> You must set this from Java code using
>    TopicPublisher topicPublisher = ...;
>    statefulKnowledgeSession.setGlobal( "publisher", topicPublisher )
> and then you use it in any RHS code.
>
> Of course, a TopicPublisher could also be (field of) some fact,
> but this shouldn't be necessary for such a central service.
>
> -W
>
>
> On 29 August 2010 19:16, Tina Vießmann <tviessmann at stud.hs-bremen.de 
> <mailto:tviessmann at stud.hs-bremen.de>> wrote:
>
>      Hi,
>
>     I've got a simple question.
>
>     How can I get generated facts out of the memory (for publishing them
>     using JMS)?
>
>     Thanks :)
>     Tina
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> 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/20100829/96c7ac44/attachment.html 


More information about the rules-users mailing list