Reputation: 119
I am using camunda 8 and refering below link for getting task from processinstance id https://github.com/camunda-community-hub/camunda-tasklist-client-java
I have added the dependency mentioned in link. My simpleauthentication is also done. Camundatasklistclient object is also initialised. But when running below step it shows error : impleAuthentication sa = new SimpleAuthentication("demo", "demo");
//shouldReturnVariables will change the default behaviour for the client to query variables along with tasks.
CamundaTaskListClient client = new CamundaTaskListClient.Builder().taskListUrl("http://localhost:8081").shouldReturnVariables().authentication(sa).build();
//get tasks from a process instance (TaskSearch can take many more parameters)
TaskSearch ts = new TaskSearch().setProcessInstanceId("2251799818839086");
TaskList tasksFromInstance = client.getTasks(ts); // this statement gives error at runtime
Error : io.camunda.tasklist.exception.TaskListException:Error(message=Validation error of type wrongtype argument query with value 'ObjectValue{objectfields{objectfields=candidategroup, assignee, assigned,state,processDefinitionId,processInstanceId,pagesize,search after,search before,contains a filed not in Taskquery : processDefinitionId @ tasks
How to resolve this error ?
Upvotes: 0
Views: 1570
Reputation: 17
The Camunda 8 Tasklist client API seems to be encountering issues without a viable resolution from the Camunda team. In lieu of a functional fix, the suggested approach is to manually obtain a token using HTTP, followed by retrieving a session ID, and consequently employing the REST API for desired operations. This alternate method involves obtaining authentication through token-based processes and utilizing the REST API to facilitate the required functionalities.
Upvotes: -1
Reputation: 7583
Have you checked if the versions of the client library and the servers side API match? It looks like the client lib is including processDefinitionId, but the the Taskquery API does not contain it.
Version 8.1 an 8.2 contains processDefinitionId:
input TaskQuery {
state: TaskState
assigned: Boolean
assignee: String
candidateGroup: String
candidateUser: String
processDefinitionId: String
processInstanceId: String
followUpDate: DateFilter
dueDate: DateFilter
pageSize: Int
taskDefinitionId: String
searchAfter: [String!]
searchAfterOrEqual: [String!]
searchBefore: [String!]
searchBeforeOrEqual: [String!]
sort: [TaskOrderBy]
}
https://docs.camunda.io/docs/apis-tools/tasklist-api/inputs/task-query/
Version 8.0 does not contain it:
type TaskQuery {
state: TaskState
assigned: Boolean
assignee: String
candidateGroup: String
pageSize: Int
taskDefinitionId: String
searchAfter: [String!]
searchAfterOrEqual: [String!]
searchBefore: [String!]
searchBeforeOrEqual: [String!]
}
https://docs.camunda.io/docs/8.0/apis-tools/tasklist-api/inputs/task-query/
=> Upgrade your server side and try again
Upvotes: 0