Skip to content

Operating Symfony Messenger workers

development

Messenger can process messages synchronously or through a transport consumed by workers. An asynchronous transport requires an active, monitored consumer and a recovery process for failed messages.

What you need before you begin

Confirm the transport service and background-process capability are available on the plan. Identify the receiver names, production environment and appropriate worker account.

01 Operate Symfony Messenger workers

  1. Configure the transport and route the intended message classes to it. Keep credentials private and create the required transport resources through the approved deployment procedure.

  2. Send a test message with a harmless outcome. Verify which receiver contains it before starting a consumer.

  3. Run messenger:consume for the intended receiver under an approved supervisor, with time or memory limits that fit the account. Allow the supervisor to replace workers when they exit.

  4. Configure retry and failure transport behavior deliberately. Make handlers tolerate redelivery so an uncertain result does not create duplicate invoices, emails or external actions.

  5. During deployment, stop old consumers gracefully using the supported Messenger command and let the supervisor start the new release. Confirm workers do not remain attached to obsolete code.

Confirm the expected result

Check that a queued message completes, a controlled failure reaches the expected failure handling and the consumer returns after a restart. Monitor waiting time as well as process status.

Troubleshoot unexpected results

If the queue grows, compare the transport configuration and receiver name used by the sender and consumer. Investigate the message exception before mass retrying failed work.

A common question

Can I delete a failed message to fix the error?

Deleting it removes the pending work rather than completing it. Determine whether its action is still required and whether any external effect already occurred before retrying, correcting or discarding it.

Sources and further reading

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support

Powered by WHMCompleteSolution