I am working on a .net core 3.1 app, for some reason my messages are not getting consumed.
service configuration :
services.AddMassTransit(x =>
{
x.AddConsumer<ItemAddedConsumer>();
x.AddBus(provider => Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.UseHealthCheck(provider);
cfg.Host(new Uri($"rabbitmq://{rMqSettings.host}:{rMqSettings.port}"), h =>
{
h.Username(rMqSettings.username);
h.Password(rMqSettings.password);
});
cfg.ReceiveEndpoint("items-service.ItemAdded", ep =>
{
ep.ConfigureConsumeTopology=false;
ep.Bind("ItemAdded");
ep.PrefetchCount = 15;
ep.Consumer<ItemAddedConsumer>(provider);
});
consumer class :
public class ItemAddedConsumer : IConsumer<ItemAdded>
{
private readonly IMediator _mediator;
public ItemAddedConsumer(IMediator mediator)
{
_mediator = mediator;
}
public async Task Consume(ConsumeContext<ItemAdded> context)
{
await _mediator.Send(new ItemAdded(context.Message.Id));
}
}
and this is how i am sending the messages :
Uri uri = new Uri("exchange:ItemAdded?bind=true&queue=items-service.ItemAdded");
var endPoint = await _bus.GetSendEndpoint(uri);
await endPoint.Send(@event);
all messages get sent to a new queue called items-service.ItemAdded_skipped queues