gen_stage v0.4.0 Experimental.GenStage.PartitionDispatcher

A dispatcher that sends events according to partitions.

Keep in mind that, if partitions are not evenly distributed, a backed-up partition will slow all other ones.

Options

The partition dispatcher accepts the following options on initialization:

  • :partitions - a required option that sets the number of partitions we will dispatch to

  • :hash - the hashing algorithm, defaults to :erlang.phash2/2 which receives the message and the number of partitions and it must return a number between 0 and number_of_partitions - 1