-
Notifications
You must be signed in to change notification settings - Fork 120
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
Design proposal for webhooks/notifications #3387
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3387 +/- ##
============================================
+ Coverage 86.33% 86.93% +0.60%
- Complexity 2627 2661 +34
============================================
Files 337 341 +4
Lines 14799 15022 +223
Branches 1115 1108 -7
============================================
+ Hits 12777 13060 +283
+ Misses 1613 1569 -44
+ Partials 409 393 -16
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
} | ||
``` | ||
|
||
Important note is that nessie doesn't make any efforts to de-duplicate the URL and if a particular URL is subscribed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we de-dup? To me it sounds like we should try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De-dup is tricky thing to implement right. What we can do is to have a deterministic event ID based on the registered endpoint and a hash on the event payload. I think it's better to defer this it to when we know when and how we send out events, whether there's some messaging system in between, whether we synchronously call the event endpoint and the like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to go through that rabbit hole. But the more I think about the more I like the idea of deduping both events and subscriptions. The problem is that we will need to document the dedup rules and I didn't want to get into doing that right now. A simple approach is to have deterministic IDs for subscriptions and/or notifications.
TreeApiImpl class with an observer pattern. Every time the specific method in the TreeApi is called, an event is sent | ||
to the observer. This extension point allows extending to other types of notifications in the future. | ||
|
||
### Notification persistence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this part of the proposal. For other extensiosn to the core we have chosen an SPI
and a simple storage mechanism. For example authz has an SPI and the reference impl uses configs provided at runtime. Implementers can then plug in more sophisticated backends with the SPI. Rather than modifying our database adapter and forcing the same storage mechanism i think the SPI gives more flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed that having an SPI would be better and give us/others more flexibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good. I will take a look
|
||
## Implementation details | ||
### Observer extension point | ||
All the event types that we are interested are associated with the `/tree` API. We propose to extend the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the simplest approach is the same as the auth and tracing idioms: create a wrapper class. This avoids having to make significant changes to the kernel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good, just a few comments
|
||
## Implementation details | ||
### Observer extension point | ||
All the event types that we are interested are associated with the `/tree` API. We propose to extend the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
TreeApiImpl class with an observer pattern. Every time the specific method in the TreeApi is called, an event is sent | ||
to the observer. This extension point allows extending to other types of notifications in the future. | ||
|
||
### Notification persistence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed that having an SPI would be better and give us/others more flexibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of events LGTM - just a few comments about details.
But I'd prefer to move the management and especially the implementation details out of this document. Maybe we can start with a prototype that synchronously calls a statically configured endpoint. Maybe we tend to push events to a messaging system and have dedicated workers that are responsible for actually invoking the registered endpoint(s), deal with retries, error conditions, etc. And then think how we can actually implement a full-blown notification management system.
type: string | ||
format: date | ||
description: The time the event was fired in ISO date format. | ||
fromRefName: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use fromRef
here w/ type Reference
here as well - just with a note that the hash
field in there will always be
null
.
1. Its content-type is `application/json`. | ||
2. Its body contains the JSON payload of the event that happened. (See previous section for details on the expected schema). | ||
|
||
### Creating a new notification/webhook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, event management and event description should be separate things. So one doc that describes the events (as above). Not sure whether we should have a full blown notification management system here. Maybe it's initially sufficient to have a notification endpoint configured via Quarkus.
} | ||
``` | ||
|
||
Important note is that nessie doesn't make any efforts to de-duplicate the URL and if a particular URL is subscribed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De-dup is tricky thing to implement right. What we can do is to have a deterministic event ID based on the registered endpoint and a hash on the event payload. I think it's better to defer this it to when we know when and how we send out events, whether there's some messaging system in between, whether we synchronously call the event endpoint and the like.
## Implementation details | ||
### Observer extension point | ||
All the event types that we are interested are associated with the `/tree` API. We propose to extend the current | ||
TreeApiImpl class with an observer pattern. Every time the specific method in the TreeApi is called, an event is sent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let's leave out implementation classes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good. Both Ryan and Eduard had concerns on this part of the proposal. Let's talk offline
Co-authored-by: Robert Stupp <snazy@snazy.de>
Co-authored-by: Ryan Murray <rymurr@gmail.com>
This PR has been dormant for about a year - closing. Expect another PR for notifications soon (with different design choices). |
No description provided.