factory() public static method

public static factory ( $type, $dsn )
Exemplo n.º 1
0
<?php

require '../../client/classes/autoload.php';
$storage = dropr_Client_Storage_Abstract::factory('filesystem', '/home/soenke/droprclientqueue');
$queue = new dropr_Client($storage);
$peer = dropr_Client_Peer_Abstract::getInstance('HttpUpload', 'http://soenkedroprserver/server/server.php');
$dt = time();
$i = 0;
$m = json_encode(array("ich bin eine test message von " . date("H:i:s"), 'wurstarrayarray'));
while ($i < 10000) {
    $msg = $queue->createMessage($m, $peer);
    $msg->queue();
    $i++;
    echo '.';
}
echo "\n";
Exemplo n.º 2
0
//syslog(LOG_DEBUG, "log level from command line is " . $argv[3]);
if (!isset($argv[3]) || !($logLevel = constant('LOG_' . $argv[3]))) {
    // use default (INFO)
    $logLevel = LOG_INFO;
}
/*
 * init logging - use syslog in daemon
 */
dropr::setLogger(new dropr_Log_Syslog());
dropr::setLogLevel($logLevel);
dropr::log("logLevel is {$logLevel}", LOG_DEBUG);
dropr::log("********************************************************************", LOG_INFO);
dropr::log("Starting up with que type {$argv['1']} and DSN {$argv['2']}", LOG_INFO);
dropr::log("********************************************************************", LOG_INFO);
try {
    $storage = dropr_Client_Storage_Abstract::factory($argv[1], $argv[2]);
    $qInstance = new dropr_Client($storage);
    $ipcChannel = $qInstance->getIpcChannel();
} catch (Exception $e) {
    dropr::log("Could not startup: {$e->getMessage()} - sleeping 5 seconds and then exiting ...", LOG_ERR);
    sleep(5);
    exit(1);
}
$continue = true;
dropr::log("Startup ok!", LOG_DEBUG);
// todo: make this configurable!!
$sleepTimeout = 20;
$peerTimeout = 60;
$maxMessagesPerLife = 10000;
$maxMessagesPerSend = 1000;
$peerKeyBlackList = array();
Exemplo n.º 3
0
 public function setUp()
 {
     require '../../classes/dropr.php';
     $this->storage = dropr_Client_Storage_Abstract::factory('filesystem', '/var/spool/dropr/client');
     $this->queue = new dropr_Client($this->storage);
 }
Exemplo n.º 4
0
 public function setUp()
 {
     require '../../classes/dropr.php';
     $this->storage = dropr_Client_Storage_Abstract::factory('filesystem', realpath('./clientqueue'));
     $this->queue = new dropr_Client($this->storage);
 }