我想在我的项目中使用Spring Cloud Bus来动态更新配置。 我们的环境中已经有Apache ActiveMQ。 是否有可能使用ActiveMQ而不是RabbitMQ作为经纪人? 它们都是一种AMQP服务器。
我在pom.xml中设置依赖关系,如下所示:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
它看起来像标准的AMQP启动器,不仅限于RabbitMQ。 但是,配置服务器启动时会出现以下错误日志:
org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:65)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:218)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:476)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:439)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1083)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:350)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:648)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:205)
... 7 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
... 9 common frames omitted
Caused by: com.rabbitmq.client.MalformedFrameException: AMQP protocol version mismatch; we are version 0-9-1, server sent signature 0,1,0,0
at com.rabbitmq.client.impl.Frame.protocolVersionMismatch(Frame.java:174)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:111)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:139)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:536)
... 1 common frames omitted
答案 0 :(得分:5)
是否有可能使用ActiveMQ而不是RabbitMQ作为经纪人?
据我所知,ActiveMQ仅提供AMQP 1.0,兔子客户端为0.9.1,所以答案是&#34; no&#34;。如果您为AMQP 1.0或JMS或ActiveMQ中的其他协议之一提供了spring-cloud-stream绑定器,那么您可以以这种方式使用它(在Spring Cloud的Brixton版本中)。虽然他们不是开箱即用的,所以你必须自己写一下。