英文:
Fix error: Class %old_sound_rabbit_mq.producer.class% does not exist from OldSoundRabbitMqExtension.php
问题
I'm here to help with the translation. Please let me know which specific parts you'd like me to translate.
英文:
I'm trying to execute symfony project with a rabbitmq plugin. The problem it's when i execute the command: php bin/console rabbitmq:consumer -m 50 activity-logs
. The response is:
OldSoundRabbitMqExtension.php line 677: Class %old_sound_rabbit_mq.producer.class% does not exist
I add the conexion info to services.yaml
old_sound_rabbit_mq:
connections:
default:
host: 'localhost'
port: 5672
user: 'user'
password: 'pass'
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
another:
# A different (unused) connection defined by an URL. One can omit all parts,
# except the scheme (amqp:). If both segment in the URL and a key value (see above)
# are given the value from the URL takes precedence.
# See https://www.rabbitmq.com/uri-spec.html on how to encode values.
url: 'amqp://guest:password@localhost:5672/vhost?lazy=1&connection_timeout=6'
producers:
upload_picture: #this are ignored by the moment, only want the consumers
connection: default
exchange_options: {name: 'upload-picture', type: direct}
service_alias: TestService # no alias by default
default_routing_key: 'optional.routing.key' # defaults to '' if not set
default_content_type: 'content/type' # defaults to 'text/plain'
default_delivery_mode: 2 # optional. 1 means non-persistent, 2 means persistent. Defaults to "2".
consumers: #here my consumers, that i really need
activty_log:
connection: default
exchange_options: {name: 'la.1.activity.activity_to_save', type: direct}
queue_options: {name: 'la.1.activity.activity_to_save'}
callback: TestService #activity_log_service
And i had a dummy service to recipe the callback:
<?php
// src/Service/MessageGenerator.php
namespace App\Service;
class TestService
{
public function __construct(
$entityManager,
$producer
) {
dd("hi constructor", $entityManager, $producer);
}
// ...
public function testFunct(){
dump("hello dummy!");
}
/*public function getConnectionParameters() {
return array('vhost' => $this->getVhost());
}*/
}
I know that when the command execute the read of rabbitMq and services recipe the info from the queue messages. But look like that the message is wrong.
I test to insert the messages into the queue manually to read it, but the bug it's the same.
Any ideas? What could be?
答案1
得分: 0
问题出在配置中:
如果配置错误,我就不使用生产者,这会导致执行中断。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论