Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bloblang interpolation with custom binary plugin #2440

Closed
Arenash13 opened this issue Mar 25, 2024 · 2 comments
Closed

Bloblang interpolation with custom binary plugin #2440

Arenash13 opened this issue Mar 25, 2024 · 2 comments

Comments

@Arenash13
Copy link

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

output:
  kafka:
    addresses: [ "TODO:6379" ]
    topic: 'dope-${! json("topic") }'

The only difference is that these are binary payloads where I search for specific bytes to determine the route.
I started to write a bloblang plugin but I'm not sure if it works out of the box and if I have to do anything to keep the original payload "untouched".

Is there a specific example I can rely on with similar constraints ?

Thanks in advance

@mihaitodor
Copy link
Collaborator

Hey @Arenash13

I started to write a bloblang plugin but I'm not sure if it works out of the box and if I have to do anything to keep the original payload "untouched".

You can simply return the original message similar to the noop processor. See here.

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 content() function and then you can use something like the encode() method to get a string representation or slice() to get byte chunks or individual bytes.

@mihaitodor
Copy link
Collaborator

PS: Converting to a discussion as per #2026.

@redpanda-data redpanda-data locked and limited conversation to collaborators Mar 25, 2024
@mihaitodor mihaitodor converted this issue into discussion #2441 Mar 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants