Class CommandDistributionBehavior
java.lang.Object
io.camunda.zeebe.engine.processing.distribution.CommandDistributionBehavior
The network communication between the partitions is unreliable. To allow communication between
partitions in a reliable way, we've built command distribution: a way for partitions to send,
receive, and acknowledge (or retry sending) commands between partitions.
This behavior allows distributing a command to other partitions, and for those receiving partitions to acknowledge the distributed commands back to the partition that started.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interface -
Constructor Summary
ConstructorsConstructorDescriptionCommandDistributionBehavior(DistributionState distributionState, Writers writers, int currentPartition, RoutingInfo routingInfo, InterPartitionCommandSender partitionCommandSender) -
Method Summary
Modifier and TypeMethodDescription<T extends UnifiedRecordValue>
voidacknowledgeCommand(TypedRecord<T> command) Acknowledges that a command was distributed to another partition successfully.withKey(long distributionKey) Starts a new command distribution request.
-
Constructor Details
-
CommandDistributionBehavior
public CommandDistributionBehavior(DistributionState distributionState, Writers writers, int currentPartition, RoutingInfo routingInfo, InterPartitionCommandSender partitionCommandSender)
-
-
Method Details
-
withKey
Starts a new command distribution request.- Parameters:
distributionKey- the key to identify this unique command distribution. The key is used to store the pending distribution, as the key of distributed command, to identify the distributing partition when processing the distributed command, and as the key to correlate the ACKNOWLEDGE command to the pending distribution. This can be a newly generated key, or the key identifying the entity that's being distributed. Please note that it must be unique for command distribution. Don't reuse the key to distribute another command. Don't reuse the key to distribute another command until the previous command distribution has been completed. Additionally, the key determines the order in which the commands are distributed if they are distributed ordered, i.e. a queue is specified.
-
acknowledgeCommand
Acknowledges that a command was distributed to another partition successfully.- Parameters:
command- the command that was distributed
-