Katie Horn has submitted this change and it was merged.

Change subject: STOMP Selectors and Connection Sanity
......................................................................


STOMP Selectors and Connection Sanity

Two changes:
1) Selectors are actually implemented by the 'selector' header...
2) When we match a connection, we should not attempt to create the
   same one again...

Change-Id: I80d981c1b8bc9f34d348aec6e73239c094d44ece
---
M SmashPig/Core/DataStores/StompDataStore.php
1 file changed, 11 insertions(+), 3 deletions(-)

Approvals:
  Katie Horn: Verified; Looks good to me, approved



diff --git a/SmashPig/Core/DataStores/StompDataStore.php 
b/SmashPig/Core/DataStores/StompDataStore.php
index dfc59cf..79a8288 100644
--- a/SmashPig/Core/DataStores/StompDataStore.php
+++ b/SmashPig/Core/DataStores/StompDataStore.php
@@ -299,18 +299,26 @@
                        'ack' => 'client-individual',
                );
 
-               if ( $this->subscribed && ( ( $sType !== $type ) || ( $sId !== 
$id ) ) ) {
+               if ( $this->subscribed && ( ( $sType === $type ) || ( $sId === 
$id ) ) ) {
+                       // Same subscription; just return
+                       return;
+               } elseif ( $this->subscribed ) {
+                       // We need to create a new subscription; but we also 
have to delete the old one
                        $this->deleteSubscription();
                }
 
                $sType = $type;
                $sId = $id;
 
+               $selector = array();
                if ( $type ) {
-                       $properties[ 'php-message-class' ] = $type;
+                       $selector[] = "php-message-class='$type'";
                }
                if ( $id ) {
-                       $properties[ 'JMSCorrelationID' ] = $id;
+                       $selector[] = "JMSCorrelationID='$id'";
+               }
+               if ( $selector ) {
+                       $properties[ 'selector' ] = implode( ' AND ', $selector 
);
                }
 
                Logger::debug( "Attempting to STOMP subscribe to 
'{$this->queue_id}' on '{$this->uri}'", $properties );

-- 
To view, visit https://gerrit.wikimedia.org/r/67375
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I80d981c1b8bc9f34d348aec6e73239c094d44ece
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/PaymentsListeners
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to