Add CloudEvents middleware
@jskeet がすでに取り組んでいます。
2021年2月13日 から。
評価
この issue はまだ評価されていません。
説明
Description
As part of the Dapr project - we wrote our own middleware to unwrap a structured cloud event. This seems like a generally useful feature - but because we wrote it ourselves separate from this project and tailored to Dapr's needs, it doesn't interact with the any of the goodness here.
https://github.com/dapr/dotnet-sdk/blob/master/samples/AspNetCore/RoutingSample/Startup.cs#L78
https://github.com/dapr/dotnet-sdk/blob/master/src/Dapr.AspNetCore/CloudEventsMiddleware.cs
Dapr uses the cloudevents format (only structured json) for pub/sub messages. The middleware gives users a pretty idiomatic experience for using ASP.NET Core's primitives to interact with the payload of the cloudevent (data or data_base64).
How this works in practice:
- Dapr sends an HTTP request to the app using the structured JSON format
- The middleware unwraps the envelope
- The envelope is read as JSON
- We replay the contents of
dataordata_base64into the request body
- Some other piece of code (likely MVC) reads the request body and doesn't see the envelope, only its payload
What we're currently missing is that we don't persist the envelope of the cloudevent anywhere the use has access to. Example of what this might look like.... If we're going to expose the cloudevents envelope, then it seems useful to be able to do so in a strongly-typed way.
This ends up being a really useful pattern for an app that needs to receive a cloudevent, but the app code wants to use existing tech to read the payload. It feels like this is a generally useful pattern and we could converge this functionality with the cloudevents package rather than supporting it in Dapr as a one-off.
I'm starting to have some conversations with users that do want access to other properties on the cloudevent, so ultimately we want to leverage what's been built here already.
Why didn't we do this earlier?
We are unwilling at add Newtonsoft.Json as a dependency for just this feature given that the other 95% of our functionality uses S.T.J. If https://github.com/cloudevents/sdk-csharp/pull/94 is going to happen, then it makes sense for us to to contribute to and rely on this project, rather than building partial functionality that overlaps.
What would it look like?
I'd like to contribute the middleware if it can stay close to the current design, and hopefully support a super-set of the features we have today. Our users are using this pattern today (middleware unwraps the event payload, using MVC or some other mechanism for the app to read the payload).
We'd need to go though some kind of deprecation period and point users to this package, eventually removing our functionality in favor of this. If the middleware lands here, I'm not sure if we'd ultimately need to take a dependency on this package in our code, or just tell users to install it 🤷
If you don't think the middleware belongs here, I think it's likely we'll still want to start using functionality from this package once #94 happens.
- 主要言語
- C#
- スター
- 334
- フォーク
- 88
- 平均マージ
- 22分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudevents/sdk-csharp のほかの issue
-
Include specversion in CloudEvent.GetPopulatedAttributes再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
cloudevents/sdk-csharp#373 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
cloudevents/sdk-csharp#324 · コメント 1 件 ·
-
Allow users to signal whether extensions are required再び着手できるかも @jskeet が 546 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
cloudevents/sdk-csharp#321 · コメント 4 件 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
cloudevents/sdk-csharp#310 · コメント 6 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
cloudevents/sdk-csharp#308 · コメント 5 件 · リアクション 1 件 ·
cloudevents/sdk-csharp の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
Unity-Technologies/unity-agent-plugin#118 ·
メンテナーはふだん 1 日以内に返信
-
The Recommended preset turns on Import Uno DSP, which only works with the Material theme対応中かも @agneszitte が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
unoplatform/uno.templates#2388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
eyalgolan/statecraft-israel#2732 ·
メンテナーはふだん 1 日以内に返信
-
要トリアージ
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
kind/chore status/draft
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Altinn/altinn-events#1158 ·
メンテナーはふだん 1 日以内に返信