12 Replies Latest reply on Nov 25, 2005 4:03 AM by sandhuks

    Spring JBPM support

    houyunf

      I would like to share my implementation for the spring support. Here's the design consideration:

      1. make jbpm session factory a factory bean.
      2. make use of HibernateTemplate rather than access the Session object
      3. let spring AOP to handle the transaction issue.

      I use open session in view patten to start a hibernate session when a jbpm session is instantiated, and release the hibernate session from current thread when the jbpm session is closed.

      The implementation includes the following classes:
      1. SpringJbpmSessionFactory: a factory bean can generate SpringJbpmSession objects.
      2. SpringJbpmSession: when instantiated, hibernate session will be bound to current thread, until close() is called
      3. JbpmSessionFilter: an servlet filter will start a SpringJbpmSession when receive a http request and close it when request is served.
      4. JbpmSessionHelper: an helper class to popup current session used when close a jbpm session.

      The spring config would be

       <bean id="hbConfiguration"
       class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
       <property name="targetObject" ref="&amp;hbSessionFactory" />
       <property name="targetMethod" value="getConfiguration" />
       </bean>
      
      
       <bean id="jbpmSessionFactory"
       class="org.jbpm.spring.SpringJbpmSessionFactory">
       <constructor-arg ref="hbConfiguration" />
       <constructor-arg ref="hbSessionFactory" />
       <property name="hibernateTemplate" ref="hibernateTemplate" />
       <property name="transactionManager" ref="transactionManager" />
       </bean>
      
      


      Please download the source code from:
      http://triload.com/downloads/spring-jbpm/


      Yunfeng Hou

        • 1. Re: Spring JBPM support
          koen.aers

          Thanks for sharing this. We will certainly have a look at it. Would you be interested in contributing this code to the project if it would turn out to be a valuable addition?
          Comments of the community are of course needed and welcome...

          Regards,
          Koen

          • 2. Re: Spring JBPM support
            houyunf

            Sure. Be glad to. Let me know how I can contribute the codes.


            Yunfeng Hou

            • 3. Re: Spring JBPM support
              icyjamie

              Does it already use the new ContextBuilder stuff from 3.1 alpha?

              James

              • 4. Re: Spring JBPM support
                koba

                Hi.

                The http://triload.com/downloads/spring-jbpm/ url dows not available. If its not difficult, can you put this archive to working link?

                Thanks.

                • 5. Re: Spring JBPM support
                  houyunf

                  sorry, please check again.


                  Yunfeng Hou

                  • 6. Re: Spring JBPM support
                    houyunf

                    No, I do not know the ContextBuilder in 3.1 alpha.

                    Yunfeng Hou

                    • 7. Re: Spring JBPM support
                      icyjamie

                      The guys from jBpm implemented a little ioc-like container as well, for configuration purposes (And in the mean time, deprecated the current JbpmSessionFactory stuff, so you're in for a surprise when 3.1 is released). The 3.1 is already available in an early alpha release.
                      We tried to integrate this alpha release in Spring, however, there are some issues as well: see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=68868
                      You could nudge that thread to feed it with some comments as well ;-)

                      • 8. Re: Spring JBPM support

                        Just so everyone here knows, the Spring folks have jBPM integration on their roadmap and I know they have an alpha release. At the minimum I suggest you go here: http://opensource2.atlassian.com/projects/spring/browse/MOD-5 and vote for it, since they work on items based on user demand. I'd also suggest talking to them to see where they are on this and if they're aware of the changes so they're efforts aren't wasted.

                        • 9. The real need for Spring JBPM support
                          amir_gur

                          In release 3.1 of jBPM they deprecated the usage of JbpmSessionFactory and JbpmSession.
                          So I don't plan to use those classes, and I don't need the replacements you offer here.

                          The real need for integration with Spring is in the creation of the ActionHandlers.

                          In my ActionHandler I need to call some services I depend on. I want to use Spring for the dependancy injection.
                          So what is needed is a Spring implementation of the org.jbpm.instantiation package.

                          • 10. Re: Spring JBPM support
                            sandhuks

                            With the ContextBuilder config files I am gettting this feeling of duplication of the Spring context files.

                            ..and as amir_gur points out -with no access to application context . So these feel like isolated context files without access to my application services and objects.

                            Is the jbpm future tilting towards these spring like config files - and these start
                            supporting injection of application objects - we have a small Spring being developed in here... why not go for the real thing!!

                            but just getting my feet wet with this new stuff , maybe will see the light ...

                            -Sandhu

                            • 11. Re: Spring JBPM support
                              icyjamie

                              ContextBuilder was right in the middle of an alpha release, and from what I've seen in CVS, it is already removed, in favour of another way of working, which would the start point for integrating in Spring

                              • 12. Re: Spring JBPM support
                                sandhuks

                                I jus got 3.1 - alpha2 it is all there - ContextBuilder
                                with jbpmSession and jbpmSessionFactory deprecated ( what I was happily using with my version of jbpmTemplate )

                                ..and pls, what is the new alternative after contextBuilder ..

                                *what* is the latest branch/tag where the greats are working - hv to confess I am now confused. :-(

                                Sandhu