Azure driver for Enqueue https://github.com/php-enqueue
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Tests
bin
src
.gitignore
.travis.yml
LICENSE
LogoAssoConnect_bleu.png
README.md
composer.json
enqueue.yaml
phpunit.xml.dist

README.md

assoConnect logo

Azure Storage transport

Azure Storage transport is a messaging solution transport using Azure comptabile with Queue Interop

Build Status


Azure Storage transport

The transport uses Azure Storage as a message broker. It creates a collection (a queue or topic) there. It's a FIFO system (First In First Out).

Installation

  • With composer:
$ composer require assoconnect/enqueue-azure

Create context

<?php
use Enqueue\AzureStorage\AzureStorageConnectionFactory;

// connects to azure
$factory = new AzureStorageConnectionFactory('DefaultEndpointsProtocol=https;AccountName=<accountname>;AccountKey=<youraccountkey>');

$context = $factory->createContext();

Send message to topic

<?php
/** @var \Enqueue\AzureStorage\AzureStorageContext $context */

$fooTopic = $context->createTopic('aTopic');
$message = $context->createMessage('Hello world!');

$context->createProducer()->send($fooTopic, $message);

Send message to queue

<?php
/** @var \Enqueue\AzureStorage\AzureStorageContext $context */

$fooQueue = $context->createQueue('aQueue');
$message = $context->createMessage('Hello world!');

$context->createProducer()->send($fooQueue, $message);

Send expiration message

<?php
/** @var \Enqueue\AzureStorage\AzureStorageContext $context */
/** @var \Enqueue\AzureStorage\AzureStorageDestination $fooQueue */


$message = $context->createMessage('Hello world!');

$context->createProducer()
    ->setTimeToLive(60000) // 60 sec
    ->send($fooQueue, $message)
;

Consume message:

<?php
/** @var \Enqueue\AzureStorage\AzureStorageContext $context */

$fooQueue = $context->createQueue('aQueue');
$consumer = $context->createConsumer($fooQueue);

$message = $consumer->receiveNoWait();

// process a message

$consumer->acknowledge($message);
//$consumer->reject($message);

Delete queue (purge messages):

<?php
/** @var \Enqueue\AzureStorage\AzureStorageContext $context */

$fooQueue = $context->createQueue('aQueue');

$context->deleteQueue($fooQueue);

Delete topic (purge messages):

<?php
/** @var \Enqueue\AzureStorage\AzureStorageContext $context */

$fooTopic = $context->createTopic('aTopic');

$context->deleteTopic($fooTopic);

back to index