Hi,

I have an operator, which is running in 3 instances I.e partions… And, I want 
all the records with same key, here my key is "String" type, to be transferred 
to same instance/partition.

But, I am unable to achieve this with my below codec.



import com.datatorrent.lib.codec.KryoSerializableStreamCodec;

public class MyCodec extends KryoSerializableStreamCodec<String> {

    @Override
    public int getPartition(String tuple) {

        String[] toSplit = tuple.split("\\^");
        String exId = toSplit[1];

        return exId.hashCode();

    }

}


Any guidance please…


Thanks a lot.


Regards,
Raja.

Reply via email to