alexandrubau/messenger-azure-queue-transport

Azure Storage Queue transport for Symfony's Messenger component.

v1.8.0 2024-10-13 10:00 UTC

README

Azure Queue transport for Symfony's Messenger component.

Travis (.org) Packagist Version Software License

Installation

The messenger-azure-queue-transport component requires PHP 7.3+ and Symfony 4.3+.

You can install this component using Symfony Flex:

composer require alexandrubau/messenger-azure-queue-transport

Basic usage

Set environment variable:

MESSENGER_TRANSPORT_DSN=azurequeue://<account_name>:<account_key>@default

In case your Account Name or Account Key contain special characters, you can use PHP's rawurlencode() function to encode them.

Set messenger transport config:

framework:
    messenger:
        transports:
            azure_queues:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    queue_name: <your_queue_name>
                    visibility_timeout: <visibility_timeout_in_seconds>
                    time_to_live: <time_to_live_in_seconds>
                    results_limit: <how_many_messages_to_read>

Options can be configured via the DSN or via the options key under the transport in messenger.yaml. Example:

MESSENGER_TRANSPORT_DSN=azurequeue://<account_name>:<account_key>@default?queue_name=<your_queue_name>&visibility_timeout=<visibility_timeout_in_seconds>&time_to_live=<time_to_live_in_seconds>&results_limit=<how_many_messages_to_read>

Don't forget to create the queue with the supplied name in Azure Queue Storage.

Further reading

  1. The Messenger Component
  2. Messenger: Sync & Queued Message Handling
  3. Azure Storage Queue
  4. Azure Storage Queue REST API