我想安裝使用Symfony2.2與RabbitMq bundle簡單AMQP發行商/消費者,我捆頁面錯誤時調用的命令行
出版商正常工作的文檔以下RabbitMQ的消費者,我可以看到我的信息在rabbitMq的網頁管理器上。 當我嘗試使用命令
php app/console rabbitmq:consumer my.api
我收到以下錯誤運行消費者:
Call to undefined method My\ApiBundle\Service\ConsumerService::setRoutingKey() in /***/vendor/oldsound/rabbitmq-bundle/OldSound/RabbitMqBundle/Command/BaseConsumerCommand.php on line 91
我的設置:
confi.yml
old_sound_rabbit_mq:
connections:
my.api:
host: %amqp_host%
port: %amqp_port%
user: %amqp_user%
password: %amqp_password%
vhost: %amqp_vhost%
producers:
my.api:
connection: my.api
exchange_options: {name: 'my.api', type: fanout}
consumers:
my.api:
connection: my.api
exchange_options: {name: 'my.api', type: fanout}
queue_options: {name: 'my.api'}
callback: my.api
My \ ApiBundle \服務\ ConsumerService.php
namespace My\ApiBundle\Service;
use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
class ConsumerService implements ConsumerInterface
{
public function execute(\PhpAmqpLib\Message\AMQPMessage $msg)
{
return false;
}
}
我\ ApiBundle \資源\ CONFIG \ services.xml的
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="old_sound_rabbit_mq.my.api_consumer" class="My\ApiBundle\Service\ConsumerService"></service>
</services>
</container>
我的問題是:什麼是錯我的配置或我的代碼?
也許我做錯了什麼,但是當我從配置中刪除服務定義,我得到錯誤「您已請求不存在服務」 – mmmm