Fix error: Class %old_sound_rabbit_mq.producer.class% does not exist from OldSoundRabbitMqExtension.php

huangapple go评论83阅读模式
英文:

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

问题出在配置中:

Fix error: Class %old_sound_rabbit_mq.producer.class% does not exist from OldSoundRabbitMqExtension.php

如果配置错误,我就不使用生产者,这会导致执行中断。

英文:

The problem was into the configuration:

Fix error: Class %old_sound_rabbit_mq.producer.class% does not exist from OldSoundRabbitMqExtension.php

how i don't use the producers, if you give wrong configuration broke the execution.

huangapple
  • 本文由 发表于 2023年5月22日 23:14:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76307614.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定