vanta/temporal-bundle
Composer 安装命令:
composer require vanta/temporal-bundle
包简介
Integration temporal with symfony
README 文档
README
Temporal is the simple, scalable open source way to write and run reliable cloud applications.
Features
- Sentry: Send throwable events (if the
SentryBundleuse) - Doctrine: clear opened managers and check connection is still usable after each request (
if
DoctrineBundleis use) - Serializer: Deserialize and serialize messages (if
Symfony/Serializeris use, Recommend use)
Requirements:
- php >= 8.2
- symfony >= 6.0
Installation:
- Connect recipes
composer config --json extra.symfony.endpoint '["https://raw.githubusercontent.com/VantaFinance/temporal-bundle/main/.recipie/index.json", "flex://defaults"]'
- Install package
composer req temporal serializer
-
Configure docker-compose-temporal.yml/Dockerfile
-
Added Workflow/Activity. See examples to get started.
Doctrine integrations
If DoctrineBundle is use, the following finalizer is available to you:
temporal.doctrine_ping_connection_<entity-mananger-name>.finalizertemporal.doctrine_clear_entity_manager.finalizer
And interceptors:
temporal.doctrine_ping_connection_<entity-mananger-name>_activity_inbound.interceptor
Example config:
temporal: defaultClient: default pool: dataConverter: temporal.data_converter roadrunnerRPC: '%env(RR_RPC)%' workers: default: taskQueue: default exceptionInterceptor: temporal.exception_interceptor finalizers: - temporal.doctrine_ping_connection_default.finalizer - temporal.doctrine_clear_entity_manager.finalizer interceptors: - temporal.doctrine_ping_connection_default_activity_inbound.interceptor clients: default: namespace: default address: '%env(TEMPORAL_ADDRESS)%' dataConverter: temporal.data_converter cloud: namespace: default address: '%env(TEMPORAL_ADDRESS)%' dataConverter: temporal.data_converter clientKey: '%env(TEMPORAL_CLIENT_KEY_PATH)%' clientPem: '%env(TEMPORAL_CLIENT_CERT_PATH)%'
Sentry integrations
Install packages:
composer require sentry temporal-sentry
If SentryBundle is use, the following interceptors is available to you:
temporal.sentry_workflow_outbound_calls.interceptortemporal.sentry_activity_inbound.interceptor
Example config:
temporal: defaultClient: default pool: dataConverter: temporal.data_converter roadrunnerRPC: '%env(RR_RPC)%' workers: default: taskQueue: default exceptionInterceptor: temporal.exception_interceptor interceptors: - temporal.sentry_workflow_outbound_calls.intercepto - temporal.sentry_activity_inbound.interceptor clients: default: namespace: default address: '%env(TEMPORAL_ADDRESS)%' dataConverter: temporal.data_converter
Worker Factory
By default the Temporal\WorkerFactory is used to instantiate the workers. However when you are unit-testing you
may wish to override the default factory with the one provided by the 'Testing framework'
Example Config:
temporal: defaultClient: default pool: dataConverter: temporal.data_converter roadrunnerRPC: '%env(RR_RPC)%' workers: default: taskQueue: default exceptionInterceptor: temporal.exception_interceptor interceptors: - temporal.sentry_workflow_outbound_calls.intercepto - temporal.sentry_activity_inbound.interceptor clients: default: namespace: default address: '%env(TEMPORAL_ADDRESS)%' dataConverter: temporal.data_converter when@test: temporal: workerFactory: Temporal\Testing\WorkerFactory
Assign worker
Running workflows and activities with different task queue
Add a AssignWorker attribute to your Workflow or Activity with the name of the
worker. This Workflow or Activity will be processed by the specified worker.
Workflow example:
<?php declare(strict_types=1); namespace App\Workflow; use Vanta\Integration\Symfony\Temporal\Attribute\AssignWorker; use Temporal\Workflow\WorkflowInterface; #[AssignWorker(name: 'worker1')] #[WorkflowInterface] final class MoneyTransferWorkflow { #[WorkflowMethod] public function transfer(...): \Generator; #[SignalMethod] function withdraw(): void; #[SignalMethod] function deposit(): void; }
Activity example:
<?php declare(strict_types=1); namespace App\Workflow; use Vanta\Integration\Symfony\Temporal\Attribute\AssignWorker; use Temporal\Activity\ActivityInterface; use Temporal\Activity\ActivityMethod; #[AssignWorker(name: 'worker1')] #[ActivityInterface(...)] final class MoneyTransferActivity { #[ActivityMethod] public function transfer(...): int; #[ActivityMethod] public function cancel(...): bool; }
TODO
- E2E test
- documentation
vanta/temporal-bundle 适用场景与选型建议
vanta/temporal-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 39.55k 次下载、GitHub Stars 达 73, 最近一次更新时间为 2023 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「bundle」 「temporal」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vanta/temporal-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vanta/temporal-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vanta/temporal-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
DMS Meetup API Bundle, enables Meetup API clients in services
Workflow Runtime in Symfony for Temporal
Integration temporal with doctrine
统计信息
- 总下载量: 39.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 73
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-18