There are plenty of existing Slack integration frameworks. Slack engineering team even provide its own implementation with Bolt (JS, Java).
However, while trying to integrate Slack using a .NET Core stack, i didn't find any project that was simple to use, while being fast and scalable...
Usain is simple, fast and scalable.
It provides the event ingesting and processing infrastructure you need to create an reactive (interactive) Slack App.
Usain addresses only two concerns:
- Ingesting your slack event as fast as possible.
- Processing each and every ingested event in a customizable and reliable way.
This limitation of concerns enforce simplicity.
Adding an Event Reaction (how to react to a Slack event) is as simple as providing an implementation of the IEventReaction<>
to the Dependency Injection container. This Event Reaction will be automatically used by the Event Processor pipeline.
Head down to the Getting started section to learn how to implement an EventReaction.
ASP.NET Core is fast, really fast.
According to Tech Empower Benchmarks Γ¬t is one of the fastest web stack on the market as of today (jun 2020). Surprisingly it is even faster than a pure Rust or C++ web server. This is probably due to a lack of maturity in these implementations. That said, in term of pure raw performance, ASP.NET Core is at light years from a Node or Java web stack, which would probably be your choice if you had to use the genuine Slack SDK (Bolt).
Usain is built upon raw ASP.NET Core.
It does not use ASP.NET Core MVC. This saves us from the extra overhead of the MVC pipeline.
Usain uses System.Text.Json for Json serialization operations.
System.Text.Json
design emphasizes high performance and low memory allocation over an extensive feature set. Built-in UTF-8 support optimizes the process of reading and writing JSON text encoded as UTF-8, which is the most prevalent encoding for data on the web and files on disk.
Usain uses LoggerMessage for logging operations.
LoggerMessage creates cacheable delegates that require fewer object allocations and reduced computational overhead compared to logger extension methods, such as LogInformation and LogDebug. It is the recommended pattern for high-performance logging scenarios.
As recommended by Slack, event ingestion and processing should de-coupled. Slack server expects your event ingestion to be fast and error free otherwise it will block your endpoint and stop sending events. You don't want that to happen in a production scenario.
Usain has been designed to follow that recommendation from the ground up. It uses an intermediate Event Bus abstraction to de-couple event ingestion from event reaction.
We provide a default in-memory implementation for basic scenarios, but swapping this default for something more scalable is a matter of a single line of configuration.
For example, in the 02.Advanced.AzureQueue sample app, we use an Azure Queue Storage for the queue infrastructure.
Usain is extensible in almost every area of the Event ingestion and processing pipeline.
There again, we provide a substitutable default implementations you can swap for whatever your consider a better fit for your use cases or infrastructure requirements.
Internally, Event handlings use a mediated event design. This gives you a lot more flexibility when implementing your business workflows.
In reference to Bolt, the Slack integration framework (Bolt JS, Bolt Java).
Yes, you got it, Usain vs Bolt. Uhm... π
To be completed.
Meanwhile, jump to the sample sources:
- 01.Simple: demonstrates how to use Usain's Event Listener and Event Processor inside a unique web app. It uses an in-memory shared event queue. For demo purpose only.
- 02.Advanced.AzureQueue: demonstrates how to use Usain's Event Listener and the Event Process in distinct hosting processes. It uses an Azure Queue Storage, providing a better scalability and good fault tolerance.
- Supported events: list of Slack events currently supported by Usain
Usain icons made by Pixel perfect from FlatIcon