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

Kafka event without headers #1113

Open
cavus700 opened this issue Jan 3, 2025 · 0 comments
Open

Kafka event without headers #1113

cavus700 opened this issue Jan 3, 2025 · 0 comments

Comments

@cavus700
Copy link

cavus700 commented Jan 3, 2025

Hello,
I am not sure if this is an actual bug or if I miss something in the SDK but in my understanding this should work.

I am receiving a cloud event without any headers from a kafka instance:

------------------ Message -------------------

Topic Name: mytopic

------------------- key ----------------------

Key: mykey

------------------ headers -------------------

------------------- value --------------------

{
    "specversion" : "1.0",
    "type" : "com.example.someevent",
    "source" : "/mycontext/subcontext",
    "id" : "1234-1234-1234",
    "time" : "2018-04-05T03:56:24Z",
    "datacontenttype" : "application/json",
    "data" : {
        ... application data encoded in JSON ...
    }
}

-----------------------------------------------

The problem is that the SDK does not set a format for this message because the format is extracted from the headers here:
https://github.com/cloudevents/sdk-go/blob/main/protocol/kafka_sarama/v2/message.go#L47

This causes an error in the ToEvent() function here:
https://github.com/cloudevents/sdk-go/blob/main/v2/binding/to_event.go#L32

Is there a way to successfully parse an event like this or is this a bug in the SDK? The spec does not require a content-type header for structured events as I can see.

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

No branches or pull requests

1 participant