我正在尝试使用消息交换将JSON消息推送到RabbitMQ队列。我已经通过一个Docker安装了RabbitMQ。
我已经使用以下代码创建并启动了一个Docker容器:
docker run -d --hostname myrabbit --name rabbit-assignment -e RABBITMQ_DEFAULT_VHOST=/ -p 15672:15672
rabbitmq:3-management
下面是我的application.properties
spring.rabbitmq.port = 15672
spring.rabbitmq.username = guest
spring.rabbitmq.password = guest
server.port = 9292
spring.rabbitmq.host=localhost
spring.rabbitmq.virtual-host=/
以下是错误:
2022-01-15 16:35:52.828 ERROR 44873 --- [nio-9292-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.amqp.AmqpIOException: java.io.IOException] with root cause
java.io.EOFException: null
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290) ~[na:1.8.0_181]
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.13.1.jar:5.13.1]
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:184) ~[amqp-client-5.13.1.jar:5.13.1]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:665) ~[amqp-client-5.13.1.jar:5.13.1]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
1条答案
按热度按时间guicsvcw1#
Spring.兔子mq.端口= 15672
您正在使用15672作为端口。这只是UI/admin端口。
应用程序要使用的端口是5672。
只要改变这一点,你就会继续前进。
BR,
A(~A)