5 Replies Latest reply on Sep 7, 2011 1:20 PM by antoniodb83

    Incorrect Gateway diverge and converge operations in jBPM 5

    khalipili

      I am using below sample flow in my test. it contains three human task. once the process process is started it execute successfully till human task creation. As the first gateway diverge is of type "AND" it creates two task as shown below. I can view these task in jbpm-console. now once i login as user "Shashi" and complete the first task, As the next gateway converge is of type "XOR", the flow proceeds further and create the next task for user "Shashi".

       

      As process have proceed further till gateway converge, jbpm should have remove the task for user "kris". but jbpm still shows the task for user "kris".

      this seems to be a error in jbpm process execution.

       

      next once user "shashi" completes the human task, process execution completes but throws below error. it seems that human task handler tries to abort the "kris" task which should have be aborted prior (at gateway converge).

       

      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      java.lang.IllegalArgumentException: attempt to create merge event with null entity

                at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:60)

                at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:43)

                at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:688)

                at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:692)

                at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:235)

                at org.drools.persistence.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:124)

                at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:56)

                at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:29)

                at org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:274)

                at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.abortWorkItem(CommandBasedStatefulKnowledgeSession.java:149)

                at com.sample.util.CommandBasedWSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(CommandBasedWSHumanTaskHandler.java:257)

                at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:81)

                at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)

                at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

                at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)

                at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)

                at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)

                at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)

                at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)

                at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:662)

      [2011:01:19 17:01:78:exception] Uncaught exception on client

       

      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      .Sample-ProcessFlow.png

        • 1. Incorrect Gateway diverge and converge operations in jBPM 5
          salaboy21

          Hi there.. for me sounds like the good behavior. The XOR gateway will not abort a human task. Sometimes the human tasks are not required to be completed and the only thing that will abort a task will be the entire process completion.

          Is it necesary for your requirement that the other human task be aborted at the XOR gateway? can you share that case?

          Greetings.

          • 2. Incorrect Gateway diverge and converge operations in jBPM 5
            khalipili

            Hello Mauricio.. This is not a correct behavior for process execution. consider below simple example which will fail in this case. there is a process where one user is ordering a book from different libraries. in above case it will be our human task. Our order process will create task for different libraries to provide information as whether book is available or not. As we want any one of the library to respond so that we can continue with our process and borrow the book. once we get the response from one library, task created for other library should have been aborted once the process reaches to converge node.

             

            as process executor never abort the task at the gateway node converge, other task will be still available for second library which may respond at later stage where user might be waiting to order book from first library.. this is incorrect.

            • 3. Incorrect Gateway diverge and converge operations in jBPM 5
              salaboy21

              I think that there is no wrong and right process executions. jBPM5 provides you the flexibility for situation like the one you mention and also for more wider situations where you don't want that all the activities created by the process needs to be ended when a gateway is reached.

              If I need to model the situation that you mention I should create a sub process that contains only the gateways and the User Tasks. When the sub process ends (with just one completed activity) the parent process can continue knowing that there are no more active tasks pending.

              You can also create an script task to abort manually all the pending tasks after the XOR converging gateway.

              Greetings.

              • 4. Incorrect Gateway diverge and converge operations in jBPM 5
                krisverlaenen

                Mauricio is correct in stating that this is however the expected behavior of an coverging exclusive gateway.  I suggest you look up the semantics of this type of gateway in the BPMN2 specification.

                 

                What you are describing (aborting the other alternatives once one alternative reaches the converging gateway) is a much more complex type of gateway.  This is also knows as a deferred choice, where the decision which of the alternatives you execute is deferred until one of them returns with results.  I suggest you take a look at the event-based gateway, as this exhibits this kind of behavior (it will wait for different signals until one arrives) and can be used to model what you are describing.

                 

                Kris

                • 5. Re: Incorrect Gateway diverge and converge operations in jBPM 5
                  antoniodb83

                  Hi, do you think that a construct like this can be a valid kind of implementation for a "deferred choice" gateway?

                  processus.png

                   

                  Regards,

                  Antonio