I have a few Samza jobs running all reading messages off of a Kafka topic and writing a new message to a new topic. To send the new messages, I am using Samza's built in OutgoingMessageEnvelope. Also using a MessageCollector to send out the new message. It looks something like this:
collector.send(new OutgoingMessageEnvelope(SystemStream, newMessage))
Is there a way I can use this to add partitions to the Kafka topic? Such as partitioning on a user ID or something like that.
Or if there is a better way I would love to hear it!
You should be able to send messages using a partitioning key,
Using this method will partition your data. However I think if you are looking at controlling the number of partitions programmatically, you should use the kafka API to create/alter the topic as mentioned here