Documentation
¶
Overview ¶
Package fixture provides the seeded Temporal workflows that tests run against a dev server.
Index ¶
- Constants
- func NewFulfillmentWorker(c client.Client, version int) worker.Worker
- func NewIncidentWorker(c client.Client) worker.Worker
- func NewRecoveryWorker(c client.Client) worker.Worker
- func NewStuckWorker(c client.Client) worker.Worker
- func NewWorker(c client.Client) worker.Worker
- func OrderWorkflow(ctx workflow.Context, order OrderInput) (map[string]string, error)
- func StartFailedOrder(ctx context.Context, c client.Client) (client.WorkflowRun, error)
- func StartFulfillment(ctx context.Context, c client.Client, id string, shippingBranch bool) (client.WorkflowRun, error)
- func StartLedgerEntry(ctx context.Context, c client.Client, id string, entry LedgerEntry) (client.WorkflowRun, error)
- func StartStuckLedger(ctx context.Context, c client.Client) error
- type LedgerEntry
- type OrderInput
Constants ¶
const ( // PaymentsTaskQueue is the task queue of the ProcessLedgerEntry activities for the payments domain. PaymentsTaskQueue = "ledger-payments" // RecoveryWorkerIdentity is the identity of the worker that NewRecoveryWorker returns. RecoveryWorkerIdentity = "recovery-worker" )
const ( // LedgerTaskQueue is the task queue of the stuck ledger workflows and their activities. LedgerTaskQueue = "ledger" // StuckWorkerIdentity is the identity of the worker that NewStuckWorker returns. StuckWorkerIdentity = "stuck-worker" // StuckLedgerWorkflowID is the ID of the stuck ledger workflow that starts three activities. StuckLedgerWorkflowID = "ledger-reconciliation-main" // StuckLedgerActivities is the number of activities that the stuck ledger workflows start together. StuckLedgerActivities = 7 )
const TaskQueue = "orders-demo"
TaskQueue is the task queue the order workflow runs on.
Variables ¶
This section is empty.
Functions ¶
func NewFulfillmentWorker ¶
NewFulfillmentWorker returns an unstarted worker that runs version 1 or 2 of FulfillmentWorkflow on fulfillmentTaskQueue, and no activities. Version 1 starts a PrepareShippingLabel activity on the shipping branch and then waits forever. Version 2 only waits, so once it runs, the next workflow task of a run that took the shipping branch, such as one for a deployment_probe signal, fails as nondeterministic.
func NewIncidentWorker ¶
NewIncidentWorker returns an unstarted worker that runs ledgerEntryWorkflow on incidentTaskQueue, and no activities: while no recovery worker runs, the incident goes on and no ProcessLedgerEntry activity starts.
func NewRecoveryWorker ¶
NewRecoveryWorker returns an unstarted worker, with identity RecoveryWorkerIdentity, that runs the ProcessLedgerEntry activities on PaymentsTaskQueue, which ends the incident for the payments domain. The first attempt of each fails with LedgerServiceUnavailable and the next succeeds; a terminal entry's fails with the non-retryable LedgerWriteRejected.
func NewStuckWorker ¶
NewStuckWorker returns an unstarted worker that polls LedgerTaskQueue for workflow tasks only, so no FetchLedgerBatch activity ever starts.
func NewWorker ¶
NewWorker returns an unstarted worker for TaskQueue with OrderWorkflow and its activities registered.
func OrderWorkflow ¶
OrderWorkflow authorizes payment for an order, then enriches its product from the catalog, making up to three attempts RetryIntervalSeconds apart.
func StartFailedOrder ¶
StartFailedOrder starts order 88231 as workflow order-88231 with OrderId 88231. Its catalog activity fails on all three attempts, so the workflow fails.
func StartFulfillment ¶
func StartFulfillment(ctx context.Context, c client.Client, id string, shippingBranch bool) (client.WorkflowRun, error)
StartFulfillment starts FulfillmentWorkflow as workflow id.
func StartLedgerEntry ¶
func StartLedgerEntry(ctx context.Context, c client.Client, id string, entry LedgerEntry) (client.WorkflowRun, error)
StartLedgerEntry starts ledgerEntryWorkflow for entry as workflow id, with search attribute Domain set to its domain.
Types ¶
type LedgerEntry ¶
LedgerEntry is the input of ledgerEntryWorkflow.
type OrderInput ¶
type OrderInput struct {
OrderID string `json:"order_id"`
CatalogShouldFail bool `json:"catalog_should_fail"`
RetryIntervalSeconds int `json:"retry_interval_seconds"`
}
OrderInput is the input of OrderWorkflow.