Lean and lightweight http communication library based on ASP.Net Core. The main focus of project was to create multiplatform, simple and powerfull replacement for WCF library.
Bolt requires interface describing your service that will be used for communication.
public interface IFooService
{
void SimpleMethod();
// Support for asynchrony, action timeouts and cancellation tokens
[Timeout(4500)]
Task SimpleMethodWitCancellationAsync(CancellationToken token);
}
- Add Bolt.Client package to project (
Install-Package Bolt.Client -pre
) - Create proxy to your service and call remote method
var configuration = new ClientConfiguration();
IFooService proxy = configuration.CreateProxy<IFooService>(<service url>);
proxy.DoYourThing();
- Add Bolt.Server package to project (
Install-Package Bolt.Server -pre
) - In you startup class use Bolt extensions to register Bolt into the pipeline
public void ConfigureServices(IServiceCollection services)
{
services.AddLogging();
services.AddOptions();
services.AddBolt();
}
public void Configuration(IApplicationBuilder app)
{
appBuilder.UseBolt((h) =>
{
// register our service
h.Use<IFooService, FooService>();
});
}
Now you are ready to experiment with Bolt. This was just the very simple scenario for Bolt usage. Bolt also supports:
- Sessions
- Generation of async interfaces
- CancellationToken support
- Asynchronous methods
- Recoverable Proxy
- Server Failover support
- Modularity - every component and behavior of Bolt is replaceable
- User Code Generators - plug your own code into the generated proxies
- Configuration Based Generation - define Configuration.json file to describe how proxies should be generated
- Bolt.Core - contains common interfaces and helpers shared by both client and server.
- Bolt.Client - contains client side code required to communicate with Bolt service.
- Bolt.Server - server side code required to integrate Bolt into ASP.NET Core
- dotnet-bolt - tool used to generate synchronous and asynchronous interfaces.
To find out more just take a look at Bolt code or check out the Bolt.Samples repository.
Any ideas, improvements or code contributions are welcome. Happy coding ;)