繁体   English   中英

Spring Amqp无法重新声明交换(XML配置)

[英]Spring amqp cannot redeclare exchange (xml config)

我们有一个现有项目,先前在Spring xml配置文件中声明过Rabbitmq交换。 现在,Rabbitmq公司的设置已更改,以便在另一个项目中声明交换,而我们的项目应仅发布到已经声明的交换中的队列中。 旧的配置导致以下异常:

2015-02-03 13:10:35,374 ERROR [pool-12-thread-1] [CachingConnectionFactory] [] - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - cannot redeclare exchange 'exchange.something' in vhost 'something' with different type, durable, internal or autodelete value, class-id=40, method-id=10)

2015-02-03 13:10:3​​5,383错误[pool-10-thread-1] [MqPublishService] []-向MQ发送消息失败。 在下一个批处理作业中重试。

使用Spring和Amqp xml配置选项时,有什么方法可以避免声明交换?

实际上,根本不需要声明它们。 对于客户端应用程序,仅知道交换和队列名称,当然还有路由密钥就足够了。

另一方面,如果您的应用程序基于这些bean( <queue><exchange>等),则只需删除<admin> 只有AmqpAdmin负责在代理上声明这些实体。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM