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

Binary payloads? #199

Closed
dazinator opened this issue Feb 9, 2022 · 2 comments
Closed

Binary payloads? #199

dazinator opened this issue Feb 9, 2022 · 2 comments

Comments

@dazinator
Copy link

I had a look at the samples but I couldn't see any example of sending a cloud event over http as a binary payload, and also receiving a cloud event, with mvc model binding in play, from a binary payload rather than json. Is it just the case that support is there and it's missing an example, or is it yet to be worked on? I would be keen to compare payload difference with binary format vs json for example.

@jskeet
Copy link
Contributor

jskeet commented Feb 9, 2022

It would be useful to stick to a single question per issue, otherwise we end up with "half-answered" issues.

#148 covers the fact that there are some aspects which could be simpler - but it's still fairly easy to make an HTTP request with a CloudEvent:

// Note that the event formatter has less to do when it comes to binary mode than structured mode,
// but formatters document how they serialize various kinds of payload data.
var content = cloudEvent.ToHttpContent(ContentModel.Binary, new JsonEventFormatter());
var httpClient = new HttpClient();
var result = await httpClient.PostAsync(uri, content);

For receiving an event, there's no MVC model binding, but given a request it's easy to extract an event using the extensoin methods in CloudNative.CloudEvents.AspNetCore.

@dazinator
Copy link
Author

It would be useful to stick to a single question per issue, otherwise we end up with "half-answered" issues.

Understood. Please also understand though I have only asked a single question, as identified by the solitary question mark in the issue text! Here is the singular question from the issue text just for clarity:

Is it just the case that support is there and it's missing an example, or is it yet to be worked on?

I feel the answer based on your response above is "support is there and it's missing an example" however I appreciate perhaps my question wasn't as clear and concise as it could be.

Thank you for your response, I will close this.

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

2 participants