![](/img/trans.png)
[英]Getting exception on IBM Websphere MQ JMS connection with spring boot
[英]Spring Boot - JMS Connection to initialize later
我正在使用 DefaultMessageListenerContainer 使用 t3 協議連接到 JMS 隊列,如果 t3 協議為 UP,它工作正常。 但是如果 t3 URL 已關閉,那么一旦 t3 URL 為 UP,Listener 將無法重新注冊 Bean。 我已經覆蓋了偵聽器以進行調用,但在應用程序啟動后無法重新注冊 Bean。
@Bean
public QueueConnectionFactory queueConnectionFactory() {
Context m_context = getInitialContext();
QueueConnectionFactory queueConnectionFactory = new JMSConnectionFactory();
try {
System.out.println("Connection Factory");
queueConnectionFactory = (QueueConnectionFactory) m_context
.lookup(configurationReader.getJndiConnectionFactory());
} catch (Exception e) {
System.err.println("Exception Connection Factory goes down");
}
return queueConnectionFactory;
}
2022-08-05 15:16:24.615 錯誤 56480 --- [ssageListener-5].besDefaultMessageListenerContainer: 無法從 DefaultMessageListener'queue:///' 刷新目的地的 JMS 連接 - 使用 FixedBackOff{interval=5000, currentAttempts= 52,最大嘗試=無限}。 原因:null
有沒有辦法讓這個 bean 使用監聽器注冊。
那是來自監聽器容器的錯誤,而不是連接工廠 bean 的注冊。
您應該能夠將容器設置為不自動啟動,使用
spring.jms.listener.auto-startup=false
然后您可以通過JmsListenerEndpointRegistry
bean 手動啟動它們(在 try 塊中)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.