Have you tried implementing a KeyedDeserializationSchema?

This receives both the message and key as byte arrays, which you could then
deserialize as strings and return them in a Tuple2<String, String>.

On 13.06.2017 12:36, AndreaKinn wrote:
Hi,
I already spent two days trying to get simple messages from Kafka without
success.

I have a Kafka producer written in javascript:

KeyedMessage = kafka.KeyedMessage;
keyed_message = new KeyedMessage(key, string_to_sent);
payload = [{topics: topic, messages: keyed_message }];

And I want to retrieve key and message in Flink. Firstly I have used
SimpleStringSchema (just to verify if string was correctly deserialized) and
works correctly ignoring the key.
Now I absolutely need to get also the key to group messages on key basis but
I don't find any keyed deserializer which help me. If I understand
TypeSchema is used just for flink_to_flink communication and JSONSchema
obviously doesn't fit my needs.



--
View this message in context: 
http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Can-t-get-keyed-messages-from-Kafka-tp13687.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at 
Nabble.com.


Reply via email to