9 Replies Latest reply on Aug 24, 2007 9:56 AM by Jason Lenhart

    jBPM and Continuing a Process Instance

    Jason Lenhart Newbie

      I looked throught the Javadocs and could not find info on the BpmProcessor.

      I notice some contructs like this - I am using them:

      <action name="signal_the_new_process_instance"
       class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
       <property name="command" value="SignalCommand" />
       <property name="process-definition-name" value="processDefinition2"/>
       <property name="esb-to-jbpm">
       <!-- esb-name maps to getBody().get("eVar1") -->
       <variables>
       <variable esb-name="eVar1" jbpm-name="counter" value="45" />
       <property name="process-definition-name" value="processDefinition2"/>
       <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
       </variables>
       </property>
       </action>
      


      However, I am wondering if there are any contructs that would allow me to re-associate a message in the ESB with an existing process instance - perhaps based on something in the message?

      Thanks,

      Jason

        • 1. Re: jBPM and Continuing a Process Instance
          Burr Sutter Master

          Yes, we are working on the quickstarts now to illustrate this.

          However, the team that is focused on jBPM+ESB integration (myself & Kurt) are both gone all of next week.

          In any case, look at the unit test for this capability. if you dig hard enough you'll find a "signal" command which allows your inbound message to fire/signal an existing instance.

          • 2. Re: jBPM and Continuing a Process Instance
            Jason Lenhart Newbie

            Good deal ... Thanks Burr - I will take a look ;-)

            • 3. Re: jBPM and Continuing a Process Instance
              Burr Sutter Master

              Some quick research shows that the signal command is expecting to find the following:

              message.getBody().add("jbpmTokenId","10");

              where 10 is token to the current business process instance. Note: when jBPM calls the ESB via the ESBActionHandler this item is injected into the message.

              • 4. Re: jBPM and Continuing a Process Instance
                Esteban Schifman Newbie

                Good answer Burr. ESBActionHandler makes your life a lot easier. It does however use BpmProcessor under the covers

                • 5. Re: jBPM and Continuing a Process Instance
                  Jason Lenhart Newbie

                  Just so I get this straight ... you are saying:

                  1) I receive a message that I am listening for that ultimately will 'signal' a process instance to the next transition
                  2) I do some magical code on my end to get the process instance
                  3) I add it to the message with

                  message.getBody().add("jbpmTokenId","10");
                  


                  and then my next action in the chain should be:

                  <action name="signal_the_new_process_instance"
                   class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
                   <property name="command" value="SignalCommand" />
                   <property name="process-definition-name" value="processDefinition2"/>
                   <property name="esb-to-jbpm">
                   <!-- esb-name maps to getBody().get("eVar1") -->
                   <variables>
                   <variable esb-name="eVar1" jbpm-name="counter" value="45" />
                   <property name="process-definition-name" value="processDefinition2"/>
                   <variable esb-name="BODY_CONTENT" jbpm-name="theBody" />
                   </variables>
                   </property>
                   </action>
                  


                  Is this right?



                  • 6. Re: jBPM and Continuing a Process Instance
                    Jason Lenhart Newbie

                    Also - I am wondering if there is anyway that I could set the process instance ID that I want to use in the beginning? Obviously it would be unique each time.

                    • 7. Re: jBPM and Continuing a Process Instance
                      Jason Lenhart Newbie

                      I am trying to get this continuance to work and have tried to set both:

                      message.getBody().add("jbpmProcessInstId",processInstance.getId());

                      and

                      message.getBody().add("jbpmTokenId","10");

                      Essentially - I am creating a process instance (only one) - then I trigger a new listener and since I know there is only one - I do a quick lookup on both the process instance id and/or token id. I set them in the message then in the action pipeline I go to signal the process instance and follow that up with seeing if the process instance has transitioned.

                      I am not seeing it transition. I will take a look at the processor code and see what I can find....

                      Jason

                      • 8. Re: jBPM and Continuing a Process Instance
                        Jason Lenhart Newbie

                        I can see that it is looking for a couple of tags - but when I set them, it is not signaling ...

                        09:38:18,466 ERROR [STDERR] java.lang.Exception: Either <jbpmTokenId> or <jbpmProcessInstId> object
                        must be specified in Message body to know who to signal
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.services.jbpm.actions.impl.DefaultCommandExecut
                        orFactoryImpl$8.execute(DefaultCommandExecutorFactoryImpl.java:270)
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.services.jbpm.actions.CommandInterpreter.proces
                        s(CommandInterpreter.java:78)
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.services.jbpm.actions.BpmProcessor.process(BpmP
                        rocessor.java:64)
                        09:38:18,466 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
                        09:38:18,466 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
                        ccessorImpl.java:25)
                        09:38:18,466 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.pro
                        cessMethods(ActionProcessorMethodInfo.java:102)
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProc
                        essor.process(OverriddenActionLifecycleProcessor.java:74)
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.proc
                        ess(ActionProcessingPipeline.java:262)
                        09:38:18,466 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(Me
                        ssageAwareListener.java:297)
                        09:38:18,466 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPool
                        Executor.java:650)
                        09:38:18,466 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec
                        utor.java:675)
                        09:38:18,466 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                        09:38:18,466 WARN [ActionProcessingPipeline] Unexpected exception caught while processing the actio
                        n pipeline
                        org.jboss.soa.esb.actions.ActionProcessingException: java.lang.Exception: Either <jbpmTokenId> or <j
                        bpmProcessInstId> object must be specified in Message body to know who to signal
                        
                        


                        • 9. Re: jBPM and Continuing a Process Instance
                          Jason Lenhart Newbie

                          Got it ... did not have a proper transition to my end state in my process definition.

                          DOH!