bpot / poseidon

A client for Kafka 0.8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Message#value seems to be escaped

krisleech opened this issue · comments

I publish, using kafka-console-producer, escaped JSON such as {\"name\":\"kris\",\"color\":\"blue\"}.

When I receive it using Poseidon I get "{\\\"name\\\":\\\"kris\\\",\\\"color\\\":\\\"blue\\\"}", which is doubly escaped.

Using ``kafka-console-consumer` I get the message as published.

Is this expected?

However if I publish with Poseidon, producer.send_messages([Poseidon::MessageToSend.new("test_topic", "{\"name\":\"kris\",\"color\":\"blue\"}")]).

I get the expect result consuming with Poseidon, but the an unescaped result in kafka-console-consumer, {"name":"kris","color":"blue"}..

@krisleech provide to the consoleproducer a json object not a strigified version

@mensfeld Thanks for responding 😄

How do I give a JSON object to kafka-console-producer it only accepts string input on the command line... Do you mean to give it unescaped JSON such as {"name":"kris","color":"blue"}?

@krisleech anytime - yeah you can try providing unescaped JSON as it seems (didn't look into the source but based on the behaviour) that it is doing to_json on your 'to_jsoned' already object

@krisleech if it is working, please close this issue (I can't)