JBoss Community

Re: How to list human tasks with HQ API?

created by Alex Wulms in jBPM - View the full discussion

Hi,

 

I have found a solution. Apparently I must specify a human task client (session) id to the constructor of the AsyncHronetQTaskClient class. It works fine with following code:

public static void main(String args[])
{
  String user="krisv";
  String language="en-UK";
  List<Status> status = Arrays.asList(new Status[] { Status.Reserved });
 
  String clientSessionID = UUID.randomUUID().toString();
  System.out.println("*** Connecting to human task service with HornetQ protocol, using client session ID: " + clientSessionID);
  SyncTaskServiceWrapper tk = new SyncTaskServiceWrapper(new AsyncHornetQTaskClient(clientSessionID));
  tk.connect("127.0.0.1", 5445);
 
  System.out.println("*** Getting " + status + " tasks for " + user + " with language " + language);
  List<TaskSummary> tasks = tk.getTasksAssignedAsPotentialOwnerByStatus(user, status, language);
 
  System.out.println("*** Got " + tasks.size() + " tasks");
 
  System.out.println("*** Closing connection");
  try {
   tk.disconnect();
  } catch (Exception e) {
   System.out.println("*** Error during disconnect: " + e.getMessage());
  }
  System.exit(0);
}

 

Thanks and kind regards,

Alex

 

PS: I found the solution thanks to the jbpm-examples module, in which the human task example also specifies a (hard-coded) client-session-id to the constructor.

 



Reply to this message by going to Community

Start a new discussion in jBPM at Community