Skip to content

#154 Add option to set the subscription id for durable subscriptions. - #151

Merged
jmglsn merged 12 commits into
stomp-php:masterfrom
MPParsley:patch-1
Jan 15, 2021
Merged

jmglsn merged 12 commits into
stomp-php:masterfrom
MPParsley:patch-1

Conversation

@MPParsley

@MPParsley MPParsley commented Dec 16, 2020 •

Copy link
Copy Markdown
Contributor

To create a durable subscription the client-id header must be set on the CONNECT frame and the durable-subscription-name must be set on the SUBSCRIBE frame. The combination of these two headers will form the identity of the durable subscription.

Aside from durable-subscription-name, the broker also supports durable-subscriber-name (a deprecated property used before durable-subscription-name) as well as activemq.subscriptionName from ActiveMQ 5.x. This is the order of precedence if the frame contains more than one of these:

  1. durable-subscriber-name 2) durable-subscription-name 3) activemq.subscriptionName

Source https://activemq.apache.org/components/artemis/documentation/2.7.0/stomp.html#durable-subscriptions

Note: for AMQ 5.6 the client-id should be identical to the subscriptionName. This is no longer valid for Artemis.
https://stackoverflow.com/questions/13137557/activemq-durable-consumer-is-in-use-for-client-and-subscriptionname-via-stomp/13146955#13146955

So instead of sending the activemq.subscriptionName header with the client-id in the SUBSCRIBE frame, we should send the durable-subscription-name header for Artemis.

The code in the PR adds support for backwards compatibility.

To create a durable subscription the client-id header must be set on the CONNECT frame and the durable-subscription-name must be set on the SUBSCRIBE frame. The combination of these two headers will form the identity of the durable subscription.

Source https://activemq.apache.org/components/artemis/documentation/2.7.0/stomp.html#durable-subscriptions

So instead of sending the client-id in the SUBSCRIBE frame, we should send the subscription id.
@MPParsley MPParsley changed the title Fix activemq.subscriptionName Add option to set the subscription id for durable subscriptions. Dec 16, 2020
Run phpunit with XDEBUG_MODE=coverage 

Some constants are only available in certain modes in Xdebug 3. This is fixed in the latest Xdebug release but not yet available in the version used by Travis. Also, it won't hurt to run xdebug in coverage mode.

See: xdebug/xdebug#699
Comment thread src/Broker/ActiveMq/ActiveMq.php Resolved
Comment thread src/Broker/ActiveMq/ActiveMq.php Resolved
@MPParsley MPParsley changed the title Add option to set the subscription id for durable subscriptions. #154 Add option to set the subscription id for durable subscriptions. Dec 17, 2020
Comment thread src/Broker/ActiveMq/ActiveMq.php Resolved
Comment thread src/Broker/ActiveMq/ActiveMq.php Resolved
durable-subscription-name is deprecated
@jmglsn
jmglsn merged commit 452ee23 into stomp-php:master Jan 15, 2021
@jmglsn

jmglsn commented Jan 15, 2021

Copy link
Copy Markdown
Member

@MPParsley Thank you for the PR, I'm sorry for that huge delay.

@MPParsley
MPParsley deleted the patch-1 branch January 16, 2021 07:03
@MPParsley

Copy link
Copy Markdown
Contributor Author

No problem, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants