You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In what version(s) of Spring AMQP are you seeing this issue?
3.1.6
Describe the bug
I call RabbitAdmin#setRedeclareManualDeclarations(true) to ensure that any Exchanges, Queues or Bindings I declare at runtime (with AmqpAdmin#declareExchange/declareQueue/declareBinding) are automatically re-declared when rabbitmq looses its state for some reason.
I also have some static Exchanges, which I bind as @Bean in the application context. Spring implicitly takes care of declaring those for me.
When rabbitmq resets, RabbitAdmin#initialize calls redeclareManualDeclarables()first, before it continues with re-declaring statically configured declarations. This means that explicitly declared Bindings to statically declared Exchanges can never be restored, because the Exchange has to exist in order for the Binding declaration to succeed.
Expected behavior
Statically configured declarations should be recreated first and the manualDeclarables should be redeclared afterwards.
** Workaround exists
For now, I can just call AmpqAdmin.declareExchange once on startup for the static Exchange, so that it will be redeclared as part of redeclareManualDeclarables(), but IMHO I shouldn't have to do that.
The text was updated successfully, but these errors were encountered:
sherter
changed the title
On (re-)initialization, static Declarables should be re-declared _before_ manually declared Declarables
On (re-)initialization, static Declarables should be re-declared before manually declared Declarables
Sep 13, 2024
sherter
changed the title
On (re-)initialization, static Declarables should be re-declared before manually declared Declarables
On (re-)initialization, static Declarables should be re-declared before manually declared ones
Sep 13, 2024
Fixes: #2815
Issue link: #2815
When rabbitmq resets, `RabbitAdmin#initialize` calls `redeclareManualDeclarables()` first, before it continues with re-declaring statically configured declarations.
This means that explicitly declared Bindings to statically declared Exchanges can never be restored, because the Exchange has to exist in order for the Binding declaration to succeed.
* Call new `redeclareBeanDeclarables()` before `redeclareManualDeclarables()`
**Auto-cherry-pick to `3.1.x`**
Fixes: #2815
Issue link: #2815
When rabbitmq resets, `RabbitAdmin#initialize` calls `redeclareManualDeclarables()` first, before it continues with re-declaring statically configured declarations.
This means that explicitly declared Bindings to statically declared Exchanges can never be restored, because the Exchange has to exist in order for the Binding declaration to succeed.
* Call new `redeclareBeanDeclarables()` before `redeclareManualDeclarables()`
(cherry picked from commit 2ebc7ef)
In what version(s) of Spring AMQP are you seeing this issue?
3.1.6
Describe the bug
I call
RabbitAdmin#setRedeclareManualDeclarations(true)
to ensure that any Exchanges, Queues or Bindings I declare at runtime (withAmqpAdmin#declareExchange/declareQueue/declareBinding
) are automatically re-declared when rabbitmq looses its state for some reason.I also have some static Exchanges, which I bind as
@Bean
in the application context. Spring implicitly takes care of declaring those for me.When rabbitmq resets,
RabbitAdmin#initialize
callsredeclareManualDeclarables()
first, before it continues with re-declaring statically configured declarations. This means that explicitly declared Bindings to statically declared Exchanges can never be restored, because the Exchange has to exist in order for the Binding declaration to succeed.Expected behavior
Statically configured declarations should be recreated first and the
manualDeclarables
should be redeclared afterwards.** Workaround exists
For now, I can just call
AmpqAdmin.declareExchange
once on startup for the static Exchange, so that it will be redeclared as part ofredeclareManualDeclarables()
, but IMHO I shouldn't have to do that.The text was updated successfully, but these errors were encountered: