tree: 15fe23de5e20b2858447db0341ddb0f6c787369c [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.md
examples/partition/README.md

This example shows how to define custom partitions and a custom StreamCodec to customize the set of tuples that reach each partition.

There are two operators: RandomNumberGenerator (generates random integers) and TestPartition (logs input tuples).

The application also uses a StreamCodec called Codec3 to tag each tuple with a partition tag based on whether the number is divisible by 2 or 4.

TestPartition has code to create 3 partitions: one gets odd numbers, one gets multiples of 4 and the last gets the rest. The PartitionKeys associated with each partition use the partition tag to select the set of tuples to be handled by that partition.