[rules-users] Problems with globals in bpmn-flows

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Thu Oct 28 20:11:00 EDT 2010


Bjorn,

Unfortunately, the BPMN2 specification does not define anything that 
could be used to store globals (or imports for that matter).
We've always held back a little on adding custom extensions to the BPMN2 
spec but since it is stable now, I guess we will have no other choice.
I'll be adding some of the missing features that Drools Flow had as 
custom extensions of BPMN2 in the next few weeks.
You'll be able to do exactly what you describe after that.

As an alternative solution, you could however also use a rule task and 
add that one rule you described to handle calling the service.  You 
can't access working memory objects like that in a script task, but 
using a rule task with only one rule that should be possible.

Kris

Mahler wrote:
> Hello dear list,
>
> I currently have problems to access global variables in a drools 5.1 bpmn rule-flow. I have a script-task at the end of my process-flow in which I want to call a method of an "external" service. I instantiated the service and set it as global in the ksession before starting the process. In the script-task I add global x.y.z.MyService myService with the same name as setted before and call the object with the method with script-type mvel/java: myService.xyz();
>
> Is this the right way doing this? Because I'm receiving the error-message "cannot access variable with name 'myService'" or similar (can't remember exactly).
>
> When adding the service as a "process variable" in the model and then starting the process, I can access this variable in the script-task... but - I think using globals would be much nicer for accessing the service in some of my rules in the same way under the same variable.
>
> After all I also don't know how to access modified process-variables in my task. For example if I change some object in a rule-task before and in a script-task later I want to call a service with the modified object... do I have to read a process variable in the rule, modify it and then in the script-task I access the process-variable or could I access the changed object in the working-memory in the script-task as well? Like or similar because this is just rule-style:
> when
>         $o : MyObject (withMyChangedParameter == 'x')
> then
>         service.myMethod($o);
>
> TIA
> Björn
>
> Diese E-Mail kann vertrauliche und/oder rechtlich geschützte Informationen enthalten.
> Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information.
> If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail.
> Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>   




More information about the rules-users mailing list