4

I'd like to delete all the messages from a queue in my integration test SetUp routine, how can I accomplish that? No luck with googling/intellisense-bruteforce.

If it matters -- I'm using RabbitMq as transport.

vorou
  • 1,869
  • 3
  • 18
  • 35

1 Answers1

5

There's no way to "delete" from queues within MassTransit. For tests you can use temporary, random queue URIs via rabbitmq://localhost/*?temporary=true. Or you can just append ?temporary=true to the end of your existing queue URIs to have MT clean stuff up afterward. Note: Current, as of 2.8, temporary exchanges aren't cleaned up. This should be fixed by the next release.

Travis
  • 10,444
  • 2
  • 28
  • 48
  • There's no way to "purge" the queues from within MassTransit. -- is it "by design"? – vorou Aug 12 '13 at 15:15
  • 1
    There is `SetPurgeOnStartup(true)` configuration option. Which might do what you want. Temporary queues are a better answer in RabbitMQ. However, if you feel like it needed, for whatever reason, and `SetPurgeOnStartup` doesn't cut it for you, submit an issue: https://github.com/MassTransit/MassTransit/issues – Travis Aug 12 '13 at 15:26
  • 1
    temporary queues appear to have been omitted in V2.9.5 – Paul May 07 '14 at 14:09
  • They're in the latest v2 codebase, and have been for several releases. – Chris Patterson Aug 27 '15 at 15:33