title: Async Tasks in jBPM with Custom Work Item Handlers
body: <p>I'm having some issues with making async jBPM custom tasks within my bpm process. My custom task relies on my CustomTaskHandler class that looks something like this</p>
  <pre><code>@RequiredArgsConstructor
  @Component(&quot;CustomSpringTask&quot;)
  public class CustomTaskHandler implements WorkItemHandler {
  
      private final RuntimeDataServiceBase runtimeDataServiceBase;
  
      private final MeterRegistry meterRegistry;
  
      public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
          //new Thread(() -&gt; executeLogic(workItem, manager)).start();
          executeLogic(workItem, manager);
      }
  
      public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
          manager.abortWorkItem(workItem.getId());
      }
  }
  </code></pre>
  <p>SN: I clearly tried the Thread path but it's not a solution I can use in my use case</p>
  <p>This works perfectly fine when using normal non-async tasks. However when making a task async, the application logs this line before calling the <code>executeWorkItem</code></p>
  <blockquote>
  <p>2021-07-28 12:27:44,641 [WARN ]
  org.jbpm.workflow.instance.node.AsyncEventNodeInstance       - No
  async executor service found continuing as sync operation...</p>
  </blockquote>
  <p>This is probably due to the fact that I never created an Executor service. I've opened the default  <code>AsyncWorkItemHandler</code> that uses the <code>ExecutorService</code> class to schedule the command execution.</p>
  <p>So I have 2 doubts:</p>
  <ol>
  <li>Should I extend the AsyncWorkItemHandler (although I'm concerned on the customizability of the class if I extend it)</li>
  <li>Should I simply replicate the code within it and add the custom parts</li>
  </ol>
  <p>On the second point then I may ask what is the CommandClass that is required by the ExecutorService, and where to instantiate this ExecutorService and on which class it depends.</p>
  <p>I found little to no documentation about it on internet. If anyone could point me out to a plausible solution or documentation that would be great</p>
  <p>Right now my project is using this setup:</p>
  <ul>
  <li>Spring Boot</li>
  <li>7.52.0 Kie-Server</li>
  </ul>