RestBus is a high performance messaging library that enables you to consume ASP.NET Core, Web API and ServiceStack service endpoints via RabbitMQ.
With RestBus, queuing or sending a message asynchronously is as simple as:
var amqpUrl = "amqp://localhost:5672"; //AMQP URI for RabbitMQ server var serviceName = "samba"; //The unique identifier for the target service var client = new RestBusClient(new BasicMessageMapper(amqpUrl, serviceName)); //Call the /hello/random endpoint var response = await client.GetAsync("/hello/random");
Does that look familiar?
If you're conversant with .NET's HttpClient class, you'll be right at home with the
RestBusClient class. In fact they both derive from the same base class.
/hello/random endpoint is an ordinary web service endpoint in an ASP.NET Core, Web API or ServiceStack service.
RestBus routes the request over RabbitMQ, invokes the endpoint and returns the response, without ever hitting the HTTP transport.
Why do I need this?
Using RabbitMQ from .NET can be a frustrating experience. RestBus makes it ridiculously easy.
For more reasons, see Why RestBus?
- Using RestBus in an ASP.NET Core service
Using RestBus in a Web API service
Using RestBus in a Self-Hosted Web API service
Using RestBus in an ASP.NET hosted ServiceStack service
Using RestBus in a Self-Hosted ServiceStack service
Calling Service Endpoints
- Queuing Messages
You don't need to configure the RabbitMQ server. RestBus automatically creates exchanges, queues and other resources as needed.
Use your Existing Web Services
Your services can still be consumed via HTTP while supporting RabbitMQ calls or you can turn off the HTTP interface.
Migrating your services to a message oriented architecture is as easy as writing a few lines of code.
Enjoy optimum efficiency in service request processing as endpoints can now be invoked asynchronously.
Scaling your services horizontally is as easy as launching new instances.
RestBus compares very favorably with other messaging libraries, and is the fastest library in many cases.
For more details, see the benchmarks project.
Roll your own MessageMapper class for custom messaging behavior.
How it works
RestBus follows the RPC messaging style. For more details, see How It Works.
Apache License, Version 2.0