Back to godoc.org

Package worker

v0.9.3
Latest Go to latest

The latest major version is .

Published: Oct 8, 2019 | License: MIT | Module: github.com/digitalocean/cadence-client

Overview

Package worker contains functions to manage lifecycle of a Cadence client side worker.

Index

Constants

const (
	// NonDeterministicWorkflowPolicyBlockWorkflow is the default policy for handling detected non-determinism.
	// This option simply logs to console with an error message that non-determinism is detected, but
	// does *NOT* reply anything back to the server.
	// It is chosen as default for backward compatibility reasons because it preserves the old behavior
	// for handling non-determinism that we had before NonDeterministicWorkflowPolicy type was added to
	// allow more configurability.
	NonDeterministicWorkflowPolicyBlockWorkflow = internal.NonDeterministicWorkflowPolicyBlockWorkflow
	// NonDeterministicWorkflowPolicyFailWorkflow behaves exactly the same as Ignore, up until the very
	// end of processing a decision task.
	// Whereas default does *NOT* reply anything back to the server, fail workflow replies back with a request
	// to fail the workflow execution.
	NonDeterministicWorkflowPolicyFailWorkflow = internal.NonDeterministicWorkflowPolicyFailWorkflow
)

func EnableVerboseLogging

func EnableVerboseLogging(enable bool)

EnableVerboseLogging enable or disable verbose logging of internal Cadence library components. Most customers don't need this feature, unless advised by the Cadence team member. Also there is no guarantee that this API is not going to change.

func ReplayPartialWorkflowHistoryFromJSONFile

func ReplayPartialWorkflowHistoryFromJSONFile(logger *zap.Logger, jsonfileName string, lastEventID int64) error

ReplayPartialWorkflowHistoryFromJSONFile executes a single decision task for the json history file upto provided // lastEventID(inclusive), downloaded from the cli. To download the history file: cadence workflow showid <workflow_id> -of <output_filename> See https://github.com/uber/cadence/blob/master/tools/cli/README.md for full documentation Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger. The logger is an optional parameter. Defaults to the noop logger.

func ReplayWorkflowExecution

func ReplayWorkflowExecution(ctx context.Context, service workflowserviceclient.Interface, logger *zap.Logger, domain string, execution workflow.Execution) error

ReplayWorkflowExecution loads a workflow execution history from the Cadence service and executes a single decision task for it. Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger. The logger is the only optional parameter. Defaults to the noop logger.

func ReplayWorkflowHistory

func ReplayWorkflowHistory(logger *zap.Logger, history *shared.History) error

ReplayWorkflowHistory executes a single decision task for the given json history file. Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger. The logger is an optional parameter. Defaults to the noop logger.

func ReplayWorkflowHistoryFromJSONFile

func ReplayWorkflowHistoryFromJSONFile(logger *zap.Logger, jsonfileName string) error

ReplayWorkflowHistoryFromJSONFile executes a single decision task for the json history file downloaded from the cli. To download the history file: cadence workflow showid <workflow_id> -of <output_filename> See https://github.com/uber/cadence/blob/master/tools/cli/README.md for full documentation Use for testing the backwards compatibility of code changes and troubleshooting workflows in a debugger. The logger is an optional parameter. Defaults to the noop logger.

func SetStickyWorkflowCacheSize

func SetStickyWorkflowCacheSize(cacheSize int)

SetStickyWorkflowCacheSize sets the cache size for sticky workflow cache. Sticky workflow execution is the affinity between decision tasks of a specific workflow execution to a specific worker. The affinity is set if sticky execution is enabled via Worker.Options (It is enabled by default unless disabled explicitly). The benefit of sticky execution is that workflow does not have to reconstruct the state by replaying from beginning of history events. But the cost is it consumes more memory as it rely on caching workflow execution's running state on the worker. The cache is shared between workers running within same process. This must be called before any worker is started. If not called, the default size of 10K (might change in future) will be used.

type NonDeterministicWorkflowPolicy

type NonDeterministicWorkflowPolicy = internal.NonDeterministicWorkflowPolicy

NonDeterministicWorkflowPolicy is an enum for configuring how client's decision task handler deals with mismatched history events (presumably arising from non-deterministic workflow definitions).

type Options

type Options = internal.WorkerOptions

Options is used to configure a worker instance.

type Worker

type Worker = internal.Worker

Worker represents objects that can be started and stopped.

func New

func New(
	service workflowserviceclient.Interface,
	domain string,
	taskList string,
	options Options,
) Worker

New creates an instance of worker for managing workflow and activity executions.

service  - thrift connection to the cadence server
domain   - the name of the cadence domain
taskList - is the task list name you use to identify your client worker, also
           identifies group of workflow and activity implementations that are
           hosted by a single worker process
options  - configure any worker specific options like logger, metrics, identity

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier