[rabbitmq-discuss] from zendJobQueue to RabbitMQ - Status Problem

Sascha Wojewsky sascha.wojewsky at gmail.com
Fri Mar 14 07:49:06 GMT 2014


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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140314/0c3262e4/attachment.html>


More information about the rabbitmq-discuss mailing list