6 Replies Latest reply on Jun 24, 2014 8:55 AM by lauradp

    Jbpm Executors for handling long running tasks

    lauradp

      Hello everybody,

      I'm trying to handle a long running task in a jbpm6 process.

       

      I read about jbpm executor (http://docs.jboss.org/jbpm/v6.0.1/userguide/jBPMAsyncExecution.html#d0e16507).

      Are them suitable form my needs (I need to wait for task to complete before running next task in the process)? How should I use them?

       

      Laura

        • 1. Re: Jbpm Executors for handling long running tasks
          swiderski.maciej

          it certainly is suitable for long running asynchronous tasks, see this article for more details.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: Jbpm Executors for handling long running tasks
            lauradp

            Thanks for your answer Maciej.

            So I can't use it for handling task B in a process like A -> B -> C if task C needs results of task B to be executed, isn't it?

             

            Laura

            • 3. Re: Jbpm Executors for handling long running tasks
              swiderski.maciej

              of course you can, it will not signal the process to move forward unless task has been completed by the executor. It's just it will not keep the process instance and transaction locked while the task is being executed. It will get hold of process instance when task is completed and signal it to move to the next task.

               

              HTH

              • 4. Re: Jbpm Executors for handling long running tasks
                lauradp

                Thanks, Maciej.

                 

                Now I have to code a WorkitemHandler that for my command. Cann you provide any example (or explain how to register commands)?

                • 5. Re: Jbpm Executors for handling long running tasks
                  swiderski.maciej

                  an example is in that article, commands are configured on as data input of an async task - dedicated work item handler. Take a look at async-examples of jbpm-playground repo where you find couple of samples on how they can be used.

                   

                  HTH

                  • 6. Re: Jbpm Executors for handling long running tasks
                    lauradp

                    Hi,

                    I tryed to use async task with a this Command:

                     

                    public class CommandLineCommand implements Command {

                      private static Logger trace = Logger.getLogger(CommandLineCommand.class);

                     

                     

                      @Override

                      public ExecutionResults execute(CommandContext arg0) throws Exception {

                      trace.info("I'm doing stuffs");

                      ExecutionResults results = new ExecutionResults();

                      results.setData("RunTaskExitValue", 0);

                      return results;

                      }

                    }

                     

                    but RunTaskExitValue is not set.

                     

                    UPDATE. It looks like a class clast problem: java.lang.String cannot be cast to java.lang.Integer.

                     

                    this is async wid:

                      [

                        "name" : "async",

                        "parameters" : [

                             "CommandClass" : new StringDataType()

                        ],

                        "results" : [

                            "RunTaskExitValue" : new IntegerDataType()

                        ],

                        "displayName" : "async",

                        "icon" : "defaultservicenodeicon.png"

                      ]

                     

                    Laura