Magento 2 CRON & MQ Setup
The PowerSync connector for Magento and Salesforce platforms enables merchants to synchronize data between both platforms based on a Schedule and in Real-Time.
Prerequisites
Run the following command in the Magento root using the console
bin/magento list |
and you should see a new console command
...
tnw_salesforce
tnw_salesforce:cron:run Runs Salesforce synchronization queues. |
If you see this command, you should be ready and can proceed.
Server Configuration
If you don’t know how to configure Magento CRON jobs, see the
https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/cli/configure-cron-jobs.html?lang=en
For Magento Commerce Cloud, see Magento 2 Commerce Cloud CRON Configuration.
Examples below assume your Magento root folder is var/www/html.
Example (for PowerSync connector version 2.7 and above)
This is the latest version of the PowerSync connector
### Process bulk requests from Salesforce
*/5 * * * * php -f /var/www/html/bin/magento tnw_salesforce:cron:run incoming -a >> /var/www/html/var/log/sforce-incoming.cron.log
## temporary data cleanup
* * * * * php -f /var/www/html/bin/magento tnw_salesforce:clean:queue >> /var/www/html/var/log/sforce-clean-queue.cron.log
*/5 * * * * php -f /var/www/html/bin/magento tnw_salesforce:clean_system_logs >> /var/www/html/var/log/sforce-clean_system_logs.cron.log |
IMPORTANT: You might need to also register the Magento queue listeners manually.
Follow the manage message queues documentation and add the following listeners to your /app/etc/env.php
file.
tnwSalesforceSyncRealtimeAmqp
tnwSalesforceSyncRealtimeDb
tnwSalesforcePrequeueProcessDb
tnwSalesforceQueueProcessBackgroundDb
tnwSalesforceQueueProcessNormalDb
tnwSalesforcePrequeueProcessAmqp
tnwSalesforceQueueProcessBackgroundAmqp
tnwSalesforceQueueProcessNormalAmqp
tnwSalesforceQueueProcessCheckNormalDb
tnwSalesforceQueueProcessCheckNormalAmqp
tnwSalesforceQueueProcessCheckBackgroundDb
tnwSalesforceQueueProcessCheckBackgroundAmqp
tnwSalesforceSyncQuoteDb
tnwSalesforceSyncQuoteAmqp
tnwCountryStateUpdateConsumerDb
tnwCountryStateUpdateConsumerAmqp
Example (for PowerSync connector version 2.6 or older)