"Update payload" is not working?


#1

Hi. I’m trying to update payload with newUpdatePayloadCommand + workflowInstanceKey, but looks like it’s not working.


#2

Hi @slava.aleferov,

can you please provide more information to reproduce the issue?

Note that you need to set the key of the element instance you want to update. For example, the key of the workflow instance record which belongs to an intermediate catch event.

Why do you want to update the payload?

Best regards,
Philipp


#3

I’m trying do this:

WorkflowInstanceEvent event = client.workflowClient()
            .newCreateInstanceCommand()
            .bpmnProcessId(processName)
            .latestVersion()
            .payload(context)
            .send()
            .join();
    
    context.setProcessId(event.getWorkflowInstanceKey());
    
    client.workflowClient()
            .newUpdatePayloadCommand(event.getWorkflowInstanceKey())
            .payload(context)
            .send()
            .join();

And it’s not working.
I tried to keep in the payload all the information necessary for the process and moreover, I tried to exchange this information between other processes as part of the execution of the current process.
But now I understand that I am trying to use Zeebe in the same way as other BPMN engines, I am trying to build a process logic based on the interaction of several process instances, which makes work with Zeebe very difficult. I have to constantly think about the context of which process I’m in. Instead, it is likely that each process must be made completely isolated and self-sufficient. After all, the Zeebe task is microservice orchestration and not work with task instances like other engines. Now I plan to use the database to store the data I need and use Zeebe for only orhestration


#4

I really like your conclusions:

and

BTW: a job worker can access some context information of a job (e.g. workflow instance key, element instance key, etc.). This information are available in the job header.


#5

I see. For what, for example, I need to use information of a job? I think i don’t must use this in my logic because it’s more system information (not buisness) or I’m wrong?


#6

No, you’re right. Usually, you don’t need this context information of a job.


#7

Ok. Thank’s. I think i understood