public function start(ZendQueue $q) { $db = Loader::db(); $r = $db->Execute('select Users.uID from Users where uIsActive = 1 order by uID asc'); while ($row = $r->FetchRow()) { $q->send($row['uID']); } }
/** * Send a message to the queue * * @param \ZendQueueTest\Custom\Message|\ZendQueueTest\Custom\Messages $message message * @return $this * @throws Zend_Queue_Exception */ public function send($message) { if (!($message instanceof Message || $message instanceof Messages)) { throw new \ZendQueue\Exception('$message must be an instance of \\ZendQueueTest\\Custom\\Message or \\ZendQueueTest\\Custom\\Messages'); } if ($message instanceof Message) { $response = parent::send($message->__toString()); } else { foreach ($message as $i => $one) { $response = parent::send($one->__toString()); } } return $this; }
public function start(ZendQueue $q) { $this->is = new IndexedSearch(); $attributes = CollectionAttributeKey::getList(); $attributes = array_merge($attributes, FileAttributeKey::getList()); $attributes = array_merge($attributes, UserAttributeKey::getList()); foreach ($attributes as $ak) { $ak->updateSearchIndex(); } $db = Loader::db(); $db->Execute('truncate table PageSearchIndex'); $r = $db->Execute('select Pages.cID from Pages left join CollectionSearchIndexAttributes csia on Pages.cID = csia.cID where (ak_exclude_search_index is null or ak_exclude_search_index = 0) and cIsActive = 1'); while ($row = $r->FetchRow()) { $q->send($row['cID']); } }
public function testActivemqAdapterShouldReturnNoMessagesWhenZeroCountRequested() { if (!defined('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED') || !constant('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED')) { $this->markTestSkipped('Zend_Queue ActiveMQ adapter tests are not enabled'); } $driverOptions = array(); if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST')) { $driverOptions['host'] = TESTS_ZEND_QUEUE_ACTIVEMQ_HOST; } if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT')) { $driverOptions['port'] = TESTS_ZEND_QUEUE_ACTIVEMQ_PORT; } if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME')) { $driverOptions['scheme'] = TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME; } $options = array('driverOptions' => $driverOptions); $queue = new Queue('Activemq', $options); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); }