如何在不使用 docker_compose.yml 的情况下在 symfony 5.2 上正确配置 RabbitMQ、messenger 和 amqp?

问题描述

我想使用 messenger 组件和 rabbitmq 以异步方法提交表单。提交此表格后,会向我发送一封电子邮件。但是当我实现rabbitmq时它不起作用。我肯定有配置问题。也许我必须在 services.yml 中添加一些东西?我不想使用 docker。

    transports:
        # https://symfony.com/doc/current/messenger.html#transport-configuration
        async : 
            dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
            options:
                auto_setup: false
                use_notify: true
                check_delayed_interval: 60000
        # Failed: 'doctrine://default?queue_name=Failed'
        # sync: 'sync://'

    routing:
        # Route your messages to the transports
        'App\Message\MailNotification': async

.env 文件与 amqp 因为我想使用 rabbitmq

MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages

当我提交表单时输出给我这个结果

Could not connect to the AMQP server. Please verify the provided DSN. ({"host":"localhost","port":5672,"vhost":"/","auto_setup":false,"use_notify":true,"check_delayed_interval":60000,"login":"guest","password":"********"}).

另外,Rabbitmq UI 出现在 webprofiler DOWN 上,不会变成 UP。我想不通。请帮帮我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)