How to List Tasks with the jBPM Human Task API

import static java.lang.System.out;

import org.drools.SystemEventListenerFactory;
import org.jbpm.task.query.TaskSummary;
import org.jbpm.task.service.TaskClient;
import org.jbpm.task.service.mina.MinaTaskClientConnector;
import org.jbpm.task.service.mina.MinaTaskClientHandler;
import org.jbpm.task.service.responsehandlers.BlockingTaskSummaryResponseHandler;

public final class JbpmSample {

  public static void main(final String[] args) throws Exception {
    final TaskClient client = new TaskClient(new MinaTaskClientConnector("SampleClient", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));

    if (client.connect("localhost", 9123)) {
      final BlockingTaskSummaryResponseHandler handler = new BlockingTaskSummaryResponseHandler();

      client.getTasksAssignedAsPotentialOwner("userId", null, handler); // or another getTasksXXX method

      for (final TaskSummary task : handler.getResults())
        out.println(task.getId() + "," + task.getStatus());




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.