Skip to content

Commit b0606f8

Browse files
committed
UPGRADE to v2.0
Upgrade minimal PHP and Symfony versions and update code to use newer features. Remove deprecated stamp AzureReceivedStamp. Add upgrade guide.
1 parent 8f1103f commit b0606f8

24 files changed

Lines changed: 127 additions & 371 deletions

.github/workflows/installation.yaml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php: ['7.3', '7.4', '8.0', '8.1']
11-
symfony: ['4.4', '5.0', '5.1', '5.2', '5.3', '5.4', '6.0', '6.1']
10+
php: ['8.1', '8.2', '8.3']
11+
symfony: ['5.4', '6.4', '7.0']
1212
exclude:
13-
- php: '8.0'
14-
symfony: '5.0'
1513
- php: '8.1'
16-
symfony: '5.0'
17-
# see https://github.com/symfony/symfony/issues/44081
18-
- php: '8.1'
19-
symfony: '5.2'
20-
- php: '7.3'
21-
symfony: '6.0'
22-
- php: '7.4'
23-
symfony: '6.0'
24-
- php: '7.3'
25-
symfony: '6.1'
26-
- php: '7.4'
27-
symfony: '6.1'
28-
- php: '8.0'
29-
symfony: '6.1'
14+
symfony: '7.0'
3015

3116
steps:
3217
# Setup

.github/workflows/testing.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php: ['7.3', '7.4', '8.0', '8.1']
10+
php: ['8.1', '8.2', '8.3']
1111

