7 Replies Latest reply on Oct 25, 2012 2:46 AM by herna

    jBPM 5: how to remove or change a completed task?

    herna

      let's see if you can give me a hand. Thanks in advance.

       

       

      I am developing a web application that manage invoices through a workflow with different states. I am using jBPM 5 for that purpose and the way I launch one specific invoice through workflow is next:

       

       

      getTaskService().activate(taskId, userId);

      getTaskService().claim(taskId, userId);

      getTaskService().start(taskId, userId);

      getTaskService().complete(taskId, userId, taskContentData);

      My problem is the fourth instruction and regards with transactionality. I have a utility class that performs operations once the invoice is processing through its workflow, and if this class throws and exception, the jBPM invoice task remains as 'Completed' when it shouldn't.

       

       

      My question is: how do I proceed in this situation? I want that 4 previous instructions go in only one transaction, or at least that task status doesn't change to 'Completed' if one exception arises, but this is controlled by jBPM and it doesn't seem easy. Should I try to change task status from 'Completed' to 'Created' again? Or make a new task with status 'Created'?

        • 1. Re: jBPM 5: how to remove or change a completed task?
          swiderski.maciej

          what is you environment setup? Do you embedd every component (jbpm core engine, human task service) into you web application or you use it as a service? What is important here is how you interact with human task service - remotely? If so you should make it as part of transaction by using JMS that can participate in transaction

           

          HTH

          • 2. Re: jBPM 5: how to remove or change a completed task?
            thomas.setiabudi

            Hi Maciej,

             

            In my case, we use every component  (jbpm core engine, human task service)  as a service, so we make use of the REST APIs provided by jbpm-console.  If this is the case, how do we implement transaction and do rollback?

             

             

            Regards,

            Thomas Setiabudi

            • 3. Re: jBPM 5: how to remove or change a completed task?
              swiderski.maciej

              in that case I think you could try to either configure task server to be accessed over JMS or make it local. Both ways are done via configuration of console server and human task war - for details take a look at documentation

               

              HTH

              • 4. Re: jBPM 5: how to remove or change a completed task?
                thomas.setiabudi

                ok Thank you Maciej,

                 

                Will give it a try

                 

                Regards,

                Thomas Setiabudi

                • 5. Re: jBPM 5: how to remove or change a completed task?
                  herna

                  Hello Maciej, thanks for your response.

                   

                  I have jbpm core embed in my web application and I am interacting with human task service remotely. My problem is basicaly about transactionality, I use Hibernate to manage transactions into my web application but I can't control the task service transactions because it's the up to task service to take care of it. So my problem is that I am not controlling the global transacionality, and if one exception is thrown in one of the operations I make over my invoice object, I can't tell task service not to commit the task (and not to change task from 'Created' to 'Completed' for example)

                   

                  So as you said to Thomas, I guess there are two options: keep using task service remotely with JMS and make it local. Is there any preferable option?

                   

                  I don't have experience with JMS and I remember I couldn't made it work as a local service in the past, based on the documentation examples. I am using jBPM 5.2 and don't know if there is any significantly improving in 5.3 version that can help me. Should I try to upgrade?

                   

                  I also took a quick look to exception handling but I don't know if this could help in this case. What do you think?

                   

                   

                  Thank you very much.

                  • 6. Re: jBPM 5: how to remove or change a completed task?
                    swiderski.maciej

                    What is more preferable depends on your requirements. If task service needs to be available to other clients (not only your web application) then the best is to rely on JMS as a transport that could be part of transaction, meaning message will be sent to task service only when transaction will be committed. But if your web application is the only one that makes use of task service I would recommend to use local task service.

                     

                    Regarding upgrades, we are close to release 5.4 which provides much better support in this area so I think it's worth to wait little bit more for 5.4, of course you can already give a try with beta1

                     

                    HTH

                    1 of 1 people found this helpful
                    • 7. Re: jBPM 5: how to remove or change a completed task?
                      herna

                      Thanks a lot for your help. I will try to configure like a local service and wait for 5.4 version.

                       

                       

                      Bye.