Hi, basic_get is used to get one message at a time, which makes it not optimal.
See the tutorial here on basic_consume: http://www.rabbitmq.com/tutorials/tutorial-two-php.html there you can read about message acknowledgments as well. Regards, Alvaro On Fri, Mar 14, 2014 at 8:49 AM, Sascha Wojewsky <[email protected]> wrote: > Hi, > > we've to switch from zendJobQueue to RabbitMQ (publish via php and consume > via python worker). > I've read the examples and everything looks good, but i've to check for > running jobs and i don't know how... > > In php I've a squence for jobs/messages: > $message = new \PhpAmqpLib\Message\AMQPMessage(json_encode(array( > 'id' => $jobID, > 'data' => $data, > ))); > $message->set('message_id', $jobID); > > To check for open messages I've this method: > private function getRabbitMQJobIsFinished($jobID) { > $result = true; > $connection = new \PhpAmqpLib\Connection\AMQPConnection(...); > $channel = $connection->channel(); > $messageData = $channel->basic_get(self::$queue, false); > while (!empty($messageData)) { > $messageID = $messageData->get('message_id'); > if ($messageID == $jobID){ > $result = false; > break; > } > $messageData = $channel->basic_get(self::$queue, false); > } > return $result; > } > > But this didn't work for unacknowledged/work in progress messages. > > Is ist possible to solve this problem with RabbitMQ? > > Thank you a lot for your help. > > > > _______________________________________________ > rabbitmq-discuss mailing list > [email protected] > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss > -- You received this message because you are subscribed to the Google Groups "rabbitmq-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rabbitmq-discuss. For more options, visit https://groups.google.com/d/optout.
