Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KeyPartitioner

Computes the partition number for a given message by hashing the key (using the super-simple FNV-1A algorithm) and modding by the number of partitions for the first stream found with the subject of the message. This does not work with streams containing wildcards in their subjects, e.g. "foo.*", since this matches on the subject literal of the published message. This also has undefined behavior if there are multiple streams for the given subject.

Hierarchy

Index

Constructors

constructor

Properties

Protected key

key: string

Protected metadata

metadata: IMetadata

Protected subject

subject: string

Methods

calculatePartition

  • calculatePartition(): number

Protected getPartitionCount

  • getPartitionCount(): number