Skip to content

On (re-)initialization, static Declarables should be re-declared before manually declared ones #2815

Closed
@sherter

Description

@sherter

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions