Flink custom partitioner example
<p>The use case that I am trying to tackle is as follows:</p>

<ul>
<li>We have a data stream flowing in from Kafka</li>
<li>We would like to guarantee that message/records containing the same value for a particular entity gets processed by the same operator. </li>
<li>We would like to maintain state on this Operator so that we are able to enrich future messages. </li>
</ul>

<p>So for example :</p>

<ul>
<li>Lets assume that all messages are byte arrays having representing encoded data.</li>
<li>All messages which have a particular value within the encoded data should be processed by a single operator.</li>
<li>This is so that when we receive certain special messages that also correspond to the same value these can be stored as state on the Operator (after the partitioner) and can be used to enrich subsequent messages.</li>
</ul>

<p>Questions:</p>

<ol>
<li>Will a custom partitioner help with this? </li>
<li>If not what would be a good solution for this? </li>
<li>Can someone share an example of a Custom partitioner in Flink for a Datastream. I was not able to find any complete examples.</li>
</ol>