Reputation: 695
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?
Upvotes: 1
Views: 4663
Reputation: 59628
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;
Upvotes: 1