I would like to integrate MassTransit with Aspnetboilerplate project to use RabbitMQ as distributed event bus. Then potentially look to integrate Azure Service bus.
I am struggling in how to create a simple Eventbus and implement register and subscribe. Unfortunately I cannot find any good examples of this being done.
I can use the Aspnetboilerplate EventBus without any issues. An example of what I am looking to achieve is the following:
// subscribe to an event
var ev = EventBus.Register<T>(eventInfo =>
{
// do something with evInfo.Data
}
ev.Dispose();
// publish and event
private readonly IEventBus _eventBus;
_eventBus.TriggerAsync(new T());
I do not want to use the Abp framework due to licensing restriction on LGPL. The company that I work for will not accept this type of licenses in any of there internal products
Any advice or any article implementing something similar would be great.
UPDATE 1 As Chris pointed out lots of great videos and documentation and good to see for a great library.
Although I cannot seem to find any documentation how to implement a Generic Consumer / Request Client.
// Example of a consumer
public class ManagerResultConsumer<T>: BaseConsumer<ManagerResult<T>>
{
public override Task Consume(ConsumeContext<ManagerResult<T>> context)
{
return base.Consume(context);
}
}
// configure the service / consumers and clients
services.AddMediator(configurator =>
{
configurator.AddConsumer<SubmitOrderConsumer>();
configurator.AddConsumer<ManagerResultConsumer<T>>();
configurator.AddRequestClient<SubmitOrder>();
configurator.AddRequestClient<ManagerResult<T>>();
});
I am trying to ensure I do not have register lots of concrete implementations at start up, similar to SubmitOrder and SubmitOrderConsumer.
Thanks