Search code examples
asp.net-core.net-corerabbitmqmasstransit

Why when publish message to RabbitMQ with MassTransit, sends to another endpoint with skipped?


Here comes my code on my publisher app (a netcore API).

services.AddMassTransit(masstransit =>
        {
            masstransit.UsingRabbitMq((context, cfg) =>
            {
                cfg.Host(new Uri("rabbitmq://srv-docker-dev-01"), "/", h =>
                {
                    h.Username("guest");
                    h.Password("guest");
                });

                cfg.ReceiveEndpoint("implantacao", e =>
                {
                    e.ConfigureConsumeTopology = false;
                    e.Bind<ClienteAlteradoEvento>();
                });
            });
        });

Even before I create a consumer, my RabbitMQ shows a skipped queue. enter image description here

enter image description here

And the message is delivered on this __skipped.

Can someone tell me what I'm doing wrong?

Just a few points:

  • My consumer will not have access to the event class of my producer.
  • I will have 2 queues which have to consume my API. I'll probably configure another receive endpoint.
  • I thought I should have only 1 exchange for each microservice. Like, all the events published by comercial microservice, should use the same exchange, but MassTransit is creating one exchange each type. Is that correct?

Any thoughs and ideas, will be welcome. I'm just learning about RabbitMQ.

EDIT

Microservice A: Have endpoints to receive user input data of customers. Users send data like names, contracts, and anything else (many different types of data can be changed on different endpoints). Every time a customer is updated, this API should publish messages to update other microservices too. Lets say we have at least 3 different events: CustomerDataUpdatedEvent, CustomerAddressUpdatedEvent, CustomerContractsUpdatedEvent.

Microservice B: Want to consume the updates from costumer published by Microservice A. We don't have access to CustomerDataUpdatedEvent, CustomerAddressUpdatedEvent, CustomerContractsUpdatedEvent classes. We should build our class type on its side.

Microservice C: Want to consume the updates from costumer published by Microservice A. We don't have access to CustomerDataUpdatedEvent, CustomerAddressUpdatedEvent, CustomerContractsUpdatedEvent classes. We should build our class type on its side.

Neither B or C have access to class type on microservice A.

Is that possible? Does it makes sense?

Thanks


Solution

  • You are configuring a receive endpoint without any consumers on it. So any message produced that arrives on the queue will just be copied to the _skipped queue.

    I'd suggest reading some documentation to get the feel for how messages, consumers, and endpoints are configured.

    I wouldn't suggest using a single exchange (or even a single queue) for all the messages in a service, but since you're just learning I don't really know what else to suggest without details.