sagacorp / yii2-queue-azure-service-bus
Yii2 Queue driver for Azure service bus
Installs: 51
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 1
Type:yii2-extension
Requires
- nesbot/carbon: ^2.0 | ^3.0
- yiisoft/yii2-httpclient: ^2.0
- yiisoft/yii2-queue: ^2.0
Requires (Dev)
- roave/security-advisories: dev-latest
README
This extension is a Yii2 Queue driver for queues based on Microsoft Azure Service Bus.
It uses the Azure Service Bus REST API
Installation
Install this extension with composer.
Either run
php composer.phar require --prefer-dist sagacorp/yii2-queue-azure-service-bus
or add the extension to your composer json.
"sagacorp/yii2-queue-azure-service-bus": "~1.0.0"
Basic Usage
First, you may configure your Azure service Bus.
Then, configure yii2 queue, and the service bus like the following:
return [ 'components' => [ 'queue' => [ 'class' => \saga\queue\azure\Queue::class, 'as log' => \yii\queue\LogBehavior, 'serializer' => \yii\queue\serializers\JsonSerializer::class, 'queue' => 'default', // Optional 'queues' => [ 'default' => [ // name of the 'queue' attribute 'class' => \saga\queue\azure\service\ServiceBus::class, 'serviceBusNamespace' => 'your service bus namespace', 'sharedAccessKey' => 'your shared access key to access the service bus queue', 'sharedAccessKeyName' => 'your shared access key name', 'queue' => 'the name of your Azure Service Bus queue (can be different than the name used as config key)', ], ], ], ], ];
Currently this extension supports the Shared Access Signature authentication only. It doesn't support Azure Active Directory.
Once configured, you can send a task into the queue:
Yii::$app->queue->push(new DownloadJob([ 'url' => 'http://example.com/image.jpg', 'file' => '/tmp/image.jpg', ]));