6 Replies Latest reply on Jul 10, 2009 10:25 AM by Robert Moskal

    Some Questions about Spring JBPM4 Integration

    Robert Moskal Newbie

      Greetings all:

      I've been working with the excellent demo project posted by Andries Inzé that shows how to integrate Spring and jBPM4 at http://www.inze.be/andries/. I've managed to get things working against the trunk code but not CR1. I see how we can pass arguments to the java objects in the spring context:


      <env type=�org.jbpm.pvm.internal.history.HistorySession�/>


      I'm curious as to what else can be passed to the java object. Like I'd like to get a copy of the actual Execution. HistorySession has only one method.

      Also will it be possible to declare nodes that pull from the Spring context?


      I'm super excited about the combination of Spring/jBPM4.


      Thanks and regards,


      Robert Moskal
      Most Media
      brooklyn, USA

        • 1. Re: Some Questions about Spring JBPM4 Integration
          Joram Barrez Master

           

          I'm curious as to what else can be passed to the java object. Like I'd like to get a copy of the actual Execution.


          Afaik, there is no easy way to just inject the actual executions, since
          * There are potentially many many executions active
          * Spring injects dependencies when the appCtx is built, so injecting a new object would mean that every dependant must be re-initialized, which is not happening in Spring

          Also will it be possible to declare nodes that pull from the Spring context?


          Yes, this will be in the 4.0 release and is already documented in the devguide of that release. You can use decisions, custom, etc nodes which are completely defined in Spring.

          I'm super excited about the combination of Spring/jBPM4.

          I'm very happy to hear that! (we are too very excited ;-)

          • 2. Re: Some Questions about Spring JBPM4 Integration
            Robert Moskal Newbie

            Thanks for replying!

            You may have misunderstood me, I don't want to inject an Execution into the context. But I would want to pass it as a variable to say a entity. The existing Spring demo shows a HistorySession being passed as an argument to a method. I imagine there must be a way to pass something like the current Execution to a node so I can tell what node I'm at, for example.

            Thanks,

            Rob

            • 3. Re: Some Questions about Spring JBPM4 Integration
              Andries Inzé Newbie

               

              "rmoskal" wrote:
              Thanks for replying!

              You may have misunderstood me, I don't want to inject an Execution into the context. But I would want to pass it as a variable to say a <java/> entity. The existing Spring demo shows a HistorySession being passed as an argument to a method. I imagine there must be a way to pass something like the current Execution to a node so I can tell what node I'm at, for example.

              Thanks,

              Rob


              Rob,

              An excellent question! :)

              Joram, when invoking a spring bean from the process, only one execution is active. Can't we get it from an or something?


              • 4. Re: Some Questions about Spring JBPM4 Integration
                Alfie Kirkpatrick Newbie

                As Joram said you can use spring beans as the class behind a custom or decision node, in which case it implements the respective interface and is passed the execution in the call. Does this answer the question?

                eg.

                • 5. Re: Some Questions about Spring JBPM4 Integration
                  Robert Moskal Newbie

                  I see how it's done. The current execution can be passed as a method parameter like so:









                  This will be great once I figure out how to get it to work with grroovy or jython.

                  • 6. Re: Some Questions about Spring JBPM4 Integration
                    Robert Moskal Newbie

                    I guess the instant reply doesn't like code.


                    <java expr="#{echoService}" g="140,176,92,52" method="sayHelloWithExecution" name="echo2">
                     <arg>
                     <object expr="#{execution}"/>
                    
                     </arg>
                     <transition g="-70,-22" name="accept" to="join1"/>
                     </java>