2 Replies Latest reply on Apr 28, 2011 2:38 AM by mstencel

    using spring beans in jbpm5

    ritesh adval Newbie

      Hi,

       

      I recently started looking at jbpm5 and was wondering if it will support invoking spring beans from bpmn2 process? (for example can a serviceTask implementation be a Spring bean?) jbpm4.4 does have invoking spring beans from jpdl file.

       

       

      Also one other question:

       

      (1)where is process variables  saved (which database table?), i do not see any specific table for this.

      I only see 6 tables (EVENTTYPES, NODEINSTANCELOG, PROCESSINSTANCEINFO, PROCESSINSTANCELOG, SESSIONINFO and WORKITEMINFO) when running sample evaluation process?

       

      Regards

      Ritesh

        • 1. using spring beans in jbpm5
          Kris Verlaenen Master

          Using service tasks you can plug in any implementation you want, as long as there is a way to invoke it from Java.

          The idea would be to create a domain-specific node that would invoke your spring beans:

          - define what parameters you want the user to define in the process

          - write and register a handler that invokes your spring bean based on the values provided by the process instance

           

          https://hudson.jboss.org/hudson/job/jBPM5/lastSuccessfulBuild/artifact/target/jbpm-5.0-SNAPSHOT-docs-build/jbpm-docs/html/ch06.html

           

          If you want, I could assist you in writing something like this, so we can add this to the list of domain-specific service nodes we support out-of-the-box?

           

          Regarding process variables, they are stored as part of the process instance state (inside the binary state of the process instance).  Pluggable variable persistence can allow you to change this though.  What are you trying to achieve?

           

          Kris

          • 2. using spring beans in jbpm5
            mstencel Newbie

            It would be nice to have Spring beans accessible in some simple way inside process e.g. in on entry/exit actions, constrains, basically in all expressions. It's possible now for example by defining global or by passing Spring bean as variable to process instance. But you have to implicitly specify, that the process is going to use such variable or global. It would be helpful to integrate this kind of beans injection into the engine (e.g. specifying which beans are going to be injected, or whether to inject all beans) without further overhead for programmer.

            I tried to implement custom GlobalResolver that try to resolve global from Spring context. I post it at http://community.jboss.org/message/601479#601479

            But it still needs to define global in process definitions files.