簡體   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