You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've already proposed this in person, but I've decided to move forward and describe a little more.
I think, that Rx.NET proposes a nifty API for a problem, that Warden aims to solve. Given watchers and hooks for example - first one seems to be used to define a source of some events happening over time, we'd like to monitor and make assertions agains, while the second is a subscriber (observer) of such stream of events.
As example, following config:
varconfiguration= WardenConfiguration
.Create().AddWebWatcher(WebWatcherConfiguration.Create("http://some.url").EnsureThat(response => response.StatusCode == HttpStatusCode.OK).Build(),
hooks:hooks =>{ hooks.OnFirstFailure(result => Console.WriteLine("Response was not HTTP OK"));},
interval: TimeSpan.FromSeconds(5));
is roughly equivalent of:
Observable
.Timer(dueTime: TimeSpan.FromSeconds(5), period: TimeSpan.FromSeconds(5)).SelectMany(async _ =>await HttpGet("http://some.url")).Where(response => response.StatusCode != HttpStatusCode.OK).Take(1).Subscribe(onNext:nonOkResponse => Console.WriteLine("Response was not HTTP Ok"));
Take note, that Observable has over 100 extension methods, many of them familiar for people already using LINQ. They are also highly composable. That's a lot of code you don't need to write or maintain.
Also Rx.NET comes with a scheduler that is able to handle things like periodic action runs etc.
If you're interested this is a starting point. From there you could move further into concept of reactive streams.
The text was updated successfully, but these errors were encountered:
Thanks, it's a very interesting idea indeed. I have a little experience with RX and even less time to re-implement the library itself but it looks very neat. I'll take a look at the provided resources and if you would like to give it a try by implementing a simple extension using RX that would be great :).
I've already proposed this in person, but I've decided to move forward and describe a little more.
I think, that Rx.NET proposes a nifty API for a problem, that Warden aims to solve. Given watchers and hooks for example - first one seems to be used to define a source of some events happening over time, we'd like to monitor and make assertions agains, while the second is a subscriber (observer) of such stream of events.
As example, following config:
is roughly equivalent of:
Take note, that Observable has over 100 extension methods, many of them familiar for people already using LINQ. They are also highly composable. That's a lot of code you don't need to write or maintain.
Also Rx.NET comes with a scheduler that is able to handle things like periodic action runs etc.
If you're interested this is a starting point. From there you could move further into concept of reactive streams.
The text was updated successfully, but these errors were encountered: