Temporal統合
Temporal統合
Section titled “Temporal統合”WippyはTemporal.ioと統合し、耐久性のあるワークフロー実行、自動リプレイ、再起動を乗り越える長時間実行プロセスを提供します。
クライアント設定
Section titled “クライアント設定”temporal.clientエントリ種別はTemporalサーバーへの接続を定義します。
- name: temporal_client kind: temporal.client address: "localhost:7233" namespace: "default" lifecycle: auto_start: true必須フィールド
Section titled “必須フィールド”| フィールド | 説明 |
|---|---|
address | Temporalサーバーアドレス(host:port) |
オプションフィールド
Section titled “オプションフィールド”| フィールド | デフォルト | 説明 |
|---|---|---|
namespace | ”default” | Temporal名前空間 |
tq_prefix | "" | すべての操作のタスクキュー名プレフィックス |
connection_timeout | ”10s” | 接続タイムアウト |
keep_alive_time | ”30s” | Keep-alive間隔 |
keep_alive_timeout | ”10s” | Keep-aliveタイムアウト |
- name: temporal_client kind: temporal.client address: "localhost:7233" auth: type: noneAPIキー(Temporal Cloud)
Section titled “APIキー(Temporal Cloud)”以下のいずれかの方法でAPIキーを提供:
# 直接値- name: temporal_client kind: temporal.client address: "your-namespace.tmprl.cloud:7233" namespace: "your-namespace" auth: type: api_key api_key: "your-api-key"
# 環境変数から- name: temporal_client kind: temporal.client address: "your-namespace.tmprl.cloud:7233" namespace: "your-namespace" auth: type: api_key api_key_env: "TEMPORAL_API_KEY"
# ファイルから- name: temporal_client kind: temporal.client address: "your-namespace.tmprl.cloud:7233" namespace: "your-namespace" auth: type: api_key api_key_file: "/etc/secrets/temporal-api-key"_envで終わるフィールドはシステムで定義されている必要がある環境変数を参照します。環境ストレージと変数の設定については環境変数システムを参照してください。
- name: temporal_client kind: temporal.client address: "temporal.example.com:7233" namespace: "production" auth: type: mtls cert_file: "/path/to/client.pem" key_file: "/path/to/client.key" tls: enabled: true ca_file: "/path/to/ca.pem"証明書とキーはPEM文字列または環境変数からも提供できます:
auth: type: mtls cert_pem: | -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- key_pem_env: "TEMPORAL_CLIENT_KEY"tls: enabled: true ca_file: "/path/to/ca.pem" server_name: "temporal.example.com" # サーバー名検証をオーバーライド insecure_skip_verify: false # 検証をスキップ(開発のみ)ヘルスチェック
Section titled “ヘルスチェック”health_check: enabled: true interval: "30s"ワーカー設定
Section titled “ワーカー設定”temporal.workerエントリ種別はワークフローとアクティビティを実行するワーカーを定義します。
- name: worker kind: temporal.worker client: app:temporal_client task_queue: "my-app-queue" lifecycle: auto_start: true depends_on: - app:temporal_client必須フィールド
Section titled “必須フィールド”| フィールド | 説明 |
|---|---|
client | temporal.clientエントリへの参照 |
task_queue | タスクキュー名 |
ワーカーオプション
Section titled “ワーカーオプション”ワーカー動作を微調整:
- name: worker kind: temporal.worker client: app:temporal_client task_queue: "my-app-queue" worker_options: # 並行性 max_concurrent_activity_execution_size: 1000 max_concurrent_workflow_task_execution_size: 1000 max_concurrent_local_activity_execution_size: 1000 max_concurrent_session_execution_size: 1000
# ポーラー max_concurrent_activity_task_pollers: 20 max_concurrent_workflow_task_pollers: 20
# レート制限 worker_activities_per_second: 0 # 0 = 無制限 worker_local_activities_per_second: 0 task_queue_activities_per_second: 0
# タイムアウト sticky_schedule_to_start_timeout: "5s" worker_stop_timeout: "0s" deadlock_detection_timeout: "0s"
# 機能フラグ enable_logging_in_replay: false enable_session_worker: false disable_workflow_worker: false local_activity_worker_only: false disable_eager_activities: false
# バージョニング deployment_name: "" build_id: "" build_id_env: "BUILD_ID" # 環境変数から読み取り use_versioning: false default_versioning_behavior: "pinned" # または "auto_upgrade"_envで終わるフィールドは環境変数システムエントリで定義された環境変数を参照します。
バージョニング動作
Section titled “バージョニング動作”default_versioning_behaviorは、use_versioningが有効な場合に新しいワークフロー実行がワーカーのビルドIDを選ぶ方法を制御します:
| 値 | 動作 |
|---|---|
pinned | ワークフローは実行中、開始時のビルドIDに固定されます |
auto_upgrade | ワークフローは各タスク後に互換性のある最新のビルドIDで再開できます |
build_id_envは、build_idが空の場合に指定された環境変数からビルドIDを読み取ります。
セッションワーカー
Section titled “セッションワーカー”enable_session_worker: trueを設定すると、ワーカーはTemporalセッションを実行できます: これは単一のワーカーに固定された一連のアクティビティです(アクティビティが一時ディレクトリやオープン接続などのローカル状態を共有する場合に便利です)。max_concurrent_session_execution_sizeはワーカー上の同時セッション数を制限します。
並行性デフォルト
Section titled “並行性デフォルト”| オプション | デフォルト |
|---|---|
max_concurrent_activity_execution_size | 1000 |
max_concurrent_workflow_task_execution_size | 1000 |
max_concurrent_local_activity_execution_size | 1000 |
max_concurrent_session_execution_size | 1000 |
max_concurrent_activity_task_pollers | 20 |
max_concurrent_workflow_task_pollers | 20 |
sticky_schedule_to_start_timeout | 5s |
version: "1.0"namespace: app
entries: - name: temporal_client kind: temporal.client address: "localhost:7233" namespace: "default" lifecycle: auto_start: true
- name: worker kind: temporal.worker client: app:temporal_client task_queue: "orders" lifecycle: auto_start: true depends_on: - app:temporal_client
- name: order_workflow kind: workflow.lua source: file://order_workflow.lua method: main modules: - funcs - time meta: temporal: workflow: worker: app:worker
- name: charge_payment kind: function.lua source: file://payment.lua method: charge modules: - http_client - json meta: temporal: activity: worker: app:worker