1

I have a node-red flow that pulls the data from MQTT and publish the data to Kafka topic. Currently, my MQTT publisher publishes data in the encoded msg pack format. When it comes to the MQTT subscriber, payload is converted into String Array by default as following.

[148,147,2,205,3,102,101,205,103,151,205,103,151,146,207,0,0,2,97,44,233,203,23,145,146,2,202,62,164,20,119,0]

Is there a way to deserialize the following string array to byte array and publish to Kafka topic?

1 Answer 1

1

You should be able to feed that string through the JSON node to get a JSON array of numbers that you can use a function node to parse to a buffer with something like this:

msg.payload = Buffer.from(msg.payload);
return msg;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.