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

Alvaro Videla videlalvaro at gmail.com
Fri Mar 14 09:48:03 GMT 2014


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
<sascha.wojewsky at gmail.com> 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
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


More information about the rabbitmq-discuss mailing list