Starts in:
2 DAYS
12 HRS
7 MIN
13 SEC
Starts in:
2 D
12 H
7 M
13 S
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.


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

    HI,

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

  • 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

  • User Avatar
    0
    liangshiwei created
    Support Team 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

  • User Avatar
    0
    gizemozdemir created

    Hi,

    Thank you. I get it.

    Regards.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06