The filter works by setting the shard ID in the event using the
setShardId() method on the event object:

event.setShardId(event.getSeqno() % shards);

Note

Care should be taken with this filter, as it assumes that the events can
be applied in a completely random order by blindly updating the shard ID
to a computed valued. Sharding in this way is best used when
provisioning new slaves.