NuGet / NuGetGallery

NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
https://www.nuget.org/
Apache License 2.0
1.54k stars 645 forks source link

Provide support for subscribing to Azure Event Grid (CloudEvents) #7392

Open tomkerkhove opened 5 years ago

tomkerkhove commented 5 years ago

Provide support for subscribing to CloudEvents allowing users to extend the current NuGet experience.

Describe the solution you'd like

It would be great if NuGet would allow us to opt-in for receiving events on what is going on in NuGet for the packages that we manage, what is going on in our org, the lifecycle of our API keys, etc.

That way we can fully automate how we manage everything and by using CloudEvents there is no lock-in.

Scenarios

But why stop there!

If we can even subscribe to events for individual packages that we can depend on we can automate the updating of our dependencies.

This is already supported with tools like Renovate or Dependabot which are using a pull-based model, but this would allow us to use a push-based more building more reactive apps.

Furthermore, external applications can be more responsive to new packages instead of having to poll your APIs to get the latest. A nice example is the NuGet indexer that Maarten Balliauw has built which could fully rely on events instead.

Why events over webhooks?

Events provide more granular information about what happened rather than more generic webhooks which allows us to more easily process that information.

skofman1 commented 5 years ago

Thanks for the suggestion @tomkerkhove ! How do you envision the event registration process? What will a user need to provide nuget.org to get events?

tomkerkhove commented 5 years ago

User would require to create a "event subscription" which defines the event types they are interested in and the HTTP endpoint to receive the events on.

Bonus points if I can create multiple "subscriptions" allowing us to integrate with multiple internal systems.

tomkerkhove commented 5 years ago

Thank you for considering it btw.

skofman1 commented 5 years ago

Thank you for considering it btw. It's an interesting suggestion.

Got it, so when an event occurs we will need to make an HTTP request on O(n) user provided endpoints.

Events provide more granular information about what happened rather than more generic webhooks which allows us to more easily process that information.

Read a little about CloudEvents. Isn't this like having webhooks but with a better/well-defined schema?

tomkerkhove commented 5 years ago

Got it, so when an event occurs we will need to make an HTTP request on O(n) user provided endpoints.

Yes and no, if you use a service like Azure Event Grid you, being NuGet gallery/service, can publish events. All user subscriptions are then done on that topic and Event Grid will handle all of the Post in and gives you event filtering out of the box.

Here is some more info : https://docs.microsoft.com/en-us/azure/event-grid/overview https://docs.microsoft.com/en-us/azure/event-grid/event-domains

Long story short, NuGet publishes events and creates the subscriptions wjil Azure Event Grid with Event Domains handles all of the rest.

Make sense? Happy to discuss on a call of that help more.

Read a little about CloudEvents. Isn't this like having webhooks but with a better/well-defined schema?

Yes, definitely. Azure Event Grid supports this out of the box as well but that is just a nice to have.

skofman1 commented 5 years ago

Sounds good! We will add this to our backlog. Implementation timeline will depend on interest from our users.

tomkerkhove commented 5 years ago

Thank you @skofman1!