Warden – extensions, integrations, NuGet

Quite recently I’ve started working on new features for the Warden project and published the first prelease version to the NuGet (along with other packages that are meant to be additional plugins). In this post, I will discuss the available extensions that are basically responsible for making the fluent API even more fluent and the integrations that are a totally new thing, implemented as separate plugins (similarly to the watchers), which provide a quick access to the external services that can be part of the Warden (e.g. the SendGrid).

 

Let’s start with the extensions. Lately, there was a code like this (which is still valid of course):

As you can see, it is responsible for creating a new watcher and then adding it to the configuration of the Warden by using the generic AddWatcher().
From now on, there’s another way to do it (inspired with other frameworks such as the MVC and its middleware):

The code example above fits nicely (at least in my opinion) into the whole ecosystem – it’s just another extension available while configuring the Warden.
Please note that you may either use lambda expression for configuring the particular watcher or provide the configuration object (like in the first example) – just feel free to use either of the mentioned options interchangeably. The point is that now you have another way to setup the monitoring plugins.

Now comes the second part, which would be the integrations.
An integration (as the name states) is just an external service configured to work with the Warden. This stuff is still a little bit in the experimental phase and I’ll describe it in more depth in the upcoming posts, however if you’d like to find out more about the current implementation click here. So what can we do with integrations? Something like this:

As you can see in the example above, we’re adding the new integration for SendGrid mailing service (which likewise the watchers can be setup via the generic method AddIntegration()).
For each hooks configuration, there’s a brand new, overloaded method that has these integrations provider. What is it? If you take a look at its interface it should be very straightforward:

You can think of it as a simple (actually, very trivial) type of an IoC container and you can definitely provide your own implementation by using the SetIntegratorProvider() while configuring the Warden. Its only job is to either register or resolve the new integration and in that case, we can access the SendGrid integration via custom extension method (fluent API all the way).

To sum up – Warden now supports both watchers that are responsible for monitoring and integrations that can make your life simpler (and change the world of course) by allowing to quickly access some external services (like mailing and in the future maybe Skype or Slack) in order to e.g. notify about any system failures.

3 Comments Warden – extensions, integrations, NuGet

  1. Dai Software

    Hey, very nice site. I came across this on Google, and I am stoked that I did. I will definitely be coming back here more often. Wish I could add to the conversation and bring a bit more to the table, but am just taking in as much info as I can at the moment. Thanks for sharing.
    Dai Software
    Keep Posting:)

    Reply

Leave a Reply to Piotr Gankiewicz Cancel reply

Your email address will not be published. Required fields are marked *