Hello,

I am following this group from quite some time. Recently i tried sending my
customized object from producer instead of String.

I was successful in that by providing a way to serialize my object and
creating Message object like this:

Object event = <some object>;
Message message = new Message(TestUtils.getBytes(event))
producer.send(new ProducerData<Integer, Message>(topic, message));

TestUtils.getBytes just uses ObjectOutputStream to give a byte array.

while i was succesful in sending the object, but i could not retrieve it at
consumer end since kafka.message.Message doesnt carry any information about
underlying object(or maybe its always assuming it to be String).

My questions are:
1) Is it possible to send any other object then String?
2) If yes, then Can my approach be rectified? Or am i missing anything?

Thanks,
Navneet Sharma

Reply via email to