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. No annotations are required.
public interface IFooService
{
// timeout and cancellation support
[Timeout(4500)]
Task<string> GetDataAsync(CancellationToken token);
Task SendDataAsync(string param1, int param2);
}
- 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>);
await proxy.GetDataAsync(CancellationToken.None);
- 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
- Recoverable proxies
- Server failover support
- Streaming
- Modularity - every component and behavior of Bolt is replaceable
- Generation of synchronous or asynchronous interfaces using the dotnet-bolt tool
- 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 source code.
Any ideas, improvements or code contributions are welcome. Happy coding ;)