Auto-Delete True Not Working - MassTransit3

1,508 views
Skip to first unread message

Rebecca Vance

unread,
Aug 29, 2016, 5:04:26 PM8/29/16
to masstransit-discuss
Hi

Encountered an issue when trying to create a queue with AutoDelete as true. When start up, it is correctly creating queues (the one configured queue and auto generated  queue), but the configured queue is not being created with AD tag when look in local rabbit mq. Code is below. Wondering if setting up wrong or if another issue? Thanks in advance!

Bus.Factory.CreateUsingRabbitMq(configurator =>
{
configurator.AutoDelete = true;
var host = configurator.Host(new Uri("rabbitmq://localhost/"), hostConfigurator =>
{
hostConfigurator.Username("guest");
hostConfigurator.Password("guest");
});
configurator.ReceiveEndpoint(host, queueName, configureEndpoint);
});

Chris Patterson

unread,
Aug 29, 2016, 5:41:43 PM8/29/16
to masstrans...@googlegroups.com
In this case, for the queue, you need to put auto-delete into the receive endpoint configurator:

configurator.ReceiveEndpoint(host, queueName, x =>
{
    x.AutoDelete = true;
});

(inside your configureEndpoint method most likely)

The configurator you're setting it above is the bus endpoint, which is already AutoDelete.


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/92694013-0101-4541-b225-04988943131c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rebecca Vance

unread,
Aug 30, 2016, 10:30:28 AM8/30/16
to masstransit-discuss
Thanks for response. I updated my code but now getting errors when start it up.

Here is updated code:
var bus = BusInitializer.CreateBus("TestSubscriber1", configurator =>
{
configurator.AutoDelete = true;
configurator.Consumer(() => new SomethingHappenedConsumer());
});
bus.Start();

public static IBusControl CreateBus(string queueName, Action<IRabbitMqReceiveEndpointConfigurator> configureEndpoint)
{
var bus = Bus.Factory.CreateUsingRabbitMq(configurator =>
{
configurator.AutoDelete = true;
var host = configurator.Host(new Uri("rabbitmq://localhost/"), hostConfigurator =>
{
hostConfigurator.Username("guest");
hostConfigurator.Password("guest");
});
configurator.ReceiveEndpoint(host, queueName, configureEndpoint);
});
return bus;
}

Error when start is:
{"The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text=\"PRECONDITION_FAILED - inequivalent arg 'auto_delete' for exchange 'TestSubscriber1' in vhost '/': received 'true' but current is 'false'\", classId=40, methodId=10, cause="}

It is creating the queue as auto delete now even with getting error, but program doesn't work with error.

Thanks!
Rebecca

On Monday, August 29, 2016 at 4:41:43 PM UTC-5, Chris Patterson wrote:
In this case, for the queue, you need to put auto-delete into the receive endpoint configurator:

configurator.ReceiveEndpoint(host, queueName, x =>
{
    x.AutoDelete = true;
});

(inside your configureEndpoint method most likely)

The configurator you're setting it above is the bus endpoint, which is already AutoDelete.

On Mon, Aug 29, 2016 at 2:04 PM, Rebecca Vance <rebecca....@gmail.com> wrote:
Hi

Encountered an issue when trying to create a queue with AutoDelete as true. When start up, it is correctly creating queues (the one configured queue and auto generated  queue), but the configured queue is not being created with AD tag when look in local rabbit mq. Code is below. Wondering if setting up wrong or if another issue? Thanks in advance!

Bus.Factory.CreateUsingRabbitMq(configurator =>
{
configurator.AutoDelete = true;
var host = configurator.Host(new Uri("rabbitmq://localhost/"), hostConfigurator =>
{
hostConfigurator.Username("guest");
hostConfigurator.Password("guest");
});
configurator.ReceiveEndpoint(host, queueName, configureEndpoint);
});

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Aug 30, 2016, 12:21:42 PM8/30/16
to masstrans...@googlegroups.com
The error you are seeing is when the exchange and/or queue already exists with a different set of exchange parameters (auto-delete, durable, etc.). You should any existing exchanges or queues from the broker and start it again.

If you're sending to the queue from another service, you'll need to add parameters to the queue URI to match the expected exchange properties.

rabbitmq://localhost/queueName?autodelete=true

Otherwise, they'll conflict when trying to create the exchange when sending.


To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

Rebecca

unread,
Aug 30, 2016, 12:35:51 PM8/30/16
to masstransit-discuss
Ok thanks, I will try this. I did make sure all queues were deleted before starting and it was still getting error.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.

Rebecca

unread,
Aug 30, 2016, 1:09:45 PM8/30/16
to masstransit-discuss
I deleted all queues and exchanges. When I run now I get: RabbitMQ connection failed: Connect failed: guest@localhost:5672/TestSubscriber1

Rebecca

unread,
Aug 30, 2016, 1:25:01 PM8/30/16
to masstransit-discuss
I got it working! Thanks for your help!

Chris Patterson

unread,
Aug 30, 2016, 1:40:49 PM8/30/16
to masstrans...@googlegroups.com
Great, glad to hear it!


To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages