]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make stomp queue manager work with basic servers
authorEugene Crosser <crosser@average.org>
Mon, 29 Mar 2010 11:25:57 +0000 (15:25 +0400)
committerBrion Vibber <brion@pobox.com>
Mon, 29 Mar 2010 22:31:43 +0000 (15:31 -0700)
Signed-off-by: Eugene Crosser <crosser@average.org>
README
lib/stompqueuemanager.php

diff --git a/README b/README
index c687cb240a57d616da317f1cbfc016fd0a460ec4..757cd7579eabb40154a6a8bd5aa1bc61559b4308 100644 (file)
--- a/README
+++ b/README
@@ -970,6 +970,12 @@ max_retries: for stomp, drop messages after N failed attempts to process.
 dead_letter_dir: for stomp, optional directory to dump data on failed
     queue processing events after discarding them.
 
+stomp_no_transactions: for stomp, the server does not support transactions,
+    so do not try to user them. This is needed for http://www.morbidq.com/.
+
+stomp_no_acks: for stomp, the server does not support acknowledgements.
+    so do not try to user them. This is needed for http://www.morbidq.com/.
+
 license
 -------
 
index 9af8b2f4826b24714f5f557af56d2a560681adcd..4d9f39791d74e8742624cb63c3f42de23c8bdb66 100644 (file)
@@ -39,7 +39,8 @@ class StompQueueManager extends QueueManager
     protected $base;
     protected $control;
 
-    protected $useTransactions = true;
+    protected $useTransactions;
+    protected $useAcks;
 
     protected $sites = array();
     protected $subscriptions = array();
@@ -64,6 +65,8 @@ class StompQueueManager extends QueueManager
         $this->base     = common_config('queue', 'queue_basename');
         $this->control  = common_config('queue', 'control_channel');
         $this->breakout = common_config('queue', 'breakout');
+        $this->useTransactions = !common_config('queue', 'stomp_no_transactions');
+        $this->useAcks = !common_config('queue', 'stomp_no_acks');
     }
 
     /**
@@ -703,13 +706,15 @@ class StompQueueManager extends QueueManager
 
     protected function ack($idx, $frame)
     {
-        if ($this->useTransactions) {
-            if (empty($this->transaction[$idx])) {
-                throw new Exception("Tried to ack but not in a transaction");
+        if ($this->useAcks) {
+            if ($this->useTransactions) {
+                if (empty($this->transaction[$idx])) {
+                    throw new Exception("Tried to ack but not in a transaction");
+                }
+                $this->cons[$idx]->ack($frame, $this->transaction[$idx]);
+            } else {
+                $this->cons[$idx]->ack($frame);
             }
-            $this->cons[$idx]->ack($frame, $this->transaction[$idx]);
-        } else {
-            $this->cons[$idx]->ack($frame);
         }
     }