I can't connect to Rabbitmq server port 5672

23,274

Based on your comment

7c01193b2f74 projecttest_queue "docker-entrypoint..." 24 hours ago Up 5 hours 4369/tcp, 5671/tcp, 25672/tcp, 0.0.0.0:55672->5672/tcp, 0.0.0.0:32768->15672/tcp

The port that the project is listening on is 55672 - see 0.0.0.0:55672->5672/tcp

Therefore you need to update your php project to connect to localhost:55672 instead of just localhost:5672

Share:
23,274
tr.am
Author by

tr.am

Updated on February 10, 2020

Comments

  • tr.am
    tr.am over 4 years

    with this command

    php bin/console rabbitmq:consumer -w upload_picture
    

    I have this problem .

     [ErrorException]
    stream_socket_client(): unable to connect to tcp://localhost:5672 (Aucune
     connexion n'a pu etre établie car l'ordinateur cible lÆa expressÚment
     refusée.
    

    So I can't connect to server rabbitmq

    config.yml

    old_sound_rabbit_mq:
    connections:
        default:
            host:     'localhost' # hostname and port of the rabbitmq server
            port:     5672
            user:     'guest'
            password: 'guest'
            vhost:    '/'
            lazy:     true # a lazy connection avoids unnecessary connections to the broker on every request
            connection_timeout: 3
            read_write_timeout: 3
            keepalive: false
            heartbeat: 0
    producers:
        upload_picture:
            connection:       default # connects to the default connection configured above
            exchange_options: {name: 'upload_picture', type: direct}
    consumers:
        upload_picture:
            connection:       default # connects to the default connection configured above
            exchange_options: {name: 'upload_picture', type: direct}
            queue_options:    {name: 'upload_picture'}
            callback:         upload_picture_service # the UploadPictureConsumer defined below