3

I have enabled my custom modules for certain functionality, successfully deployed but magento2 admin portal prompts me "something went wrong" when I click my newly installed module.(the module is not working)

I headed to system.log and I found this, which are responsible to the error

> main.INFO: Consumer "async.operations.all" skipped as required
> connection "amqp" is not configured. Unknown connection name amqp []
> []

Update

I check (https://devdocs.magento.com/guides/v2.3/config-guide/mq/manage-message-queues.html) And I m required to add external MQ, thus I followed the guide by adding line below to my magentoroot/app/etc/env.php

>   'cron_consumers_runner' => array(
>         'cron_run' => false,
>         'max_messages' => 20000,
>         'consumers' => array(
>             'async.operations.all',
>         )
>     ),

I believe i need to somehow include this 'async.operations.all' as consumers.It displayed in my bin/magento consumer:list,yet it still not working ,what did I miss here?

tried re-upgrade ,compile & deploy with sudo chmod -777 on var/www/html and clearing cache.

Update On magentoroot/vendor/magento/module-webapi-async/etc/queue_consumer.xml

> <?xml version="1.0"?> <!-- /**  * Copyright © Magento, Inc. All rights
> reserved.  * See COPYING.txt for license details.  */
> --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
>     <consumer name="async.operations.all" queue="async.operations.all" connection="cron_consumers_runner"
>               consumerInstance="Magento\AsynchronousOperations\Model\MassConsumer"/>
> </config>

& queue_topology.xml

> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
>     <exchange name="magento" type="topic" connection="cron_consumers_runner">
>         <binding id="async.operations.all" topic="async.#" destinationType="queue" destination="async.operations.all"/>
>     </exchange> </config>

With both updated on connection with 'db' or 'cron_consumers_runner'.I do compile and clear cache, headed to the admin portal.S till the same (Attention, Something went wrong, module not working).

I head back to system.log, now there is no error anymore.

0

Check app/etc/env.php. You may be missing the connection configuration.

Add the following element to array in app/etc/env.php:

'queue' => [
    'amqp' => [
        'host' => 'localhost',
        'port' => '5672',
        'user' => 'guest',
        'password' => 'guest',
        'virtualhost' => '/',
        'ssl' => ''
    ]
]

This is just a sample code, you have to modify it according to your requirement.

UPDATE

There are two ways to configure Message Queues in Magento2.

One is using RabbitMQ, if you are using RabbitMQ, then you need to connect to the RabbitMQ server. Above code is for that connection.

Second is using Database and cron, if you are using this setup you need configuration as mentioned at https://devdocs.magento.com/guides/v2.3/config-guide/mq/manage-message-queues.html

UPDATE 2

Check if the connection name in XML files and env.php are same.

|improve this answer|||||
  • I m using CE version ,and what does this does?and do i need to include job name from my custom module's crontab.xml? – Ed Tan Apr 24 '19 at 5:12
  • @EdTan There are two ways to configure Message Queues in Magento2. One is using RabbitMQ, if you are using RabbitMQ, then you need to connect to the RabbitMQ server. Above code is for that connection. Second is using Database and cron, if you are using this setup you need configuration as mentioned at devdocs.magento.com/guides/v2.3/config-guide/mq/… – Anshu Mishra Apr 24 '19 at 5:40
  • would you help me with method 2? – Ed Tan Apr 24 '19 at 8:48
  • @EdTan share your xml files. – Anshu Mishra Apr 24 '19 at 9:59
  • updated ,check it out – Ed Tan Apr 24 '19 at 10:19
0

You need to create a variable in Magento Cloud to configure the RabbitMQ.

enter image description here

Login to Magento server and then run the command

php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));

This command will give you the details of all the services running in Magento Cloud with its credentials. Copy the username, password, and virtual host for RabbitMq and add those details.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.