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

How to determine binary CE vs random non-CE message #577

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

duglin
Copy link
Collaborator

@duglin duglin commented Mar 1, 2020

Add some guidance for how to determine when an incoming message is a binary
CE vs some random non-CE message. The same receiver might accept CE and non-CE
messages so we should have an interoperable way for them to know what they're
getting.

If people are ok with this general direction then I can make the same change to the other transport specs.

Signed-off-by: Doug Davis dug@us.ibm.com

message can be a challenge. While this specification can not mandate that
senders do not include any of the CloudEvents HTTP headers when the message
is not a CloudEvent, it would be a reasonable for a receiver to assume that if
the message has all of the mandatory CloudEvents attributes as HTTP headers
Copy link
Member

@slinkydeveloper slinkydeveloper Mar 5, 2020

Choose a reason for hiding this comment

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

What if it doesn't have all of the mandatory attributes? Should be considered non-event or not valid event? Maybe is it more convenient to state: if a request has the spec version attribute, then it should be handled as event (even not valid one)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the incoming message doesn't have all (4) required attributes then it is not a valid CE. While SDKs might choose to treat it as a CE but flag it as "incomplete", that is there choice. But from a spec perspective I don't think we can say anything other than all 4 are required to be a CE, anything else isn't a CE.

@@ -147,6 +147,14 @@ If a receiver detects the CloudEvents media type, but with an event format that
it cannot handle, for instance `application/cloudevents+avro`, it MAY still
treat the event as binary and forward it to another party as-is.

When the `Content-Type` header is not prefixed with the CloudEvents media type,
being able to distinguish between a _binary_ CloudEvent and a non-CloudEvent
Copy link
Member

Choose a reason for hiding this comment

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

So maybe the word "distinguish", at least to me, is unclear. With distinguish do you mean "start the parsing, even of a non valid event" or "start the parsing of a valid event?".

If I understood the goal here, you want to give an hint to the spec implementer on how to implement the parsing process of the HTTP envelope. If that's the case, I think it would be useful to specify that if it has the specversion, then it's an event, potentially non valid

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See comment below, from a spec perspective, if an incoming CE doesn't adhere to all of the MUSTs in the spec then it is not a valid CE. What a receiver chooses to do with it at that point is an impl choice - the spec is silent on that because we purposely decided not to get into the processing model side of things (for the most part).

So, I guess "distinguish" can be interpreted as "whether someone should try to parse it as a CE" yes, but even then there's no guarantee that it'll pass all of the MUST checks. I've added a little of of rewording - see what you think.

Copy link
Member

Choose a reason for hiding this comment

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

I like the rewording, thanks!

senders do not include any of the CloudEvents HTTP headers when the message
is not a CloudEvent, it would be a reasonable for a receiver to assume that if
the message has all of the mandatory CloudEvents attributes as HTTP headers
then it probably a CloudEvent. However, as with all CloudEvent messages, if
Copy link
Contributor

Choose a reason for hiding this comment

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

it -> it's

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed - thanks

@duglin
Copy link
Collaborator Author

duglin commented Mar 12, 2020

on 3/12 call, there was agreement with the overall direction - so next step is to modify the other transport specs appropriately.

@duglin duglin force-pushed the whenCE branch 2 times, most recently from f649e6b to 06fcf63 Compare March 19, 2020 15:15
Add some guidance for how to determine when an incoming message is a binary
CE vs some random non-CE message. The same receiver might accept CE and non-CE
messages so we should have an interoperable way for them to know what they're
getting

Signed-off-by: Doug Davis <dug@us.ibm.com>
@duglin
Copy link
Collaborator Author

duglin commented Mar 19, 2020

Updated all transport specs except nats. PTAL

@duglin
Copy link
Collaborator Author

duglin commented Mar 26, 2020

Approved on the 3/26 call.

@duglin duglin merged commit ab6f356 into cloudevents:master Mar 26, 2020
@duglin duglin deleted the whenCE branch March 26, 2020 17:25
@duglin duglin mentioned this pull request Dec 7, 2020
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.

3 participants