Open Closed

Update RabbitMq options at Runtime #2642


User avatar
0
gizemozdemir created
  • ABP Framework version: v5.0.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

Hi,

We are using AbpRabbitMqModule, AbpEventBusRabbitMqModule modules for eventbus messaging . We want to update AbpRabbitMqOptions HostName at runtime with user input. We are using appsettings.json to configuration. Is updating appsettings.json enough ?

I attached related part of our code .What is the best way to do that? Is there a way to reconfigure a module at runtime and reinitialize it? Thanks a lot.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    HI,

    You can inject the IOptions<AbpRabbitMqOptions> to change it.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    gizemozdemir created

    Hi liangshiwei,

    Thx for your answer, I have tried IOptions and IOptionsSnapshot also. We can update value, but connections is not refreshed or updated with new hostname. Am i missing something ?

    Regards. Mehmet

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    The connection is not cheeped, so we use IConnectionPool. it will reuse as many connections as possible.

    You can replace IConnectionPool with your own implementation to create a new connection when the HostName is changed.

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    gizemozdemir created

    Hi,

    Thank you. I get it.

    Regards.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.