From faa14b64abb006422149562ba51e82820ed2aefa Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 29 Mar 2010 15:46:41 -0700 Subject: [PATCH] Tweak to Eugene Crosser's patch to make transactions and acks configurable; disabling them gets basic message delivery working under MorbidQ, and may help with RabbitMQ etc. I swapped the settings from negative to positive ($config['queue']['stomp_transactions'] = false rather than $config['queue']['stomp_no_transactions'] = true), gave them defaults (both on for best ActiveMQ experience), and added notes to the README about configuring them. --- README | 20 ++++++++++++++++++++ lib/default.php | 2 ++ lib/stompqueuemanager.php | 14 +++++++------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/README b/README index 757cd7579e..1e244c4482 100644 --- a/README +++ b/README @@ -942,6 +942,26 @@ stomp_password: password for connecting to the stomp server; defaults to null. stomp_persistent: keep items across queue server restart, if enabled. + Under ActiveMQ, the server configuration determines if and how + persistent storage is actually saved. + + If using a message queue server other than ActiveMQ, you may + need to disable this if it does not support persistence. + +stomp_transactions: use transactions to aid in error detection. + A broken transaction will be seen quickly, allowing a message + to be redelivered immediately if a daemon crashes. + + If using a message queue server other than ActiveMQ, you may + need to disable this if it does not support transactions. + +stomp_acks: send acknowledgements to aid in flow control. + An acknowledgement of successful processing tells the server + we're ready for more and can help keep things moving smoothly. + + This should *not* be turned off when running with ActiveMQ, but + if using another message queue server that does not support + acknowledgements you might need to disable this. softlimit: an absolute or relative "soft memory limit"; daemons will restart themselves gracefully when they find they've hit diff --git a/lib/default.php b/lib/default.php index 7b0d08e4ca..7d9a37174b 100644 --- a/lib/default.php +++ b/lib/default.php @@ -88,6 +88,8 @@ $default = 'stomp_username' => null, 'stomp_password' => null, 'stomp_persistent' => true, // keep items across queue server restart, if persistence is enabled + 'stomp_transactions' => true, // use STOMP transactions to aid in detecting failures (supported by ActiveMQ, but not by all) + 'stomp_acks' => true, // send acknowledgements after successful processing (supported by ActiveMQ, but not by all) 'stomp_manual_failover' => true, // if multiple servers are listed, treat them as separate (enqueue on one randomly, listen on all) 'monitor' => null, // URL to monitor ping endpoint (work in progress) 'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 4d9f39791d..5d5c7ccfbd 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -60,13 +60,13 @@ class StompQueueManager extends QueueManager } else { $this->servers = array($server); } - $this->username = common_config('queue', 'stomp_username'); - $this->password = common_config('queue', 'stomp_password'); - $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'); + $this->username = common_config('queue', 'stomp_username'); + $this->password = common_config('queue', 'stomp_password'); + $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_transactions'); + $this->useAcks = common_config('queue', 'stomp_acks'); } /**