Skip to content
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

Both kafka_franz and kafka inputs emit the kafka_key metadata as string, but bytes should be used instead #2954

Open
mihaitodor opened this issue Oct 24, 2024 · 0 comments
Labels
annoying Benthos is mildly annoying but not quite a bug bloblang Bloblang features kafka Issues relating to kafka

Comments

@mihaitodor
Copy link
Collaborator

mihaitodor commented Oct 24, 2024

Run either the kafka_franz or the kafka output to produce 2 messages. For the first one, set key: "" and for the second one, do not set this field.

Now, try running this config:

input:
  kafka:
    ...

output:
  stdout: {}
  processors:
    - mapping:
        root = metadata("kafka_key").format_json()

Note that for both messages the output is "" and I can't think of any way to distinguish between them. However, for the second message, we should output null instead.

As far as I can tell, we allow implicit conversion from bytes to string, so maybe we can just get rid of the string cast here and here since we now have structured metadata...

UPDATE: Another issue is that the key interpolation for the outputs can only produce strings, so we don't have a way right now to emit null instead of "" when using interpolation.

@mihaitodor mihaitodor added annoying Benthos is mildly annoying but not quite a bug bloblang Bloblang features kafka Issues relating to kafka labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annoying Benthos is mildly annoying but not quite a bug bloblang Bloblang features kafka Issues relating to kafka
Projects
None yet
Development

No branches or pull requests

1 participant