dotmailer / dotmailer-magento2-extension

The official Dotdigital for Magento2 extension
https://dotdigital.com/integrations/magento
MIT License
48 stars 63 forks source link

Missing consumer connection declaration 'ddg.sync.queue' #614

Closed Epo123 closed 1 year ago

Epo123 commented 1 year ago

The code that was added between the following versions seems to have an oversight in it: https://github.com/dotmailer/dotmailer-magento2-extension/compare/v4.20.3...v4.21.2

We discovered this after releasing this to production, and we started receiving a lot of emails about failed crons. The error we saw was: "NOT_FOUND - no queue 'ddg.sync.queue' in vhost '/'"

After some investigation we noticed that in the file etc/queue_topology.xml you are declaring the connection to always use "db". However in the file etc/queue_consumer.xml you are not enforcing it which in Magento means you are leaving it up to the deployment configuration. In our configuration we are using AMQP, causing Magento to look for the queue in AMQP while it was never told to create the queue in AMQP.

Magento resource: https://developer.adobe.com/commerce/php/development/components/message-queues/configuration/#queue_consumerxml

I believe you need to either force both to use a specific connection or leave both over to deployment configuration.

FYI, for now adding 'connection="db"' to the consumer declared in queue_consumer.xml resolves the issue. But you may want to look into using AMQP for this instead of using the database for handling messages.

Please investigate this and let me know if anything is unclear.

pvpcookie commented 1 year ago

Hi @Epo123

Thanks for raising this, we will look into it and get back to you.

leoho150899 commented 1 year ago

Hi everyone, I have same issue. Please investigate and let me know if have any update

pvpcookie commented 1 year ago

Hi @leoho150899

Thanks for the confirmation 👍. We are still discussing this matter internally. I will update you as soon as we have more information.

pvpcookie commented 1 year ago

Hi @Epo123 and @leoho150899

We are planning a release within this week with a fix to remove the specific connection type, thank you again for pointing this out to us.

sta1r commented 1 year ago

Hello @Epo123 and @leoho150899

We have realised that in 2.3.x (we must support 2.3.7) it is required to specify a connection type in queue_topology.xml, see these 2.3.x docs. The 2.4.x docs indicate it's still required, but will be set dynamically using env.php if not specified.

If we omit this we get the following in setup:upgrade on fx 2.3.7:

Module 'Magento_AdvancedPricingImportExport':
Module 'Magento_Rule':
Module 'Magento_Customer':
Module 'Magento_Backend':
Module 'Magento_Amqp':
The XML in file "/Users/user/Sites/magento-cc-2.3.7/app/code/Dotdigitalgroup/Email/etc/queue_topology.xml" is invalid:
Element 'exchange': The attribute 'connection' is required but missing.
Line: 3

Verify the XML and try again.

I wanted to check - if we set it to connection="db" in queue_topology AND queue_consumer: a) presumably this works for you (per the comment above) even if it's not ideal? b) can you in theory override our queue definition to use your preferred amqp?

sta1r commented 1 year ago

We're going with connection="db" specified in both places. To be released next week.