PHP Classes

File: example/subscriber.php

Recommend this page to a friend!
  Classes of Jorge Castro  >  UsagiMQ  >  example/subscriber.php  >  Download  
File: example/subscriber.php
Role: Example script
Content type: text/plain
Description: Example script
Class: UsagiMQ
Manage message queues stored using Redis
Author: By
Last change:
Date: 1 year ago
Size: 708 bytes
 

Contents

Class file image Download
<?php
@set_time_limit(60*60); // 1 hour.
// its a local subscriber
include "../UsagiMQ.php";

$usa=new UsagiMQ("127.0.0.1",6379,1);
if (!
$usa->connected) {
    echo
"not connected";
    die(
1);
}

$listEnveloper=$usa->listPending("insert");

foreach(
$listEnveloper as $id) {
   
$env=$usa->readItem($id);
   
var_dump($env);
   
// todo: code goes here
   
$correct=true;

   
// $correct indicates if the operation was successful or not. For example, if the operation was to insert and the operation failed.
    // We also could decide to delete it for any case. Its up to us.
   
if ($correct) {
       
$usa->deleteItem($id); // YAY!
   
} else {
       
$usa->failedItem($id,$env); // booh hiss!.
   
}
}

For more information send a message to info at phpclasses dot org.