Skip to content

Commit 5237ffe

Browse files
committed
ADD documentation
1 parent 3630bb2 commit 5237ffe

2 files changed

Lines changed: 90 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [1.0.0] - 2022-02-10
10+
### Added
11+
- **Symfony Messenger** transport for **Azure Service Bus** *queues* and *topics*
12+
13+
[Unreleased]: https://github.com/AymDev/MessengerAzureBundle/compare/v1.0.0...HEAD
14+
[1.0.0]: https://github.com/AymDev/MessengerAzureBundle/releases/tag/v1.0.0
15+

README.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,78 @@
11
# Messenger Azure Service Bus Bundle
22
A **Symfony 4 / 5 / 6** bundle providing a **Symfony Messenger** *transport* for **Azure Service Bus** using the *Azure REST API*.
33

4-
>This is a work in progress bundle.
4+
![Testing](https://github.com/AymDev/MessengerAzureBundle/workflows/Testing/badge.svg)
5+
![Coding Standards](https://github.com/AymDev/MessengerAzureBundle/workflows/Coding%20Standards/badge.svg)
6+
![Bundle installation](https://github.com/AymDev/MessengerAzureBundle/workflows/Bundle%20installation/badge.svg)
7+
[![Latest Stable Version](https://poser.pugx.org/aymdev/messenger-azure-bundle/v)](//packagist.org/packages/aymdev/messenger-azure-bundle)
8+
[![License](https://poser.pugx.org/aymdev/messenger-azure-bundle/license)](//packagist.org/packages/aymdev/messenger-azure-bundle)
9+
10+
## Installation
11+
12+
You only need to install the bundle using **Composer**:
13+
```shell
14+
composer require aymdev/messenger-azure-bundle
15+
```
16+
As it uses [Symfony HttpClient](https://symfony.com/doc/current/http_client.html),
17+
you will need to install a [PSR-18 client](https://symfony.com/doc/current/http_client.html#psr-18-and-psr-17).
18+
Example:
19+
```shell
20+
composer require nyholm/psr7
21+
```
22+
23+
## Configuration
24+
25+
### Transport DSN
26+
27+
Your DSN must respect the following format to build the authentication header for a specific *namespace*:
28+
```
29+
azure://KEY_NAME:KEY_VALUE@NAMESPACE
30+
```
31+
>Where `KEY_NAME` is your **shared access key name**, `KEY_VALUE` is your **shared access key** and `NAMESPACE` is your
32+
>*Azure Service Bus* **namespace**.
33+
34+
### Transport options
35+
36+
Detailed list of transport options:
37+
38+
| Option name | Description | Required | Default value |
39+
| ------------- | ------------- | ----: | ----: |
40+
| `entity_path` | The **topic** or **queue** name. | Yes | |
41+
| `subscription` | The subcription name to consume messages from a **topic**. | Only for *topic consumer transports* | |
42+
| `token_expiry` | [SAS token](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-sas#generate-a-shared-access-signature-token) validity duration in seconds. | | `3600` |
43+
| `receive_mode` | Set to `peek-lock` to perform a [non destructive read](https://docs.microsoft.com/en-us/rest/api/servicebus/peek-lock-message-non-destructive-read) or to `receive-and-delete` to perform a [destructive-read](https://docs.microsoft.com/en-us/rest/api/servicebus/receive-and-delete-message-destructive-read) | | `peek-lock` |
44+
45+
Example `config/packages/messenger.yaml`:
46+
```yaml
47+
framework:
48+
messenger:
49+
transports:
50+
azure_transport:
51+
dsn: '%env(AZURE_SERVICE_BUS_DSN)%'
52+
serializer: 'App\Messenger\YourAzureSerializer'
53+
options:
54+
entity_path: 'your-topic'
55+
subscription: 'subscription-name'
56+
token_expiry: 60
57+
receive_mode: 'receive-and-delete'
58+
```
59+
60+
## Stamps
61+
62+
This transport provides 2 stamps:
63+
64+
### AzureReceivedStamp
65+
66+
The `AymDev\MessengerAzureBundle\Messenger\Stamp\AzureReceivedStamp` stamp holds the original message body and an optional deletion URL.
67+
68+
### AzureBrokerPropertiesStamp
69+
70+
The `AymDev\MessengerAzureBundle\Messenger\Stamp\AzureBrokerPropertiesStamp` stamp is used for the [message properties](https://docs.microsoft.com/en-us/rest/api/servicebus/message-headers-and-properties).
71+
It is automatically decoded when consuming a message and is encoded when producing a message if added to the *envelope*.
72+
73+
## Serialization
74+
75+
There is no serializer provided, but here is the expected array structure of an encoded envelope:
76+
77+
- `body`: your plain text message
78+
- `headers`: optional HTTP headers (either received from *Azure Service Bus* response or to send to the REST API)

0 commit comments

Comments
 (0)