Skip to content

Instantly share code, notes, and snippets.

@Jayasagar
Last active July 7, 2017 04:44
Show Gist options
  • Save Jayasagar/1394dd4aa92f04627fb60b3996bf1411 to your computer and use it in GitHub Desktop.
Save Jayasagar/1394dd4aa92f04627fb60b3996bf1411 to your computer and use it in GitHub Desktop.
Akka Stream Create Partition
Graph<UniformFanOutShape<EventMessage, EventMessage>, NotUsed> eventTypePartition = Partition.create(3,
(Function<EventMessage, Object>) tuple -> {
switch (tuple.message) {
case "EVENT_TYPE_1":
return 1;
case "EVENT_TYPE_2":
return 2;
default:
return 0;
}
});
@Jayasagar
Copy link
Author

This is a 3 partition example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment