@SPI public interface ShardedWorkRegistry
|Modifier and Type||Method and Description|
Picks up the shard at a given index to process.
Clears up the recorded
java.util.Optional<ShardProcessingSession> pickUp(io.spine.server.delivery.ShardIndex index, io.spine.server.NodeId nodeId)
This action is intended to be exclusive, i.e. a single shard may be served by a single application node at a given moment of time.
In case of a successful operation, an instance of
is returned. The node obtained the session should perform the desired actions with the
sharded messages and then
complete the session.
In case the shard at a given index is already picked up by some node,
Optional.empty() is returned.
index- the index of the shard to pick up for processing
nodeId- the identifier of the node for which to pick the shard
Optional.empty()if the shard is not available
java.lang.Iterable<io.spine.server.delivery.ShardIndex> releaseExpiredSessions(com.google.protobuf.Duration inactivityPeriod)
NodeIds from the session records if there was no activity for longer than passed
It may be handy if an application node hangs or gets killed — so that it is not able to complete the session in a conventional way.
inactivityPeriod- the duration of the period after which the session is considered expired