What is difference between createInstanceCommand and publishMessageCommand

I have strange problem with PublishMessageCommand,
when I create instance by PublishMessageCommand start event, I often get exception: RESOURCE_EXHAUSTED: Reached maximum capacity of requests handled

After changing to CreateProcessInstance, I stopped getting these errors.
WHY ?

I know that:

  • When a client sends a command CreateProcessInstance or CreateProcessInstanceWithResult, the gateway chooses a partition in a round-robin manner and forwards the requests to that partition. The process instance is created in that partition.

  • When a client publishes a message to trigger a message start event, the message is forwarded to a partition based on the correlation key of the message. The process instance is created on the same partition where the message is published.

Now in Grafana monitoring I see this picture:
Снимок

You answered your own question didn’t you?

With CreateProcessInstance, Assigned Partition is (ProcessID) % (Broker Count) so it moves around.
With MessageStart, Assigned Partition is (Correlation Key) % (Broker Count) so if your message doesn’t have a correlation key they will all be assigned to the same broker.
That results in the image you posted.

Thank you for quick reply.

Question1: What is ProcessId equal to ? Isn’t this ProcessInstanceId ?
CreateProcessInstaceCommand working in round-robin manner, as I understand it, there must be cases of errors when it puts into partition2, but I don’t have such cases.

Question2: Do I understand correctly, if use MessageStart all process instances will be put always in defined partition (for example partition2) ?

Question3: I also had a problem when publishing event messages with an correlationKey for an already created process instance, when, for example, catching a message in the middle of a process. I think this is because partition 2 always rejects requests, but I don’t understand why partition2 didn’t reject request before when created instances.

Screen from operate

part of processInstaceId is partition id, isn’t it ? And therefore I confused If I have problem only with one partition, all stuck process instances must have been in a specific partition, isn’t it ?

Apologies - I was using that in a conceptual sense not a hard-mathematical sense.
When you use the “CreateProcessInstance” command, it is distributed.
When you use the “Message” command, all process instances will end up on the same partition.
Exactly as you had noted. When the partition becomes completely consumed, it cannot perform other work.