How to keep subscribing to the topic without actually specifying the lockDuration

Hi @jgigliotti,
Sorry i was travelling and couldn’t reply on time. Yeah, so i shouldnt be doing that from a service task, you are right. I am using an external task now, but I have a problem here while updating variables. I am having an Object which has String as and Object as value. Now when i am trying to modify properties of this object and trying to set it as process variable. I am facing some issue.

ProcessVariable: mapOfEvents
Value: {“Tailings-Failure_Prediction”:{“isHysteresis”:false,“setCondition”:false,“time”:“2020-05-27T11:30:05.204+05:30”}}

In my external task i am getting this process variable and i am trying to add additional field: after modification this is what it is:
{“Tailings-Failure_Prediction”:{“isHysteresis”:false,“setCondition”:false,“time”:“2020-05-27T11:30:05.204+05:30”, “role”:“key”}}

Consider this is the format:

   JSONObject allStoredEvents =new JSONObject();
    allStoredEvents.put("lol", "lol");
    JSONObject newData= new JSONObject();
    newData.put("kyu", allStoredEvents);

Now when i am trying to update the process Variable, using externalService.complete(external, Collections.singletonMap(“mapOfEvents”, allStoredEvents));

When i am doing this, and when i check for the processvariable inside the cockpit, the format of the process variable has been changed from org.json.simple.JSONObject to
org.json.simple.JSONObject<java.lang.Object,java.lang.Object>.

When i click on the deserialize tab in cockpit, I am getting following error:
Deserialization Error: Cannot deserialize object in variable 'mapOfEvents': SPIN/JACKSON-JSON-01007 Cannot construct java type from string 'org.json.simple.JSONObject<java.lang.Object,java.lang.Object>'