rebus-org / Rebus.RabbitMq

:bus: RabbitMQ transport for Rebus
https://mookid.dk/category/rebus
Other
65 stars 45 forks source link

Could not be dispatched to any handlers #25

Closed levia7han closed 6 years ago

levia7han commented 6 years ago

I am trying to import some data across rabbit using rebus that will be picked up by consumers in the future. For now I am just filling the queue with this data. I have other services that do this and I get no errors from them.

The odd thing is. All I am doing is putting it in the queue. Not trying to handle it. Do you have any idea why I would get this message? I have seen this happen in the past but it just kind of went away. It is happening about 1% of the time over 100k messages that are all pretty small. version is 4.4.2 for Rebus.RabbitMQ

System.AggregateException: 5 unhandled exceptions (Message with ID 0bbe501b-6101-4fce-aa7d-cea5725b870a and type Core.RabbitContracts.RawVisit, Core could not be dispatched to any handlers) (Message with ID 0bbe501b-6101-4fce-aa7d-cea5725b870a and type Core.RabbitContracts.RawVisit, Core could not be dispatched to any handlers) (Message with ID 0bbe501b-6101-4fce-aa7d-cea5725b870a and type Core.RabbitContracts.RawVisit, Core could not be dispatched to any handlers) (Message with ID 0bbe501b-6101-4fce-aa7d-cea5725b870a and type Core.RabbitContracts.RawVisit, Core could not be dispatched to any handlers) (Message with ID 0bbe501b-6101-4fce-aa7d-cea5725b870a and type Core.RabbitContracts.RawVisit, Core could not be dispatched to any handlers) ---> Rebus.Exceptions.RebusApplicationException: Message with ID 0bbe501b-6101-4fce-aa7d-cea5725b870a and type Core.RabbitContracts.RawVisit, Core could not be dispatched to any handlers 

I am setting up my bus like so.

var bus = Configure.With(new SimpleInjectorContainerAdapter(container))
                           .Logging(l => l.None())
                           .Transport(t => t.UseRabbitMq(rabbitConnection, "page_visit"))
                           .Start();
mookid8000 commented 6 years ago

This

Configure.With(new SimpleInjectorContainerAdapter(container))
    .Logging(l => l.None())
    .Transport(t => t.UseRabbitMq(rabbitConnection, "page_visit"))
    .Start();

will start the bus, and it will immediately start receiving messages from the page_visit queue, and since there's no handlers you will see the

Message with ID <id> and type <type> could not be dispatched to any handlers

exception.

If you want to create the queue, but you do NOT want to start receiving messages from it, you can do so by starting the endpoint with 0 worker threads:

Configure.With(new SimpleInjectorContainerAdapter(container))
    .Logging(l => l.None())
    .Transport(t => t.UseRabbitMq(rabbitConnection, "page_visit"))
    .Options(o => o.SetWorkers(0))
    .Start();

and then it will not start receiving messages.

levia7han commented 6 years ago

Ah, once again. Something I have totally missed but was simple. Thanks as always.