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

feat: provide support for Kafka message keys different than "string?" #314

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Abuntxa
Copy link

@Abuntxa Abuntxa commented Sep 26, 2024

This pull request implements support for Kafka Message key types other than "string?".

Implements cloudevents#313

Signed-off-by: Jon Abaunza <j.abaunza@lantek.com>
Copy link
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments to streamline changes later, but I won't have time to review the actual code until next week.

…reaking change

Signed-off-by: Jon Abaunza <j.abaunza@lantek.com>
@jskeet
Copy link
Contributor

jskeet commented Oct 1, 2024

(Just to keep communicating - this is still on my plate, but keeps being bumped by higher priority things. I promise I'll get to it eventually...)

@Abuntxa
Copy link
Author

Abuntxa commented Oct 8, 2024

I tried 2 different approaches for my same problem:

  • Consume external dapr generated messages natively. This was considered first, as we already were consuming other non cloud event messages from kafka and didn't ourselves use dapr. It required this PR to succeed in order to be able to complete it.
  • Use dapr too for consuming these external dapr generated messages.

The cloud event had extended properties with the tenant information and due to a lack of proper examples I thought it would not be possible to get a hold of that tenant information using Dapr (all examples seemed to handle the payload of the cloud event and not the whole cloud event).

I turns out that by not using the middleware added with ".UseCloudEvents()" and parsing the cloud event directly using the extension methods provided in this repository did the trick.

Therefore, the Pull request won't be necessary from my part, although I think that other people could find it interesting (specially for binary key support).

Some notes regarding the dapr implementation
During the development I missed a proper parameter binding implementation that would allow binding CloudEvents to controller method parameters. A generic CloudEvent< T > where the T would be the expected payload for deserialization could have made the trick. This would make the development easy while giving full access to the cloud envelope for accessing the custom properties.

@jskeet
Copy link
Contributor

jskeet commented Oct 9, 2024

Thanks so much for the update - that's really good to know. I was hoping to review this in the next couple of days, but I was getting queasy about it, knowing how little I know about Kafka.

I suggest we just leave the PR open for a little while, and see whether it attracts any attention from other users. Does that work for you?

@Abuntxa
Copy link
Author

Abuntxa commented Oct 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants