keboola/job-queue-internal-api-php-client
Composer 安装命令:
composer require keboola/job-queue-internal-api-php-client
包简介
Client for internal job queue API
README 文档
README
PHP client for the Internal Job Queue API (API docs).
Usage
composer require keboola/job-queue-internal-api-php-client
use Keboola\JobQueueInternalClient\Client; $storageClientFactory = new JobFactory\StorageClientFactory('http://connetion.keboola.com/'); $objectEncryptorFactory = new ObjectEncryptorFactory('key-id', 'us-east-1', '', ''); $jobFactory = new JobFactory($storageClientFactory, $objectEncryptorFactory); $client = new Client( new NullLogger(), $jobFactory, 'http://internal.queue.api/', 'testQueueToken' ); $client->getJobData('123'); $client->postJobResult('123', 'success', ['images' => ['digests' => []]]);
Atomic job result updates
patchJobResultAtomically() performs an optimistic-locking read-modify-write of a job's
result document. It reads the current result and its resultVersion, runs your mutator,
and writes it back guarded by that version. The versioned write merges the returned keys
into the current server-side result (the same array_merge semantics as the non-versioned
write), only made atomic by the version check. On a version conflict (HTTP 409, i.e. a
concurrent writer changed the result in between) it automatically re-reads and retries a
bounded number of times; if the conflict still cannot be resolved within the retry budget it
throws a ResultVersionConflictException rather than overwriting the concurrent change.
The mutator receives the current result array and must return a \JsonSerializable whose
jsonSerialize() yields an array. The returned keys are merged into the current result — it is
not a full replace, so keys you omit are preserved (you cannot delete a key this way):
use Keboola\JobQueueInternalClient\Result\GenericJobResult; $job = $client->patchJobResultAtomically('123', function (array $current): GenericJobResult { $current['processedRows'] = ($current['processedRows'] ?? 0) + 1; return new GenericJobResult($current); });
GenericJobResult is a trivial \JsonSerializable wrapper for callers that do not have their
own result value object.
Development
Prerequisites:
- configured
azandawsCLI tools (runaz loginandaws configure --profile keboola-dev-platform-services) - installed GCP CLI
gcloud(and rungcloud auth loginorgcloud auth application-default login) - installed
terraform(https://www.terraform.io) andjq(https://stedolan.github.io/jq) to setup local env - intalled
dockeranddocker composeto run & develop the app
TL;DR:
export NAME_PREFIX= # your name/nickname to make your resource unique & recognizable
cat <<EOF > ./provisioning/local/terraform.tfvars
name_prefix = "${NAME_PREFIX}"
EOF
cat <<EOF > .env.local
TEST_HOSTNAME_SUFFIX=keboola.com
TEST_STORAGE_API_URL=https://connection.keboola.com
TEST_STORAGE_API_TOKEN=
TEST_STORAGE_API_TOKEN_MASTER=
EOF
terraform -chdir=./provisioning/local init -backend-config="key=job-queue-internal-api-php-client/${NAME_PREFIX}.tfstate"
terraform -chdir=./provisioning/local apply
./provisioning/local/update-env.sh azure # or aws
License
MIT licensed, see LICENSE file.
keboola/job-queue-internal-api-php-client 适用场景与选型建议
keboola/job-queue-internal-api-php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.31k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 05 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「client」 「job」 「keboola」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 keboola/job-queue-internal-api-php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 keboola/job-queue-internal-api-php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 keboola/job-queue-internal-api-php-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
Provides a possibility to auto-setup crontabs required for project based on configuration file.
SlimQ Enables You to push jobs to background workers
A Laravel package to monitor queue jobs.
PHP client for Kue priority job queue API
A lightweight task queue on top of rybakit/phive-queue
统计信息
- 总下载量: 13.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-07