1212
steps:
1313
# Setup

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.0.0] - 2024-02-14
10+
### Removed
11+
- removed deprecated stamp `AzureReceivedStamp`
12+
13+
### Changed
14+
- upgraded minimum supported version to **PHP 8.1** and **Symfony LTS** or **7**
15+
16+
### Added
17+
- documented side effect from **v1.5** with non encoded characters in the DSN
18+
919
## [1.5.0] - 2024-01-28
1020
### Added
1121
- Allowed transport configuration through DSN: [PR #14](https://github.com/AymDev/MessengerAzureBundle/pull/14)
@@ -46,7 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4656
### Added
4757
- **Symfony Messenger** transport for **Azure Service Bus** *queues* and *topics*
4858

49-
[Unreleased]: https://github.com/AymDev/MessengerAzureBundle/compare/v1.5.0...HEAD
59+
[Unreleased]: https://github.com/AymDev/MessengerAzureBundle/compare/v2.0.0...HEAD
60+
[2.0.0]: https://github.com/AymDev/MessengerAzureBundle/releases/tag/v2.0.0
5061
[1.5.0]: https://github.com/AymDev/MessengerAzureBundle/releases/tag/v1.5.0
5162
[1.4.0]: https://github.com/AymDev/MessengerAzureBundle/releases/tag/v1.4.0
5263
[1.3.1]: https://github.com/AymDev/MessengerAzureBundle/releases/tag/v1.3.1

README.md

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

44
![Testing](https://github.com/AymDev/MessengerAzureBundle/workflows/Testing/badge.svg)
55
![Coding Standards](https://github.com/AymDev/MessengerAzureBundle/workflows/Coding%20Standards/badge.svg)
@@ -30,6 +30,8 @@ azure://KEY_NAME:KEY_VALUE@NAMESPACE
3030
```
3131
>Where `KEY_NAME` is your **shared access key name**, `KEY_VALUE` is your **shared access key** and `NAMESPACE` is your
3232
>*Azure Service Bus* **namespace**.
33+
>**Important note:** the keys can contain special characters that could break the URL parsing. Be sure to URL encode
34+
>them.
3335
3436
### Transport options
3537

@@ -76,11 +78,6 @@ contains:
7678
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).
7779
It is automatically decoded when consuming a message and is encoded when producing a message if added to the *envelope*.
7880

79-
### AzureReceivedStamp
80-
81-
The `AymDev\MessengerAzureBundle\Messenger\Stamp\AzureReceivedStamp` stamp holds the original message body and an optional deletion URL.
82-
>This stamp is deprecated in favor of the AzureMessageStamp and will be removed in v2.
83-
8481
## Serialization
8582

8683
### Creating your serializers

UPGRADE-2.0.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# UPGRADE FROM 1.x to 2.0
2+
3+
## Versions support
4+
5+
The supported versions have been upgraded according to the current supported versions at the time of the release.
6+
7+
- The minimum **PHP** version supported has been upgraded from **7.3** to **8.1**.
8+
- **Symfony** versions supported are the supported LTS (**5.4** & **6.4**) and the current version **7**.
9+
10+
## AzureReceivedStamp removal
11+
12+
As documented, the `AzureReceivedStamp` was deprecated since **v1.1** and has been removed in **v2**. You should use
13+
`AzureMessageStamp` instead.
14+
15+
## DSN parsing change
16+
17+
A breaking change has been introduced involuntarily in **v1.5** by changing the way the DSN is parsed, causing errors
18+
for some non encoded characters in the keys.
19+
The side effect was not desired but the behaviour won't change.
20+
21+
You are now encouraged to URL encode your keys before putting them in the DSN:
22+
23+
- wrong: `azure://key/name:key+value@namespace`
24+
- correct: `azure://key%2Fname:key%2Bvalue@namespace`
25+
26+
>**Tip**: you can quickly URL encode a key from a single command: `php -r "echo urlencode('some/key');"`

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"description": "Symfony Messenger bundle for Azure Service Bus",
44
"type": "symfony-bundle",
55
"require": {
6-
"php": "^7.3|^8.0",
6+
"php": "^8.1",
77
"ext-json": "*",
8-
"symfony/messenger": "^4.4|^5.0|^6.0",
9-
"symfony/http-kernel": "^4.4|^5.0|^6.0",
10-
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
11-
"symfony/http-client": "^4.4|^5.0|^6.0"
8+
"symfony/messenger": "^5.4|^6.4|^7.0",
9+
"symfony/http-kernel": "^5.4|^6.4|^7.0",
10+
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
11+
"symfony/http-client": "^5.4|^6.4|^7.0"
1212
},
1313
"require-dev": {
1414
"squizlabs/php_codesniffer": "^3.6",
1515
"phpstan/phpstan": "^1.4",
16-
"symfony/phpunit-bridge": "^4.4|^5.0|^6.0",
16+
"symfony/phpunit-bridge": "^5.4|^6.4|^7.0",
1717
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
1818
"phpcompatibility/php-compatibility": "^9.3",
1919
"phpstan/extension-installer": "^1.1",

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<arg name="colors"/>
88
<arg name="extensions" value="php"/>
99

10-
<config name="testVersion" value="7.3-" />
10+
<config name="testVersion" value="8.1-" />
1111

1212
<rule ref="PSR12"/>
1313
<rule ref="PHPCompatibility"/>

src/Messenger/Exception/SerializerDecodingException.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
*/
1717
final class SerializerDecodingException extends MessageDecodingFailedException
1818
{
19-
/** @var Envelope */
20-
private $envelope;
19+
private Envelope $envelope;
2120

2221
/**
2322
* @param Envelope $envelope an envelope with an empty message

src/Messenger/Stamp/AzureBrokerPropertiesStamp.php

Lines changed: 16 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -14,88 +14,24 @@
1414
*/
1515
class AzureBrokerPropertiesStamp implements StampInterface
1616
{
17-
/** @var string|null */
18-
private $contentType;
19-
20-
/** @var string|null */
21-
private $correlationId;
22-
23-
/** @var string|null */
24-
private $sessionId;
25-
26-
/** @var int|null */
27-
private $deliveryCount;
28-
29-
/** @var \DateTimeInterface|null */
30-
private $lockedUntilUtc;
31-
32-
/** @var string|null*/
33-
private $lockToken;
34-
35-
/** @var string|null*/
36-
private $messageId;
37-
38-
/** @var string|null*/
39-
private $label;
40-
41-
/** @var string|null */
42-
private $replyTo;
43-
44-
/** @var \DateTimeInterface|null */
45-
private $enqueuedTimeUtc;
46-
47-
/** @var int|null */
48-
private $sequenceNumber;
49-
50-
/** @var int|null */
51-
private $timeToLive;
52-
53-
/** @var string|null */
54-
private $to;
55-
56-
/** @var \DateTimeInterface|null */
57-
private $scheduledEnqueueTimeUtc;
58-
59-
/** @var string|null */
60-
private $replyToSessionId;
61-
62-
/** @var string|null */
63-
private $partitionKey;
64-
6517
public function __construct(
66-
?string $contentType = null,
67-
?string $correlationId = null,
68-
?string $sessionId = null,
69-
?int $deliveryCount = null,
70-
?\DateTimeInterface $lockedUntilUtc = null,
71-
?string $lockToken = null,
72-
?string $messageId = null,
73-
?string $label = null,
74-
?string $replyTo = null,
75-
?\DateTimeInterface $enqueuedTimeUtc = null,
76-
?int $sequenceNumber = null,
77-
?int $timeToLive = null,
78-
?string $to = null,
79-
?\DateTimeInterface $scheduledEnqueueTimeUtc = null,
80-
?string $replyToSessionId = null,
81-
?string $partitionKey = null
18+
private ?string $contentType = null,
19+
private ?string $correlationId = null,
20+
private ?string $sessionId = null,
21+
private readonly ?int $deliveryCount = null,
22+
private readonly ?\DateTimeInterface $lockedUntilUtc = null,
23+
private readonly ?string $lockToken = null,
24+
private ?string $messageId = null,
25+
private ?string $label = null,
26+
private ?string $replyTo = null,
27+
private readonly ?\DateTimeInterface $enqueuedTimeUtc = null,
28+
private readonly ?int $sequenceNumber = null,
29+
private ?int $timeToLive = null,
30+
private ?string $to = null,
31+
private ?\DateTimeInterface $scheduledEnqueueTimeUtc = null,
32+
private ?string $replyToSessionId = null,
33+
private ?string $partitionKey = null
8234
) {
83-
$this->contentType = $contentType;
84-
$this->correlationId = $correlationId;
85-
$this->sessionId = $sessionId;
86-
$this->deliveryCount = $deliveryCount;
87-
$this->lockedUntilUtc = $lockedUntilUtc;
88-
$this->lockToken = $lockToken;
89-
$this->messageId = $messageId;
90-
$this->label = $label;
91-
$this->replyTo = $replyTo;
92-
$this->enqueuedTimeUtc = $enqueuedTimeUtc;
93-
$this->sequenceNumber = $sequenceNumber;
94-
$this->timeToLive = $timeToLive;
95-
$this->to = $to;
96-
$this->scheduledEnqueueTimeUtc = $scheduledEnqueueTimeUtc;
97-
$this->replyToSessionId = $replyToSessionId;
98-
$this->partitionKey = $partitionKey;
9935
}
10036

10137

src/Messenger/Stamp/AzureMessageStamp.php

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,17 @@
1414
*/
1515
class AzureMessageStamp implements StampInterface
1616
{
17-
/** @var string */
18-
private $entityPath;
19-
20-
/** @var string */
21-
private $message;
22-
23-
/** @var null|string */
24-
private $subscriptionName;
25-
26-
/** @var string|null */
27-
private $locationHeader;
28-
2917
/**
3018
* @internal
3119
* @param string $message the original message
3220
* @param string|null $locationHeader optional "Location" response header
3321
*/
3422
public function __construct(
35-
string $entityPath,
36-
string $message,
37-
?string $subscriptionName = null,
38-
?string $locationHeader = null
23+
private readonly string $entityPath,
24+
private readonly string $message,
25+
private readonly ?string $subscriptionName = null,
26+
private readonly ?string $locationHeader = null
3927
) {
40-
$this->entityPath = $entityPath;
41-
$this->message = $message;
42-
$this->subscriptionName = $subscriptionName;
43-
$this->locationHeader = $locationHeader;
4428
}
4529

4630
/**

0 commit comments

Comments
 (0)