5 Replies Latest reply on Nov 1, 2010 2:31 PM by Giovanni Marigi

    jms and jbpm

    Uwe Rasmus Newbie

      Hi,

       

      I have to applications. One of them (A) is using JBPM inside to model some business process. At some stage the execution is moved to other application (B). The user has to do something in the second application. After it is done, I need to inform the first application (A), that it can continue in executing - go to the next node.

       

      The only thing I could come up with is this:

      the first application (A) will use async=true and JmsMessageServiceFactory. when the async node is entered, it will send email to the user with link to the second application (B).

      He will log in, make work in the second application. After he finishes, JMS message will be sent to queue, that A application will understand and will continue.

       

      However I was not able to find out, which kind of message it should be and how can A application restart its working. I've read many sources but haven't find solution.

      If somebody can help and show me the client code and how to do response in A application...

       

      Thanks a lot

      Uwe

        • 1. Re: jms and jbpm
          Maciej Swiderski Master

          why not using state activity instead? I think it is perfect to put application A process in wait after signaling application B. Once application B is done with its work it will signal back application A to continue with the flow.

          About JMS, jBPM 4.4 has support for JMS integration but only outbound traffic, so you shall use another technique to trigger process to continue... For more information about JMS activity take a look at dev guide http://docs.jboss.com/jbpm/v4/devguide/html_single/#jms

          • 2. Re: jms and jbpm
            Uwe Rasmus Newbie

            Actually we are using jbpm 3 with seam 2.2.

             

            The application A is bundled with jBPM, but B is without.

             

            Meanwhile I was able to prepare code that maybe could send JMS  message from B to A. If the message itself contains jobId, the JobListenerBean will execute the job. (discovered from source code)

            But I have 2 problems.

            1. How to get know the jobId itself? (The app B doesn't know that. Maybe it could be somehow handled with app A when creating the job, but that's also something I don't know how..)

            2. The A app cannot be deployed, because JmsMessageServiceFactory is not found. I found it's it jbpm-enterprise.jar package and I tried to add it to the .ear as module, that was successfull, but again when deploying, it fails with exception that it cannot find java:/JbpmDS datasource ("type-mapping is not initialized: java:/JbpmDS was not deployed or type-mapping was not configured.") That is correct as I didn't specify any. I would like to specify it, but I don't know, where it should point to. Should it be the same db as used in the app or another?

             

            Thanks for suggestions

            Uwe

            • 3. Re: jms and jbpm
              Alejandro Guizar Master

              Uwe, your design is unnecessarily complex because you are trying to incorporate jBPM internals which are not meant for external usage. I would model the process as follows.

              <process-definition name="callback">
               <start-state>
                <transition to="send-mail" />
               </start-state>
               <mail-node name="send-mail">
                <transition to="wait-for-callback" />
               </mail-node>
               <state name="wait-for-callback" />
              </process-definition>
              

              Once the user performs the work indicated in the email, application B should send a plain message to a queue with a long property set to the token ID. In addition you should code a simple MDB that reads  this message, loads the referenced token and signals it. That's all. You should not try to involve JmsMessageServiceFactory.

              1 of 1 people found this helpful
              • 4. Re: jms and jbpm
                Uwe Rasmus Newbie

                Hi,

                this seems to be simple and efficient, I will try it,

                Thank You

                • 5. Re: jms and jbpm
                  Giovanni Marigi Newbie

                  how is it possible from an external mdb to signal the jbpm "wait state"?

                  thanks,

                  Giovanni