Reputation: 6238
I have a RabbitMQ container and a PHP 7 container with a Symfony 3.1.x project that executes a RabbitMQ consumer using the OldSoundRabbitMqBundle.
When running this command that executes the test
consumer:
bin/console rabbitmq:consumer -w test
I get the following error:
[PhpAmqpLib\Exception\AMQPIOException]
Error reading data. Received 0 instead of expected 7 bytes
My setup is very simple and I checked the following things:
host
, vhost
, user
, password
parameters are correctmbstring
extension is enabledIt's really easy to set up a project to reproduce the issue.
The sample project is available on GitHub and instructions are provided in the README file to reproduce the issue with just a few steps.
Here are some highlights:
docker-compose.yml
version: '2'
services:
php:
build: ./docker/php/
links:
- rabbitmq
volumes:
- ./src:/var/www/rabbitmq-test
working_dir: /var/www/rabbitmq-test
rabbitmq:
image: rabbitmq:3.6-management
config.yml
old_sound_rabbit_mq:
connections:
default:
host: 'rabbitmq'
port: 5672
user: 'guest'
password: 'guest'
vhost: '/'
lazy: false
# ...
producers:
# ...
consumers:
test:
connection: default
exchange_options: {name: 'test', type: direct}
queue_options: {name: 'test'}
callback: test_consumer
The test_consumer
service is a very simple class implementing the ConsumerInterface
interface.
Would someone have any idea concerning my problem?
Upvotes: 2
Views: 1663
Reputation: 6238
The answer was really straightforward. I had to change this in my config.yml
:
old_sound_rabbit_mq:
connections:
default:
# ...
use_socket: true
to:
old_sound_rabbit_mq:
connections:
default:
# ...
use_socket: false
Note that false
is the default value.
Upvotes: 3