jezzsantos / servicestack.webhooks Goto Github PK
View Code? Open in Web Editor NEWAdd Webhooks to your ServiceStack services
License: Apache License 2.0
Add Webhooks to your ServiceStack services
License: Apache License 2.0
Now that we have the CacheClientSubscriptionStore we can simply create a Redis version of it, for storing subscriptions, and offer that to people as an alternative store.
We could create a 'ServiceStack.Webhooks.Redis' nuget from a 'Webhooks.Redis' project in the solution ,and ship that nuget separately.
We will eventually need the SubscriptionService
to be configured for caching responses.
Story: "As a subscriber I want to see a transaction history of my subscription.
(i.e. What notification succeeded and what failed, when, and what StatusCode and StatusDescription from my service was returned.)"
If we provided a SubscriptionService.UpdateHistory() API, then relays could call that API and deliver the results of notifying subscribers with events. The history could be attached to the SubscriptionService.GetSubscription() API.
I think the update would need to come in batches of subscribers for a single event.
Then subscribers will have a history of all events delivered and their success, much like we see on github. https://developer.github.com/webhooks/testing/#listing-recent-deliveries
Any plans to provide a .NET Standard build for this great plugin?
It would be nice if retry policies could be specified. Currently it's up to each provider to come up with it's own way of handling retries. There are some scenarios that could be handled better if the plugin handled retries rather than the provider.
For example if an endpoint cannot be reached it would be sensible to not attempt to send any other events until the first event succeeds or fails completely (after all available retries are exhausted).
Moving the retry policy into the plugin would allow reuse of common webhook logic. For example try every minute for 10 minutes then every hour for 10 hours. The retries would also be visible via the subscription history. This may help the receiver debug their server app.
I've not thought too much about how this could be implemented generically yet. I'm opening this issue to start the discussion.
Hey @jezzsantos
Have you got a plan for handling the filtering of events? For example in GitHub if you are subscribed to PullRequestEvent you would only want to receive these for the repos you are interested in.
I am trying to use Webhook plugin with ServiceStack v5.9 but with latest ServiceStack.Webhooks v3.0.1 giving me issue, please refer error below:
{ "responseStatus": { "errorCode": "MissingMethodException", "message": "Method not found: 'Int32 ServiceStack.OrmLite.OrmLiteWriteExpressionsApi.Delete(System.Data.IDbConnection, System.Linq.Expressions.Expression
1<System.Func2<!!0,Boolean>>)'.", "stackTrace": "[DeleteSubscription: 6/15/2020 12:42:28 PM]:\n[REQUEST: {id:c42c28e2-f432-40d1-b370-49a5a8506035}]\r\nSystem.MissingMethodException: Method not found: 'Int32 ServiceStack.OrmLite.OrmLiteWriteExpressionsApi.Delete(System.Data.IDbConnection, System.Linq.Expressions.Expression
1<System.Func2<!!0,Boolean>>)'.\r\n at ServiceStack.Webhooks.OrmLite.OrmLiteSubscriptionStore.Delete(String subscriptionId)\r\n at ServiceStack.Webhooks.ServiceInterface.SubscriptionService.Delete(DeleteSubscription request)\r\n at lambda_method(Closure , Object , Object )\r\n at ServiceStack.Host.ServiceRunner
1.d__15.MoveNext() in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Host\ServiceRunner.cs:line 133\r\n",
"errors": []
}
}`
Upon contacting ServiceStack it is advice to raise issue with you to provide new version that targets the latest v5.9.
Right now, HmacAuthProvider.Secret
is a simple property.
There will be cases where this needs to be read from configuration using IAppSettings
for a global value.
There may be other cases where the developer will need to fetch a different secret for different events, and so a delegate can be used to lookup the secret from any resource based upon the eventname.
Recommend, we define a HmacAuthProvider.ctor() overload that reads a global value of 'hmac.Secret' from configuration.
Recommend we replace the simple property getter with a delegate that passes in the IRequest, and eventName of the event to be verified. That way the developer can use Resolve to get any service they might need (including IAppSettings
) should they need to get different secrets for different events
We have not yet completed the implementation of HMAC authenticity for subscriptions that pass a secret key.
We need the HMAC signature to be calculated over the whole request, and updated in the request headers.
in: https://github.com/jezzsantos/ServiceStack.Webhooks/blob/master/src/Webhooks.Relays/Clients/EventServiceClient.cs#L135
If no support for creating the signature in ServiceStack, then we could look to bouncycastle or some other library for doing that for us.
Story: "As a relay, I don't want to repeatedly send notifications to subscriber endpoints that have already reported a 4XX status code in the past."
I think,we simply set IsActive = false, if we get a delivery report for a 4XX for any subscription.
Need a (additional) signed version of the nuget packages:
i.e.:
using a *.snk file in the solution
Originating from jezzsantos/ServiceStack.Webhooks.Azure#2.
We need a way in the ServiceClient
to allow the developer to handle OnAuthenticationRequired
and to be able to set the cookies or bearertoken in that handler.
Because AppHostWebhookEventSink
runs on the same thread as IWebhooks.Publish()
all events raised by my service operations are going to be relayed to all subscribers before my service operation can process the incoming request. This means that my service operation could either:
It is a perf killer!
We currently don't support relaying events to subscribers with any other Content-Type
than application/json
. You will get a 400 is you subscribe with any other Content-Type
. See SubscriptionConfigValidator
Possible other types we could/should support would be at least: application/x-www-form-urlencoded
as well as application/json
That's because right now we are using a JsonServiceClient
(wrapped inside the ServiceClient
class) to do our relay of events. That would have to change. For example, using the HttpClient
instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.