Bloblang interpolation with custom binary plugin #2441
-
Hello, I have a case where I need to assign messages to a specific Kafka topic in the same style as https://www.benthos.dev/docs/configuration/interpolation#bloblang-queries
The only difference is that these are binary payloads where I search for specific bytes to determine the route. Is there a specific example I can rely on with similar constraints ? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @Arenash13
You can simply return the original message similar to the However, depending on the binary format, bloblang should have the required utilities you'd need to do basic binary parsing and comparisons. Have a look at the PS: Converted this to a discussion as per #2026. |
Beta Was this translation helpful? Give feedback.
Sure! You can set it in the metadata (if you don't want to modify or overwrite the message). See here: https://pkg.go.dev/github.com/benthosdev/benthos/[email protected]/public/service#Message.MetaSetMut Then you can access it in the config using the
metadata()
function or the@
operator (see here). Note that themeta()
function is still available, but it always returns strings instead of whatever type the original value had.