-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddRabbitMQ method with volume mounts does not persist queues across restarts by default #2247
Comments
@mitchdenny - what do you think about having a "UsePersistence()" extension method in RabbitMQ that does this? Similar to the Storage container: aspire/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/Program.cs Lines 6 to 9 in 9895028
|
Need to think it through all the way to deployment, but definatley open to this idea. The difference between this and the storage resource is that Rabbit MQ is already a container so no need for the callback. |
@mitchdenny were you planning on taking this one according to the above? |
@sebastienros assigning this to you. There's work to add helpers for containers for persistence, you might be able to build on top #1317 |
@DamianEdwards does this work now? |
Let me try it out. |
Ok an update. I tried the scenario out with the new I then set about trying to create the scenario where message are enqueued but not consumed in one dev session, and then in the next dev session they are consumed, but I haven't been able to do so. I used the TestShop app to do this as it already has separate projects that produce and consume messages, so once modified to use persistence for RabbitMQ, I can just start a dev session with the resource that consumes messages ( RabbitMQ container logs
My changes so far are in https://github.com/dotnet/aspire/tree/damianedwards/rabbitmq-volume @pedershk any thoughts on what might be going on? |
Hi @DamianEdwards. I've observed the same behavior with passwords - this forced me to not use persistence with RabbitMQ when developing locally (we use ASB in our deployed test environment, so not an issue there). I was a bit flummoxed that the password parameter was removed from the I haven't set the password to a fixed value, so haven't been able to observe the non-stateful behavior you've been seeing. I CAN confirm however that previously, when password was being set via the Sorry I can't be of more help - but it would be good to get this back in a functional state. |
P4 still had lots of inconsistency. When we unified the container-based methods, we didn't add the password configuration back and that was an oversight. It lead to this issue which we resolved in P5. |
@pedershk I'm completely new to RabbitMQ so it's possible I'm doing something wrong. Can you look at the code in the TestShop.BasketService (producer) and TestShop.OrderProcessor (consumer) projects and confirm that the code, coupled with the procedure I documented above, should be sufficient to test the scenario? |
Afraid I'm not going to be much help - I've only ever used RabbitMQ through abstractions such as MassTransit. But I'm not entirely sure that the C# SDK creates queues with persistence by default - RabbitMQ also has non-persisted queue types. MassTransit creates queues with persistence by default, however. I can download a nightly build of Aspire and test with your AddRabbitMQ in the TestShop Apphost against my own MassTransit code - but that may not be sufficient to validate your scenario? |
@DamianEdwards can you backport |
RabbitMQ uses its HOSTNAME to set up paths for queues on its internal storage. As the DCP generates a random hostname across restarts, this changes with every invocation of the container. This results in unexpected behavior from the developer's point of view - queues are not persisted across restarts even with persistent storage configured for the container.
This is an example of a statement that will NOT persist queues:
If a NODENAME environment variable is set, RabbitMQ uses that to override the HOSTNAME on the container for internal configuration purposes. So directly specifiying the NODENAME variable With i.e.
WithEnvironment("NODENAME", "rabbit@localhost")
resolves the issue, as in the following statement:Suggestion : set NODENAME by default to a fixed value for RabbitMQ hosts (it's only used internally, so won't affect other RabbitMQ containers running in the same docker engine) - but still allow the user to override by setting it specifically like above. Alternatively, as a minimum, update the RabbitMQ container documentation for Aspire to mention this specifically.
The text was updated successfully, but these errors were encountered: