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

Mahler, Björn Bjoern.Mahler at lineas.de
Tue Oct 26 01:37:43 EDT 2010


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.




More information about the rules-users mailing list