我有其消耗来自RabbitMQ的消息的弹簧的应用程序。然而,春天服务器无法启动时的RabbitMQ服务器已关闭。
下面是例外,
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - vhost test_queue not found, class-id=10, method-id=40)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) ~[amqp-client-4.0.1.jar:4.0.1]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32) ~[amqp-client-4.0.1.jar:4.0.1]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366) ~[amqp-client-4.0.1.jar:4.0.1]
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229) ~[amqp-client-4.0.1.jar:4.0.1]
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117) ~[amqp-client-4.0.1.jar:4.0.1]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:381) ~[amqp-client-4.0.1.jar:4.0.1]
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:62) ~[amqp-client-4.0.1.jar:4.0.1]
有没有办法仍然有当没有队列发现Spring应用程序甚至开始?
Spring配置。
<rabbit:connection-factory id="connectionFactory" host="${host}" port="${port}" username="${rabbitmq.username}" password="${rabbitmq.password}" virtual-host="${rabbitmq.virtualhost}"/>
<rabbit:queue name="${rabbitmq.create.queue}" />
<rabbit:template queue="${rabbitmq.feedback.queue}"
exchange="${rabbitmq.feedback.exchange}" id="amqpTemplate"
connection-factory="connectionFactory" />
<bean id="xyzConsumerListener" class="com.sample.rabbitmq.listener.XyzConsumerListener">
</bean>
<rabbit:listener-container id="myListenerContainer" connection-factory="connectionFactory">
<rabbit:listener ref="xyzConsumerListener" queue-names="${rabbitmq.create.queue}"/>
</rabbit:listener-container>
问候,法尔汉
该错误消息说,它无法找到名为test_queue
的虚拟主机。
请检查虚拟主机存在,或使用/
为您的虚拟主机。
在这种特殊情况下,我不认为,如果虚拟主机没有找到该应用程序将启动。此外,如果你已经配置RMQ不允许直接创建队列与所提供的证书,也可以彻底失败,因为这是一种情况,它不能从恢复。