holunda-io / camunda-bpm-taskpool

Library for pooling user tasks and process related business objects.
https://www.holunda.io/camunda-bpm-taskpool/
Apache License 2.0
68 stars 26 forks source link

Provide Task payload as plane Map instead of camunda VariableMap #844

Open mmiikkkkaa opened 1 year ago

mmiikkkkaa commented 1 year ago

Scenario

Within an application, that uses camunda (of course with best-practice lib camunda-bpm-data to store process variables) and polyflow, one can query tasks via polyflow's TaskQueryClient. These queries return a TaskQueryResult, which again contains a io.holunda.polyflow.view.Task. This task provides the process variables as payload within a camunda VariableMap. If I used camunda-bpm-data's VariableWriter to write process variables, and polyflow handles the exact same data structure, which the VariableReader is normally able to read, than as developer I'm tempted to use reader, to retrieve the values again from the variable map.

Current Behaviour

Depending on the type of process variable (in this case all non-string data types), the VariableReader throws a WrongVariableTypeException, since the type information are no longer stored in the VariableMap, but everything was serialized to plain string json object. Deserializing it to the desired data types is no longer possible.

Wanted Behaviour

Since it is totally comprehensible, that the values are serialized into a plain json string, the fact, that the task object returns the payload as VariableMap confuses into thinking it should work. Therefore, the Payload should better be returned as play Map<String, Object> data type, to take that confusion away.

Possible Workarounds

Since a VariableMap is a Map<String, Object>, one can handle it the same way, but one need to know, that one cannot use the VariableReader, but to convert all values manually.

zambrovski commented 1 year ago

You are absolutely correct with your observation, but the change is breaking (breaks existing contract of the View API).