Allen
Allen

Reputation: 1

Cannot send stream messages to rabbitmq which in docker

I have a rabbitmq container in docker and another service to send stream type messages to it. But it is only ok when the service is outside the docker, if I build the service as a container run in docker,and send stream messages, It always shows "System.Net.Sockets.SocketException (111): Connection refused ". But if you send a message of classic type, it's a success.

   rabbitmq:
    container_name: rabbitmq
    image: rabbitmq:3-management
    environment:
       RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: -rabbitmq_stream advertised_host localhost
       RABBITMQ_DEFAULT_USER:"admin"
       RABBITMQ_DEFAULT_PASS:"admin"
       RABBITMQ_DEFAULT_VHOST:"application"
    ports:
        - 5672:5672
        - 5552:5552
        - 15672:15672
    volumes:
        - ./conf/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
        - ./conf/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
    healthcheck:
        test: rabbitmq-diagnostics -q ping
        interval: 15s
        timeout: 15s
        retries: 5
    env_file: 
        - ./.local.env

./conf/rabbitmq/rabbitmq.conf

enter code herestream.listeners.tcp.1 = 5552
stream.tcp_listen_options.backlog = 4096
stream.tcp_listen_options.recbuf  = 131072
stream.tcp_listen_options.sndbuf  = 131072
stream.tcp_listen_options.keepalive = true
stream.tcp_listen_options.nodelay   = true
stream.tcp_listen_options.exit_on_close = true
stream.tcp_listen_options.send_timeout  = 120

./conf/rabbitmq/enabled_plugins

[rabbitmq_management,rabbitmq_prometheus,rabbitmq_stream,rabbitmq_stream_management].

another service configures in docker:

# RabbitMQ                                                                                             
 Host = "host.docker.internal",                                                                                        
VirtualHost = "application",                                                                                        
Port= 5672,                                                                                       
StreamPort = 5552,
User= "admin",                                                                                       
Password = "admin",                                                                                        
UseSSL = false

Upvotes: 0

Views: 774

Answers (0)

Related Questions