ch1p/jobd-client

1.6.1 2023-10-08 01:47 UTC

This package is auto-updated.

Last update: 2024-09-08 03:49:12 UTC


README

这是一个简单的PHP客户端,用于jobd。它可以向jobdjobd-master实例发送请求并读取响应。

安装

composer require ch1p/jobd-client

使用方法

API紧凑简单,只需阅读WorkerClient.phpMasterClient.phpClient.php

以下是一个小示例。

try {
    $jobd = new jobd\MasterClient();
} catch (\jobd\exceptions\JobdException $e) {
    die("Failed to connect.\n");
}

try {
    // poke master to send poll requests to workers
    $response = $jobd->poke(['target_name', 'another_name']);
    
    // get status from master
    $status = $jobd->status()->getData();
} catch (\jobd\exceptions\JobdException $e) {
    die('jobd error: '.$e->getMessage()."\n");
}

$jobd->close();

许可证

BSD-2c