chapas
chapas

Reputation: 75

Creating queues dynamical on MassTransit

I have a particular scenario with RabbitMQ that needs to have dynamically created queues and binds to exchanges, that are also dynamically created (not by me). This creation and binding is triggered by a new SignalR subscription.

This issue: https://github.com/MassTransit/MassTransit/issues/398 is about it, but I still don't know the answer.

Seems that mass transit is not very flexible on creating things on the move. How can I achieve this? What if I stop the bus and recreate all the queues and bindings plus the new one, and start the bus again?

Thanks in advance.

Upvotes: 2

Views: 4644

Answers (1)

Chris Patterson
Chris Patterson

Reputation: 33522

Receive endpoints can be connected via the bus, as shown in the documentation.

For example:

var handle = bus.ConnectReceiveEndpoint("queue-name", x =>
{
    x.Consumer<SomeConsumer>();
})

// the code below waits for the receive endpoint to be ready
// and throws an exception if a fault occurs

var ready = await handle.Ready;

Upvotes: 5

Related Questions