Routing is another important configuration component for endpoints that send messages. public Task StartAsync(CancellationToken cancellationToken) I ended up injecting IServiceProvider into my ConsoleHostedService class so that I could call UseRebus. NET Generic Host was a small challenge to work out as there were no examples for it. This was the part that gave me the most challenges, in creating my example.įiguring out how to call UseRebus when using the. In the start method, it calls the UseRebus extension method on the service provider to initialize Rebus. The block below is from the hosted service class ConsoleHostedService. Transport(t => t.UseAmazonSQS("ServerMessages" ConfigureServices((hostContext, services) => private static async Task Main(string args) This wires up a hosted service which is not Rebus specific, but there is some important Rebus initialization code in that hosted service we will see in the next section. In my example I also included the AddHostedService extension method. In more complex examples, this is where you will configure things like scale out, persistence, routing etc. This is where you configure the logging and transport in my example. To configure Rebus, the AddRebus extension method is where most of the magic is. This scans the assembly that contains one your message handlers you provide and registers all of the handlers in that assembly. To register the handlers I used services.AutoRegisterHandlersFromAssemblyOf(). This example is from the server side endpoint which consumes messages from the ServerMessages queue and handles them with the appropriate message handler. There are two sections of the host builder below that are specific to Rebus. To get started, we need to wire up a host builder. There is a docker-compose file at the root of that repo that you can use to fire up a mock of AWS SQS for the transport. Note that I'm using LocalStack running in Docker to provide the transport in my full example project you can find in GitHub. NET Generic Host for console applications, but it was relatively easy to figure it out. There were no direct examples I could find to set up the. I believe this is the best way to wire up a console application and seems to be the direction everything. In my example, I really wanted to use the. Of course Rebus has a good set of example projects, but I built my own just as a way to explore the framework. I created a quick simple example project that is available on GitHub. There are no published prices for Rebus Pro, and I will be interested in learning about what that pricing looks like. Like many opensource projects, there is an option to purchase professional support and the Rebus monitoring solution Fleet Manager comes as part of the professional support contract. This means that each library is light and focused.Īnother tenant of Mogen's vision is that Rebus is free opensource. The really good news is that Rebus leverages a set of componentized libraries to implement features. It is a framework in the sense that it is feature rich and supports multiple persistence and messaging platforms. I have found that he nailed the painless configuration, but thankfully I would describe Rebus as a framework as it exists today. In that same video he explained that he wanted to make the configuration of Rebus as painless as possible and that it is a lightweight library vs a framework. When I checked out the contributors in GitHub I found that while Mogens is definitely the primary contributor there is definitely other contributors. Rebus is founded by Mogens Heller Grabe and according to one of his talks I found on YouTube there are about 100 contributors to Rebus. It is a feature rich opensource (free) framework that has options for professional support and even a solution for monitoring your Rebus solution. When I finally dug into Rebus, I was amazed at what I found. I had heard of it in passing and the reputation was that it needed time to mature. Until a few weeks ago, I only had a vague awareness of Rebus. Since Rebus seemed to be similar to NServiceBus and MassTransit I started there. NET Service Bus space that I felt deserved a closer look. Recently, I became aware of two other options in the. It has just not compared with NServiceBus as far as features, documentation and support when I evaluated in the past. I've checked out MassTransit a number of times in the past and I'm probably due to give it another look. That framework or technology that didn't impress when you first looked at it might have matured while you were not looking and now it is a real contender. That said, I learned long ago in the rapidly changing world of software development that you need to reevaluate your options on regular basis. If you have read my blog articles, you will see that I am a huge fan of NServiceBus and have a considerable amount of experience with using it on projects.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |