Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Messenger Azure Queue Transport Laravel Package

alexandrubau/messenger-azure-queue-transport

View on GitHub
Deep Wiki
Context7
## Getting Started
Install the package via Composer:
```bash
composer require alexandrubau/messenger-azure-queue-transport

Publish the configuration file (if needed):

php artisan vendor:publish --provider="AlexandruBau\MessengerAzureQueueTransport\AzureQueueTransportServiceProvider"

Register the Azure Queue transport in config/messenger.php:

'connections' => [
    'azure' => [
        'driver' => 'azure-queue',
        'connection' => 'azure',
        'queue' => env('AZURE_QUEUE_NAME'),
        'redelivery_enabled' => env('AZURE_REDELIVERY_ENABLED', true),
        // ... other config
    ],
],

First use case: Dispatch a job with Azure Queue transport:

dispatch(new YourJob)->onQueue('azure');

Implementation Patterns

Basic Job Dispatching

Use the Azure Queue transport for reliable job dispatching:

// Dispatch a job to Azure Queue
dispatch(new ProcessPayment)->onQueue('azure');

// Dispatch with delay (uses Azure Queue's visibility timeout)
dispatch(new ProcessPayment)->delay(now()->addMinutes(5))->onQueue('azure');

Redelivery Handling (New in v1.8.0)

Leverage the new RedeliveryStamp support for failed jobs:

// Configure redelivery in config/messenger.php
'connections' => [
    'azure' => [
        'driver' => 'azure-queue',
        'redelivery_enabled' => true,
        'redelivery_delay' => 60, // seconds
        'max_redeliveries' => 3,
    ],
],

// Jobs will automatically retry on failure with exponential backoff

Batch Processing

Process jobs in batches using Azure Queue's peek/dequeue operations:

// In a worker script or scheduled job
$jobs = app(\AlexandruBau\MessengerAzureQueueTransport\AzureQueue::class)
    ->getConnection()
    ->peekMessages(env('AZURE_QUEUE_NAME'), 10);

foreach ($jobs as $job) {
    try {
        $job->handle();
        $job->delete(); // Remove from queue after success
    } catch (\Exception $e) {
        $job->updateVisibility(300); // Make visible again after 5 mins
    }
}

Monitoring

Track job progress via Azure Portal or custom logging:

// Log job dispatch events
event(new JobDispatching($job));

Gotchas and Tips

RedeliveryStamp Support (v1.8.0)

  • New Feature: The package now supports Laravel's RedeliveryStamp for failed jobs, enabling automatic retry logic.
  • Configuration: Ensure redelivery_enabled is set to true in your connection config.
  • Behavior: Failed jobs will be automatically redelivered with exponential backoff (configurable via redelivery_delay and max_redeliveries).

Debugging Tips

  • Visibility Timeouts: If jobs disappear without processing, check Azure Queue's visibility timeout settings.
  • Logging: Enable debug logging for the Azure SDK:
    'azure' => [
        'driver' => 'azure-queue',
        'log_level' => \Microsoft\Azure\Storage\Blob\BlobRestProxy::LOG_LEVEL_BASIC,
    ],
    

Performance Considerations

  • Batch Processing: For high-throughput scenarios, process jobs in batches (e.g., 10-30 at a time) to optimize Azure Queue API calls.
  • Connection Pooling: Reuse the Azure Queue client connection where possible to avoid overhead.

Extension Points

  • Custom Retry Logic: Override the default redelivery behavior by extending the AzureQueue class and implementing custom retry logic in your job's handle() method.
  • Event Listeners: Listen for JobFailed events to implement custom failure handling:
    public function handle(JobFailed $event)
    {
        if ($event->connectionName === 'azure') {
            // Custom logic for Azure Queue failures
        }
    }
    

NO_UPDATE_NEEDED would not apply here due to the new `RedeliveryStamp` feature warranting an updated assessment.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime