summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-05-21 14:07:59 -0700
committerBrion Vibber <brion@pobox.com>2010-05-21 14:07:59 -0700
commit206229875511d24a97a0aac79605f6868d21ee7f (patch)
treee61c1bdb56d7b63169e1a8febdaf9d97ad14178f
parentcbf2e7cfea6c4360f9cc9037b242f2508964ccac (diff)
Add $config['queue']['stomp_enqueue_to'] override for which queue server to send to.
Must be set to a value that matches one of the entries in $config['queue']['stomp_server'] array, otherwise ignored.
-rw-r--r--lib/stompqueuemanager.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php
index 5d5c7ccfb..de4ba7f01 100644
--- a/lib/stompqueuemanager.php
+++ b/lib/stompqueuemanager.php
@@ -122,7 +122,19 @@ class StompQueueManager extends QueueManager
public function enqueue($object, $queue)
{
$this->_connect();
- return $this->_doEnqueue($object, $queue, $this->defaultIdx);
+ if (common_config('queue', 'stomp_enqueue_on')) {
+ // We're trying to force all writes to a single server.
+ // WARNING: this might do odd things if that server connection dies.
+ $idx = array_search(common_config('queue', 'stomp_enqueue_on'),
+ $this->servers);
+ if ($idx === false) {
+ common_log(LOG_ERR, 'queue stomp_enqueue_on setting does not match our server list.');
+ $idx = $this->defaultIdx;
+ }
+ } else {
+ $idx = $this->defaultIdx;
+ }
+ return $this->_doEnqueue($object, $queue, $idx);
}
/**