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

Invalid Kafka Binary event when content-type not provided #370

Closed
shnplr opened this issue Apr 16, 2021 · 4 comments
Closed

Invalid Kafka Binary event when content-type not provided #370

shnplr opened this issue Apr 16, 2021 · 4 comments
Labels
question Further information is requested

Comments

@shnplr
Copy link
Contributor

shnplr commented Apr 16, 2021

The Kafka spec states in section 3: If the content-type header is not present then the receiver uses structured mode with the JSON event format.

Since the SDK allows a binary message with data to be generated without providing dataContentType, the assumption here is that consumers MUST assume this is a Structured event (even though its not).

Question

  1. Should the spec be amended to allow receivers to detect content mode whenever content-type does not start with application/cloudevents.
  2. Alternatively should the serialize SDK generate an error for Binary mode with data and no content-type?
@slinkydeveloper
Copy link
Member

If the content-type header is not present then the receiver uses structured mode with the JSON event format.

TBH I don't recall this particular sentence, but looking at it, it seems to me there are two conflicting sentences https://github.com/cloudevents/spec/blob/v1.0.1/kafka-protocol-binding.md#3-kafka-message-mapping:

The receiver of the event can distinguish between the two content modes by inspecting the content-type Header of the Kafka message. If the header is present and its value is prefixed with the CloudEvents media type application/cloudevents, indicating the use of a known event format, the receiver uses structured mode, otherwise it defaults to binary mode.

And then:

If the content-type header is not present then the receiver uses structured mode with the JSON event format.

I'm gonna open an issue in the spec repo

@slinkydeveloper slinkydeveloper added the question Further information is requested label Apr 19, 2021
@shnplr
Copy link
Contributor Author

shnplr commented Apr 19, 2021

I assume in the first paragraph, the key sentence is "If the header is present..."
But I agree the wording could be improved to avoid any suggested contradiction.

@slinkydeveloper
Copy link
Member

@shnplr I've opened an issue cloudevents/spec#812 and proposed 2 solutions, feel free to provide your input there.

@slinkydeveloper
Copy link
Member

The conflicting sentence was removed from the spec: slinkydeveloper/spec@c023f5c

I'm going to close this issue because I think it's solved now, reopen if you need it.

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

No branches or pull requests

2 participants