Ich versuche, RabbitMQ mit https://github.com/php-amqplib/RabbitMqBundle und Symfony2 Framework zu implementieren.Oldsound Rabbitmq Bündel mehrere Verbraucher Konfiguration
Ich habe es geschafft, die Sache mit 1 Hersteller und 1 Verbraucher arbeiten, aber das Problem ist, wenn ich mehrere Verbraucher verwenden.
Dies ist meine Konfiguration:
old_sound_rabbit_mq:
connections:
default:
host: 'localhost'
port: 5672
user: 'guest'
password: 'guest'
vhost: '/'
lazy: false
connection_timeout: 3
read_write_timeout: 3
# requires php-amqplib v2.4.1+ and PHP5.4+
keepalive: false
# requires php-amqplib v2.4.1+
heartbeat: 0
#requires php_sockets.dll
# use_socket: true # default false
producers:
soccer_team_stat:
connection: default
exchange_options: {name: 'soccer_team_stat_ex', type: direct}
queue_options: {name: 'soccer_team_stat_qu'}
soccer_team_stat_form:
connection: default
exchange_options: {name: 'soccer_team_stat_ex', type: direct}
queue_options: {name: 'soccer_team_stat_form_qu'}
consumers:
soccer_team_stat:
connection: default
exchange_options: {name: 'soccer_team_stat_ex', type: direct}
queue_options: {name: 'soccer_team_stat_qu'}
callback: myapp.soccer_team_stat.consume
soccer_team_stat_form:
connection: default
exchange_options: {name: 'soccer_team_stat_ex', type: direct}
queue_options: {name: 'soccer_team_stat_form_qu'}
callback: myapp.soccer_team_stat_form.consume
Service-Definitionen:
<services>
<service class="MyApp\EtlBundle\Producers\SoccerTeamStatProducer" id="myapp.soccer_team_stat.produce">
<argument type="service" id="old_sound_rabbit_mq.soccer_team_stat_producer"/>
</service>
<service class="MyApp\EtlBundle\Producers\SoccerTeamStatProducer" id="myapp.soccer_team_stat_form.produce">
<argument type="service" id="old_sound_rabbit_mq.soccer_team_stat_producer"/>
</service>
<service class="MyApp\EtlBundle\Consumers\SoccerTeamStatConsumer" id="myapp.soccer_team_stat.consume">
<argument type="service" id="service_container"/>
</service>
<service class="MyApp\EtlBundle\Consumers\SoccerTeamStatFormConsumer" id="myapp.soccer_team_stat_form.consume">
<argument type="service" id="service_container"/>
</service>
</services>
Und auf PHP-app/console rabbitmq: Verbraucher -d i erhalten soccer_team_stat_form:
[Symfony \ Component \ DependencyInjection \ Exception \ ServiceNotFoundException] Sie haben einen nicht existenten Dienstangefordert"old_sound_rabbit_mq.soccer_team_stat_form_consumer".
Ich habe verschiedene Kombinationen versucht, einschließlich multiple_consumers Konfigurationsschlüssel, aber ohne Erfolg. Was ich vermisse?