title: How to create a generic deserializer for bytes in Kafka?
body: <p>I have a proto file with multiple message types. I want to create a generic deserializer for these messages. </p>
  
  <p>Do I need to send these message's types with Kafka message header so Consumer can deserialize these messages with this type information? Is this a best practice or is there any other solution?</p>
  
  <p>deserialize method example;</p>
  
  <pre><code>public Object deserialize(String topic, Headers headers, byte[] data) {
      if(headers[0].equals("Person")){
          return Person.parseFrom(data);
      } else if....
  }
  </code></pre>
  
  <p>my proto file;</p>
  
  <pre><code>message Person {
      uint64 number = 1;
      string name = 2;
  }
  
  message Event {
      string msg = 1;
      code = 2;
  }
  
  message Data {
      string inf = 1;
      string desc = 2;
  }
  
  ....
  </code></pre>