activities

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: LGPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

Package activities provides BPMN activity implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCompensationPlacement added in v0.10.0

func ValidateCompensationPlacement(nodes []flow.Node) error

ValidateCompensationPlacement rejects an isForCompensation activity wired into normal sequence flow (SRD-059 FR-2, ADR-026 §2.3): a compensation handler lives outside the normal flow — it is reachable only through its boundary's handler link and runs only when compensation is thrown. Called by the container Validate hooks (Process and SubProcess), fail-fast at registration.

func ValidateResourceRoles added in v0.11.0

func ValidateResourceRoles(
	nodes []flow.Node,
	ownRoles []*hi.ResourceRole,
) error

ValidateResourceRoles rejects an authorizing-kind role that names its people through a directory query (ADR-020 v.3 §2.5.4, SRD-075 FR-5).

Resolving a resourceRef needs an Organizational Directory (BPMN §8.4.12 Resources) that the engine does not provide, so such a role could only be carried and ignored — declared authorization that authorizes nobody. It is refused at registration instead, on the same principle as the value-less item-aware element (SAD-001 §14.1): a declaration the engine can never satisfy is refused at build time rather than admitted and silently ignored at run time.

Declarative kinds are not checked. A bare ResourceRole or a Performer grants nothing whether or not it resolves, so a directory-held resource named there is a conformant annotation — Table 10.3 describes exactly that use.

nodes are the container's flow nodes; ownRoles are the roles declared on the container itself. A Sub-Process passes nil for ownRoles, because its own roles are checked by the parent that holds it as a node — otherwise one role would be reported twice.

func WithMultyInstance

func WithMultyInstance() options.Option

WithMultyInstance sets multyinstance flag of the Task.

Types

type ActivityOption added in v0.1.1

type ActivityOption func(cfg *activityConfig) error

ActivityOption represents an activity configuration option.

func WithCompensation

func WithCompensation() ActivityOption

WithCompensation sets isForCompensation Activity flag to true.

func WithCompletionQuantity

func WithCompletionQuantity(qty int) ActivityOption

WithCompletionQuantity sets Activity completion token number quantity.

func WithIncidentRetryPolicy added in v0.12.0

func WithIncidentRetryPolicy(p tasks.RetryPolicy) ActivityOption

WithIncidentRetryPolicy sets the activity's incident retry policy (ADR-036 §2.3, SRD-079 §3.5): after an unhandled failure of this activity opens an incident, the policy decides whether — and after what backoff — the engine re-enters the node on its own before an operator is needed. Without it (and without an engine-wide default) every incident waits for an operator.

func WithLoop

WithLoop attaches loop/multi-instance characteristics to the Activity, making it iterate (ADR-025). Build the characteristics with NewStandardLoop (or, when it lands, the Multi-Instance constructor). An activity holds a single marker — a later WithLoop replaces an earlier one.

func WithParameters added in v0.1.1

func WithParameters(
	d data.Direction,
	params ...*data.Parameter,
) ActivityOption

WithParameters declares the activity's input or output parameters for the given direction (ADR-011 v.2: the single input/output set is the parameter list; per-parameter optional/whileExecuting flags carry the role). Parameters already present (by id) for the direction are skipped. May be called more than once per direction; the lists accumulate.

Parameters:

  • d -- the parameters' direction
  • params -- the parameters to add (each pre-flagged via data.Optional() / data.WhileExecuting() at construction)

func WithStartQuantity

func WithStartQuantity(qty int) ActivityOption

WithStartQuantity sets start quantity token number for the acitvity.

func WithoutParams

func WithoutParams() ActivityOption

WithoutParams indicates that the Activity has neither incoming nor outgoing parameters and ignores any WithParameters options. It creates an IOSpec with empty input and output parameter lists.

func (ActivityOption) Option added in v0.9.0

func (ActivityOption) Option()

Option marks ActivityOption as an options.Option; newActivity applies it by calling the func directly after its type-switch matches.

type AdHocOrdering added in v0.10.0

type AdHocOrdering string

AdHocOrdering constrains how many inner activities of an Ad-Hoc Sub-Process may be live at once (BPMN §13.3.5 `ordering`).

const (
	// AdHocParallel lets another activity be selected at any time, including a
	// second instance of one already running. It is gobpm's default: the
	// metamodel declares none, and parallel is the less restrictive mode
	// (ADR-035 v.1 §2.5, a registered engine choice).
	AdHocParallel AdHocOrdering = "PARALLEL"

	// AdHocSequential permits at most one live inner activity: another may be
	// selected only after the previous one terminates. A Router answering with
	// more than one successor under this ordering is a modeling error, reported
	// rather than truncated to the first.
	AdHocSequential AdHocOrdering = "SEQUENTIAL"
)

type AdHocSpec added in v0.10.0

type AdHocSpec interface {
	// Router answers which inner activities may run next; an empty answer ends
	// the ad-hoc work.
	Router() adhoc.Router

	// Ordering reports whether one inner activity may be live at a time or many.
	Ordering() AdHocOrdering

	// IsManual reports whether the Router's answer is offered for selection
	// (true) or run directly (false).
	IsManual() bool

	// CancelsRemaining reports what happens to activities still running when
	// routing stops: cancel them (true, the BPMN default) or wait for them.
	CancelsRemaining() bool

	// CompletionCondition is BPMN's completionCondition, or nil when the
	// container ends only on an empty Router answer.
	CompletionCondition() data.FormalExpression
}

AdHocSpec is the routing configuration of an Ad-Hoc Sub-Process, read by the runtime through SubProcess.AdHoc. It is an interface so the configuration stays immutable once the container is built: a modeler sets it with the WithAdHoc* options, and the engine only reads it.

type Authorizer added in v0.9.0

type Authorizer interface {
	Authorize(
		ctx context.Context,
		actor hi.Actor,
		src data.Source,
		eng expression.Engine,
	) error
}

Authorizer decides whether an Actor may act on a task by resolving the task's assignment triad against the runtime data and checking membership. It is implemented by UserTask and called at BOTH Take and Complete (ADR-020 §2.4).

type BusinessRuleTask

type BusinessRuleTask struct {
	// contains filtered or unexported fields
}

BusinessRuleTask is a BPMN business rule task (§13.3.3): on activation it calls the decision named by its decision reference on the configured Business Rule Engine and completes on the call's return, committing the result to process data (ADR-027 v.1). The reference is opaque to the task — the engine wired at thresher construction resolves it (a registered name for the in-core gorules registry, a DMN decision id/key for an external engine), so the same model runs under whichever engine the embedder chose.

func NewBusinessRuleTask added in v0.10.0

func NewBusinessRuleTask(
	name, decisionRef string,
	opts ...options.Option,
) (*BusinessRuleTask, error)

NewBusinessRuleTask creates a BusinessRuleTask evaluating decisionRef, with name and foundation/activity options.

func (*BusinessRuleTask) ActivityType added in v0.1.1

func (t *BusinessRuleTask) ActivityType() flow.ActivityType

func (*BusinessRuleTask) BindIncoming added in v0.1.1

func (t *BusinessRuleTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*BusinessRuleTask) BindOutgoing added in v0.1.1

func (t *BusinessRuleTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*BusinessRuleTask) Clone added in v0.10.0

func (bt *BusinessRuleTask) Clone() (flow.Node, error)

Clone returns a per-instance copy of the BusinessRuleTask (a fresh activity shell over the shared config).

func (*BusinessRuleTask) DecisionRef added in v0.10.0

func (bt *BusinessRuleTask) DecisionRef() string

DecisionRef returns the decision reference the task evaluates.

func (*BusinessRuleTask) Exec added in v0.10.0

Exec calls the configured Business Rule Engine with the task's decision reference and commits the returned result rows to process data (the ADR-027 v.1 §2.3 semantics: call, complete, commit). re satisfies the narrow service.DataReader structurally (the ServiceTask precedent), so the decision reads exactly what an in-process Go operation reads. An evaluation error fails the task through the ordinary fault path; an empty result commits nothing.

func (*BusinessRuleTask) Inputs added in v0.1.1

func (t *BusinessRuleTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*BusinessRuleTask) IsMultyinstance added in v0.1.1

func (t *BusinessRuleTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*BusinessRuleTask) LoadData added in v0.1.1

func (t *BusinessRuleTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*BusinessRuleTask) Node added in v0.10.0

func (bt *BusinessRuleTask) Node() flow.Node

Node returns the BusinessRuleTask as a flow node.

func (*BusinessRuleTask) Outputs added in v0.1.1

func (t *BusinessRuleTask) Outputs() []*data.ItemAwareElement

Outputs returns a list of output parameters of the Task

func (*BusinessRuleTask) TaskType added in v0.10.0

func (bt *BusinessRuleTask) TaskType() flow.TaskType

TaskType returns the task type for BusinessRuleTask.

func (*BusinessRuleTask) UploadData added in v0.1.1

func (t *BusinessRuleTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

type CallActivity added in v0.9.0

type CallActivity struct {
	// contains filtered or unexported fields
}

CallActivity invokes a separately registered process as a CHILD instance (ADR-023 §2.7): the reuse boundary. The caller's token parks while the child runs its own isolated instance; the declared Input/Output parameters are the call contract (§10.4 direct mapping — no data associations), matched by name. The callable resolves through the engine's registry AT CALL TIME: latest-at-launch by default, or the version pinned via WithCalledVersion.

func NewCallActivity added in v0.9.0

func NewCallActivity(
	name, calledKey string,
	opts ...options.Option,
) (*CallActivity, error)

NewCallActivity creates a Call Activity invoking the registered process named by calledKey. The registry is deliberately NOT consulted here — resolution happens at call time (ADR-023 §2.7), so the callable may be registered later or re-versioned.

func (*CallActivity) AcceptIncomingFlow added in v0.9.0

func (a *CallActivity) AcceptIncomingFlow(_ *flow.SequenceFlow) error

AcceptIncomingFlow checks if it possible to use sf as IncomingFlow for the activity.

func (*CallActivity) ActivityType added in v0.9.0

func (ca *CallActivity) ActivityType() flow.ActivityType

ActivityType returns the CallActivity activity type.

func (*CallActivity) AddBoundaryEvent added in v0.9.0

func (a *CallActivity) AddBoundaryEvent(be flow.BoundaryEvent) error

AddBoundaryEvent attaches a boundary event to the activity. Multiplicity (at most one interrupting handler per Event Declaration) is enforced by BoundaryEvent.BoundTo before this is called; this stores the attachment.

func (*CallActivity) BoundaryEvents added in v0.9.0

func (a *CallActivity) BoundaryEvents() []flow.BoundaryEvent

BoundaryEvents returns list of events bounded to the acitvity.

func (*CallActivity) CallInputs added in v0.9.0

func (ca *CallActivity) CallInputs() []string

CallInputs returns the names of the declared Input parameters — the call contract's inputs the loop resolves at the caller's scope and hands the child (SRD-050 §10.4 direct mapping, by name). Empty when the activity declares no IoSpec (a call that passes no data).

func (*CallActivity) CallOutputs added in v0.9.0

func (ca *CallActivity) CallOutputs() []string

CallOutputs returns the names of the declared Output parameters — the call contract's return values the loop reads from the completed child and commits into the caller's scope (SRD-050 §10.4, by name).

func (*CallActivity) CalledKey added in v0.9.0

func (ca *CallActivity) CalledKey() string

CalledKey returns the registry key of the callable process.

func (*CallActivity) CalledNamespace added in v0.12.0

func (ca *CallActivity) CalledNamespace() string

CalledNamespace returns the namespace qualifying the called key, or "" when the reference is unqualified and names a registry key directly.

func (*CallActivity) CalledVersion added in v0.9.0

func (ca *CallActivity) CalledVersion() int

CalledVersion returns the pinned callable version, or 0 for the latest-at-launch binding.

func (*CallActivity) Clone added in v0.9.0

func (ca *CallActivity) Clone() (flow.Node, error)

Clone implements flow.Node: the activity base clones per the shared contract; the call binding (key + version pin) is immutable config, copied by value.

func (*CallActivity) DefaultFlow added in v0.9.0

func (a *CallActivity) DefaultFlow() *flow.SequenceFlow

DefaultFlow returns the activity's default outgoing flow, or nil when none is set (the gateway-getter symmetry, SRD-046).

func (*CallActivity) Exec added in v0.9.0

Exec runs after the child ended and the caller resumed. On a normal completion the outputs are already committed into the caller's scope by the loop, so the execution is the standard activity completion — select the outgoing flows. On a child fault the stashed outcome carries the terminal error: return it so the caller track faults and the §2.6 error chain catches it at THIS node (a typed BpmnError → an Error boundary; otherwise uncaught).

func (*CallActivity) ForCompensation added in v0.10.0

func (a *CallActivity) ForCompensation() bool

ForCompensation reports whether the activity is a compensation handler (isForCompensation, set by WithCompensation): it lives outside the normal flow and runs only when compensation is thrown (ADR-026 §2.3, SRD-059 FR-2).

func (*CallActivity) IncidentRetryPolicy added in v0.12.0

func (a *CallActivity) IncidentRetryPolicy() tasks.RetryPolicy

IncidentRetryPolicy returns the activity's incident retry policy — nil when the activity relies on the engine-wide default or on the operator (SRD-079 §3.5). The instance loop reads it through a capability assertion at raise.

func (*CallActivity) LoopCharacteristics added in v0.10.0

func (a *CallActivity) LoopCharacteristics() LoopCharacteristics

LoopCharacteristics returns the activity's loop/multi-instance marker, or nil when the activity runs exactly once (ADR-025). The runtime reads it to decide whether — and how — to iterate the activity.

func (*CallActivity) Node added in v0.9.0

func (ca *CallActivity) Node() flow.Node

Node returns the CallActivity itself — the concrete-type override every node provides (the embedded activity base would otherwise surface, stripping the call capabilities from flow targets).

func (*CallActivity) NodeType added in v0.9.0

func (a *CallActivity) NodeType() flow.NodeType

NodeType returns Activity's node type.

func (*CallActivity) ProcessEvent added in v0.9.0

func (ca *CallActivity) ProcessEvent(
	_ context.Context,
	eDef flow.EventDefinition,
) error

ProcessEvent stashes the call-completion the instance loop delivers to the parked caller track when the child ends (the ServiceTask worker-outcome idiom): the engine loop is the only producer. Exec reads it on resume.

func (*CallActivity) Properties added in v0.9.0

func (a *CallActivity) Properties() []*data.Property

Properties implements an data.PropertyOwner interface and returns copy of the Activity properties.

func (*CallActivity) Roles added in v0.9.0

func (a *CallActivity) Roles() []*hi.ResourceRole

Roles returns list of ResourceRoles of the activity.

func (*CallActivity) SetDefaultFlow added in v0.9.0

func (a *CallActivity) SetDefaultFlow(flowID string) error

SetDefaultFlow sets default flow from the Activity — the flow taken when no conditional outgoing flow fires (SRD-046). The flow must be one of the activity's outgoing flows and must NOT carry a condition (the BPMN rule the gateway's UpdateDefaultFlow enforces too). If the flowId is empty, then default flow cleared for Activity.

func (*CallActivity) SupportOutgoingFlow added in v0.9.0

func (a *CallActivity) SupportOutgoingFlow(_ *flow.SequenceFlow) error

SuportOutgoingFlow checks if it possible to source sf SequenceFlow from the activity.

func (*CallActivity) Validate added in v0.9.0

func (ca *CallActivity) Validate() error

Validate re-asserts the call contract at process validation (the per-node hook): a non-empty key and a legal pin. Registry existence is NOT checked — resolution is at call time.

type CallActivityOption added in v0.9.0

type CallActivityOption func(*callActivityConfig) error

CallActivityOption is a CallActivity-specific construction option. NewCallActivity separates these from the embedded activity's options and applies them to the CallActivity itself; a bad option value is rejected with an error.

func WithCalledNamespace added in v0.12.0

func WithCalledNamespace(ns string) CallActivityOption

WithCalledNamespace qualifies the called key with the namespace of the definitions document that declared the callable — what a modeler writes as a prefix on `calledElement` when the callable lives in another document.

Without it the reference is unqualified and names a registry key directly. With it, the engine's CallableResolver maps the (namespace, key) pair onto a registered key at call time; the default resolver refuses a qualified reference by name rather than guess one (ADR-023 v.5 §2.7).

func WithCalledVersion added in v0.9.0

func WithCalledVersion(v int) CallActivityOption

WithCalledVersion pins the call to an exact registered version of the callable (1-based, ADR-019). Without it the call binds latest-at-launch — the newest version registered at the moment the call executes.

func (CallActivityOption) Option added in v0.9.0

func (CallActivityOption) Option()

Option marks CallActivityOption as an options.Option; NewCallActivity applies it by calling the func directly.

type ComplexBehaviorDefinition added in v0.10.0

type ComplexBehaviorDefinition struct {
	foundation.BaseElement
	// contains filtered or unexported fields
}

ComplexBehaviorDefinition drives BehaviorComplex (BPMN §ComplexBehaviorDefinition): on each instance completion its condition is evaluated, and when true its event is thrown (catchable on the Multi-Instance activity's boundary).

func NewComplexBehaviorDefinition added in v0.10.0

func NewComplexBehaviorDefinition(
	condition data.FormalExpression, event *events.ImplicitThrowEvent,
) (*ComplexBehaviorDefinition, error)

NewComplexBehaviorDefinition builds a complex-behavior entry. The boolean condition and the thrown event are both required.

func (*ComplexBehaviorDefinition) Condition added in v0.10.0

Condition returns the boolean expression evaluated on each instance completion.

func (*ComplexBehaviorDefinition) Event added in v0.10.0

Event returns the event thrown when the condition holds.

type LoopCharacteristics

type LoopCharacteristics interface {
	// contains filtered or unexported methods
}

LoopCharacteristics marks an activity as iterating — running its inner activity more than once (ADR-025 §2.1). The concrete kind (Standard Loop or, later, Multi-Instance) selects the execution mechanism (ADR-025 §2.2). An activity carries at most one; the interface is sealed to this package via the unexported marker method.

type ManualTask added in v0.9.0

type ManualTask struct {
	// contains filtered or unexported fields
}

ManualTask is a BPMN Manual Task — work performed without any IT system (§13.1, a non-operational element). Per Process Execution Conformance the engine MAY treat it as a no-op pass-through, and gobpm does: on activation the token flows straight to the outgoing sequence flow(s) with no distribution and no wait (ADR-020 §2.10).

func NewManualTask added in v0.9.0

func NewManualTask(
	name string,
	opts ...options.Option,
) (*ManualTask, error)

NewManualTask creates a ManualTask with name and foundation/activity options.

func (*ManualTask) ActivityType added in v0.9.0

func (t *ManualTask) ActivityType() flow.ActivityType

func (*ManualTask) BindIncoming added in v0.9.0

func (t *ManualTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*ManualTask) BindOutgoing added in v0.9.0

func (t *ManualTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*ManualTask) Clone added in v0.9.0

func (mt *ManualTask) Clone() (flow.Node, error)

Clone returns a per-instance copy of the ManualTask (a fresh activity shell over the shared config).

func (*ManualTask) Exec added in v0.9.0

Exec is a no-op pass-through: a Manual Task is never executed by an IT system (BPMN §13.1), so it binds nothing and advances straight to its outgoing flows.

func (*ManualTask) Inputs added in v0.9.0

func (t *ManualTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*ManualTask) IsMultyinstance added in v0.9.0

func (t *ManualTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*ManualTask) LoadData added in v0.9.0

func (t *ManualTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*ManualTask) Node added in v0.9.0

func (mt *ManualTask) Node() flow.Node

Node returns the ManualTask as a flow node.

func (*ManualTask) Outputs added in v0.9.0

func (t *ManualTask) Outputs() []*data.ItemAwareElement

Outputs returns a list of output parameters of the Task

func (*ManualTask) TaskType added in v0.9.0

func (mt *ManualTask) TaskType() flow.TaskType

TaskType returns the task type for ManualTask.

func (*ManualTask) UploadData added in v0.9.0

func (t *ManualTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

type MapOption added in v0.12.0

type MapOption func(*ResultStrategy) error

MapOption tunes the map strategy.

func ErrorOnKeyRewrite added in v0.12.0

func ErrorOnKeyRewrite() MapOption

ErrorOnKeyRewrite makes a duplicate map key a fault, naming both ordinals and the key, rather than letting the later instance overwrite the earlier.

For a model where a collision is a modeling error — a fan-out over participants who must each answer once — the overwrite is the bug, not the remedy.

type MultiInstanceBehavior added in v0.10.0

type MultiInstanceBehavior string

MultiInstanceBehavior governs whether a Multi-Instance activity throws an event as its instances complete (BPMN §13.3.7, ADR-025 §2.8).

const (
	// BehaviorAll (the default) throws no event — the common, zero-cost case.
	BehaviorAll MultiInstanceBehavior = "all"
	// BehaviorNone throws noneBehaviorEventRef for EVERY instance completion.
	BehaviorNone MultiInstanceBehavior = "none"
	// BehaviorOne throws oneBehaviorEventRef once, on the FIRST completion.
	BehaviorOne MultiInstanceBehavior = "one"
	// BehaviorComplex consults the complexBehaviorDefinition entries on each
	// completion, throwing the event of each whose condition holds.
	BehaviorComplex MultiInstanceBehavior = "complex"
)

type MultiInstanceLoopCharacteristics added in v0.10.0

type MultiInstanceLoopCharacteristics struct {
	foundation.BaseElement
	// contains filtered or unexported fields
}

MultiInstanceLoopCharacteristics is a Multi-Instance marker (BPMN §13.3.7): the activity runs a fixed number of times, decided once at activation from loopCardinality (an integer expression) or the size of the loopDataInputRef collection. This slice implements the sequential shape (isSequential); the data references are scope-datum names, resolved by name like any per-scope datum. behavior/ComplexBehaviorDefinition and parallel execution land later (SRD-056).

func NewMultiInstance added in v0.10.0

func NewMultiInstance(
	opts ...MultiInstanceOption,
) (*MultiInstanceLoopCharacteristics, error)

NewMultiInstance creates a MultiInstanceLoopCharacteristics from options. It requires exactly one cardinality source (WithCardinality XOR WithInputCollection), an integer cardinality expression, and — when present — a boolean completionCondition.

func (*MultiInstanceLoopCharacteristics) Behavior added in v0.10.0

Behavior returns the event-throwing behavior (BehaviorAll by default).

func (*MultiInstanceLoopCharacteristics) CompletionCondition added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) CompletionCondition() data.FormalExpression

CompletionCondition returns the early-completion boolean expression, or nil.

func (*MultiInstanceLoopCharacteristics) ComplexBehavior added in v0.10.0

ComplexBehavior returns the complex-behavior definitions (BehaviorComplex), or nil.

func (*MultiInstanceLoopCharacteristics) InputDataItem added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) InputDataItem() string

InputDataItem returns the per-instance input datum name.

func (*MultiInstanceLoopCharacteristics) IsSequential added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) IsSequential() bool

IsSequential reports whether the instances run one after another (§13.3.7).

func (*MultiInstanceLoopCharacteristics) LoopCardinality added in v0.10.0

LoopCardinality returns the integer cardinality expression, or nil when the count is collection-driven.

func (*MultiInstanceLoopCharacteristics) LoopDataInputRef added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) LoopDataInputRef() string

LoopDataInputRef returns the input collection datum name, or "" when the count is cardinality-driven.

func (*MultiInstanceLoopCharacteristics) LoopDataOutputRef added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) LoopDataOutputRef() string

LoopDataOutputRef returns the output collection datum name, or "" when the activity assembles no output.

func (*MultiInstanceLoopCharacteristics) NoneBehaviorEvent added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) NoneBehaviorEvent() flow.EventDefinition

NoneBehaviorEvent returns the event thrown on every completion (BehaviorNone), or nil.

func (*MultiInstanceLoopCharacteristics) OneBehaviorEvent added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) OneBehaviorEvent() flow.EventDefinition

OneBehaviorEvent returns the event thrown on the first completion (BehaviorOne), or nil.

func (*MultiInstanceLoopCharacteristics) OutputDataItem added in v0.10.0

func (mi *MultiInstanceLoopCharacteristics) OutputDataItem() string

OutputDataItem returns the per-instance output datum name.

func (*MultiInstanceLoopCharacteristics) Result added in v0.12.0

Result is the declared result strategy, or nil for the last-wins default.

type MultiInstanceOption added in v0.10.0

type MultiInstanceOption func(*MultiInstanceLoopCharacteristics) error

MultiInstanceOption configures a MultiInstanceLoopCharacteristics at construction.

func WithBehavior added in v0.10.0

WithBehavior sets the event-throwing behavior (BPMN §13.3.7, ADR-025 §2.8); the default is BehaviorAll (no event). See BehaviorNone/One/Complex.

func WithCardinality added in v0.10.0

func WithCardinality(expr data.FormalExpression) MultiInstanceOption

WithCardinality fixes the instance count to an integer expression, evaluated once at activation. Mutually exclusive with WithInputCollection.

func WithCompletionCondition added in v0.10.0

func WithCompletionCondition(expr data.FormalExpression) MultiInstanceOption

WithCompletionCondition ends the activity early: the boolean expression is evaluated after each instance completes; true stops the remaining instances.

func WithComplexBehavior added in v0.10.0

func WithComplexBehavior(defs ...*ComplexBehaviorDefinition) MultiInstanceOption

WithComplexBehavior sets the complex-behavior definitions consulted on each instance completion (BehaviorComplex); each carries a condition and the event thrown when it holds.

func WithInputCollection added in v0.10.0

func WithInputCollection(ref, item string) MultiInstanceOption

WithInputCollection drives the instance count from a collection: ref names the input collection datum in scope, item names the per-instance datum bound to element i. Mutually exclusive with WithCardinality.

func WithNoneBehaviorEvent added in v0.10.0

func WithNoneBehaviorEvent(def flow.EventDefinition) MultiInstanceOption

WithNoneBehaviorEvent sets the event thrown on every instance completion (BehaviorNone).

func WithOneBehaviorEvent added in v0.10.0

func WithOneBehaviorEvent(def flow.EventDefinition) MultiInstanceOption

WithOneBehaviorEvent sets the event thrown once, on the first instance completion (BehaviorOne).

func WithOutputCollection added in v0.10.0

func WithOutputCollection(ref, item string) MultiInstanceOption

WithOutputCollection assembles each instance's item into the ref collection: ref names the output collection datum, item names the per-instance output datum read from the instance.

func WithResultMap added in v0.12.0

func WithResultMap(
	name, item string, key data.FormalExpression, opts ...MapOption,
) MultiInstanceOption

WithResultMap declares that the instances' results are keyed by key, evaluated in the COMPLETING INSTANCE's own frame (ADR-025 §2.6.1).

That timing is the point: it lets the key use something the instance produced — the assignee of a User Task being the motivating case, since it is not known until the task is claimed.

An empty or missing key refuses at runtime: there is no sensible slot for a result with no key, and silently dropping one instance's output is the failure the declared strategies exist to make impossible. A duplicate key overwrites unless ErrorOnKeyRewrite is given.

func WithResultReduce added in v0.12.0

func WithResultReduce(name string) MultiInstanceOption

WithResultReduce names the accumulating default under name: each instance's writes land in the enclosing scope, and a later one replaces an earlier (ADR-025 §2.6.1).

It changes no behavior — it IS the default — and exists so a model can state the intent it is relying on. A sequential iteration reading what the previous pass committed is a fold, and an implicit fold is a thing readers rediscover by experiment.

func WithSequential added in v0.10.0

func WithSequential() MultiInstanceOption

WithSequential runs the instances one after another (BPMN §13.3.7 isSequential). Without it a Multi-Instance is parallel — which this slice does not yet execute (SRD-056).

type OutputValidator added in v0.9.0

type OutputValidator interface {
	ValidateOutputs(outputs []data.Data) error
}

OutputValidator validates submitted outputs against the task's output specification. Implemented by UserTask and called at Complete only.

type RcvTaskOption added in v0.1.1

type RcvTaskOption func(*rcvTaskConfig)

RcvTaskOption is a ReceiveTask-specific construction option (e.g. WithInstantiate). NewReceiveTask separates these from the embedded task's options and applies them to the ReceiveTask itself. It does not return an error — its options only flip flags — while still satisfying options.Option via Apply (whose only failure is a wrong configurator type).

func WithInstantiate added in v0.1.1

func WithInstantiate() RcvTaskOption

WithInstantiate marks the ReceiveTask as instantiating: a ReceiveTask with no incoming sequence flow and instantiate=true starts a new process instance on a matching message (BPMN §13.3.3), just like a message start event. It is the task-shaped peer of the message start event in the SRD-015 instantiation path.

func WithIterationCorrelation added in v0.12.0

func WithIterationCorrelation(
	keyName string, expr data.FormalExpression,
) RcvTaskOption

WithIterationCorrelation declares how a concurrently-waiting iteration of this ReceiveTask (a parallel leaf Multi-Instance, SRD-086 FR-4) is addressed by an arriving message (ADR-006 v.5 §2.9.3): keyName names a declared process CorrelationKey — its retrieval expressions derive the envelope-side value — and expr, evaluated at registration over the iteration's scope (where the split item is bound), produces the subscription-side value.

func (RcvTaskOption) Option added in v0.9.0

func (RcvTaskOption) Option()

Option marks RcvTaskOption as an options.Option; NewReceiveTask applies it by calling the func directly.

type ReceiveTask

type ReceiveTask struct {
	// contains filtered or unexported fields
}

ReceiveTask is a simple Task that is designed to wait for a Message to arrive from an external Participant (relative to the Process). Once the Message has been received, the Task is completed. The actual Participant from which the Message is received can be identified by connecting the Receive Task to a Participant using a Message Flows within the definitional Collaboration of the Process. A Receive Task is often used to start a Process. In a sense, the Process is bootstrapped by the receipt of the Message. In order for the Receive Task to instantiate the Process its instantiate attribute MUST be set to true and it MUST NOT have any incoming Sequence Flow.

ReceiveTask plugs into the engine's event wait/resume loop: it is a flow.EventNode whose single MessageEventDefinition the track registers (so the track parks in TrackWaitForEvent and a MessageWaiter subscribes the broker), and it is an eventproc.EventProcessor that captures the arrived payload on fire; the captured datum is bound into scope on resume by Exec (ADR-014 v.1).

func NewReceiveTask added in v0.1.1

func NewReceiveTask(
	name string,
	msg *bpmncommon.Message,
	taskOpts ...options.Option,
) (*ReceiveTask, error)

NewReceiveTask builds a ReceiveTask that waits for msg. A nil msg is rejected.

func (*ReceiveTask) ActivityType added in v0.1.1

func (t *ReceiveTask) ActivityType() flow.ActivityType

func (*ReceiveTask) BindIncoming added in v0.1.1

func (t *ReceiveTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*ReceiveTask) BindOutgoing added in v0.1.1

func (t *ReceiveTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*ReceiveTask) Clone added in v0.1.1

func (rt *ReceiveTask) Clone() (flow.Node, error)

Clone returns a per-instance copy of the ReceiveTask as a flow.Node. The captured payload is per-instance runtime state and is not carried over.

func (*ReceiveTask) Definitions added in v0.1.1

func (rt *ReceiveTask) Definitions() []flow.EventDefinition

Definitions returns the task's single message event definition, so the track registers it and parks waiting for the message. Implements flow.EventNode.

func (*ReceiveTask) EventClass added in v0.1.1

func (rt *ReceiveTask) EventClass() flow.EventClass

EventClass classifies the receive as an intermediate (mid-process) wait. Implements flow.EventNode.

func (*ReceiveTask) Exec added in v0.1.1

Exec binds the received message payload into the execution scope (re.Put; the inherited task.UploadData then pushes it through the output associations) and completes, returning the task's outgoing sequence flows.

func (*ReceiveTask) ExpectedMessage added in v0.1.1

func (rt *ReceiveTask) ExpectedMessage() *bpmncommon.Message

ExpectedMessage returns the message the task waits for. Implements msgflow.MessageConsumer.

func (*ReceiveTask) Implementation

func (rt *ReceiveTask) Implementation() string

Implementation returns the technology used to receive the message (empty until a receiving technology beyond the broker is wired).

func (*ReceiveTask) Inputs added in v0.1.1

func (t *ReceiveTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*ReceiveTask) Instantiate

func (rt *ReceiveTask) Instantiate() bool

Instantiate reports whether the task instantiates the process on receipt (deferred — ADR-014 v.1 §2.7; always false in phase-1).

func (*ReceiveTask) IsMultyinstance added in v0.1.1

func (t *ReceiveTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*ReceiveTask) IterationCorrelation added in v0.12.0

func (rt *ReceiveTask) IterationCorrelation() (string, data.FormalExpression)

IterationCorrelation returns the declared iteration-correlation pair, or ("", nil) — the capability the registering execution probes (SRD-085 FR-3).

func (*ReceiveTask) LoadData added in v0.1.1

func (t *ReceiveTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*ReceiveTask) Message

func (rt *ReceiveTask) Message() *bpmncommon.Message

Message returns the message the task waits for.

func (*ReceiveTask) Node added in v0.1.1

func (rt *ReceiveTask) Node() flow.Node

Node returns the task as a flow.Node.

func (*ReceiveTask) Outputs added in v0.1.1

func (t *ReceiveTask) Outputs() []*data.ItemAwareElement

Outputs returns a list of output parameters of the Task

func (*ReceiveTask) ProcessEvent added in v0.1.1

func (rt *ReceiveTask) ProcessEvent(
	_ context.Context,
	_ flow.EventDefinition,
) error

ProcessEvent is the node's delivery notification (implements eventproc.EventProcessor). Since SRD-085 the payload does NOT land here: a node is a runtime-immutable definition shared by every execution of its instance, so the delivery's item is captured by the RECEIVING execution and read back through the runtime environment (ADR-006 v.5 §2.9.1). Nothing is left to do at this seam.

func (*ReceiveTask) TaskType added in v0.1.1

func (rt *ReceiveTask) TaskType() flow.TaskType

TaskType returns the BPMN task type.

func (*ReceiveTask) UploadData added in v0.1.1

func (t *ReceiveTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

type ResultKind added in v0.12.0

type ResultKind string

ResultKind names how an iteration's instances' results are assembled (ADR-025 §2.6.1).

const (
	// ResultArray indexes results by ORDINAL: slot i holds instance i's
	// output, whatever order the instances completed in.
	//
	// For a Multi-Instance this is the standard's own `loopDataOutputRef`
	// assembly (§13.3.7). For a Standard Loop it is an engine extension —
	// the standard gives a loop no output aggregation at all.
	ResultArray ResultKind = "array"

	// ResultMap keys results by a per-instance expression, evaluated in that
	// instance's frame at its completion. An engine extension for both
	// shapes: BPMN's Multi-Instance output is an ordered collection, never a
	// keyed one.
	ResultMap ResultKind = "map"

	// ResultReduce names the accumulating default: each instance's writes
	// land in the enclosing scope and a later one replaces an earlier.
	//
	// It adds no assembly, because it IS what happens without a declaration.
	// It exists so a model can SAY it is relying on the fold — a sequential
	// iteration reading what the previous pass committed is the useful
	// default, and an implicit fold is a thing readers rediscover by
	// experiment.
	ResultReduce ResultKind = "reduce"
)

type ResultStrategy added in v0.12.0

type ResultStrategy struct {
	// contains filtered or unexported fields
}

ResultStrategy is a declared reading of an iteration's results.

Nil means the default of ADR-025 §2.6.1: last write wins, which is a fold for a sequential shape and order-dependent for a parallel one. The declared strategies exist so a model that needs every instance's result can say so and get a deterministic one.

func (*ResultStrategy) ErrorOnKeyRewrite added in v0.12.0

func (r *ResultStrategy) ErrorOnKeyRewrite() bool

ErrorOnKeyRewrite reports whether a duplicate map key faults.

False is not "the collision is fine": it is the last-wins default, and the loss is detectable rather than silent — RUNTIME/ITERATIONS publishes the instance total, so a map holding fewer entries than that says so.

func (*ResultStrategy) Item added in v0.12.0

func (r *ResultStrategy) Item() string

Item is the per-instance value the assembly collects, by name. Empty for reduce, which assembles nothing.

func (*ResultStrategy) Key added in v0.12.0

Key is the map strategy's per-instance key expression, nil for the others.

func (*ResultStrategy) Kind added in v0.12.0

func (r *ResultStrategy) Kind() ResultKind

Kind reports how the results are assembled.

func (*ResultStrategy) Name added in v0.12.0

func (r *ResultStrategy) Name() string

Name is where the assembled result is published.

type RoleConfigurator

type RoleConfigurator interface {
	options.Configurator

	AddRole(r *hi.ResourceRole) error
}

RoleConfigurator is the interface for objects supported role access control.

type RoleOption

type RoleOption func(cfg RoleConfigurator) error

RoleOption is a function type for configuring role-based access control.

func WithRoles

func WithRoles(ress ...*hi.ResourceRole) RoleOption

WithRoles adds unique non-nil resources into the activityConfig.

func (RoleOption) Option added in v0.9.0

func (RoleOption) Option()

Option marks RoleOption as an options.Option; the dispatching constructor applies it by calling the func with a config that implements RoleConfigurator.

type ScriptTask

type ScriptTask struct {
	// contains filtered or unexported fields
}

ScriptTask is a BPMN script task (the extract's §ScriptTask clause): on activation the associated script is invoked on the Script Engine claiming the task's scriptFormat (ADR-031 §2.1 — the format routes between the registered engines); on the script's completion the task completes, committing the script's named outputs to process data. The script body is opaque to the model — the wired interpreter (e.g. adapters/lua) executes it, so the same model runs under whichever engines the embedder registered.

func NewScriptTask added in v0.10.0

func NewScriptTask(
	name, format, body string,
	opts ...options.Option,
) (*ScriptTask, error)

NewScriptTask creates a ScriptTask running script in the scriptFormat dialect, with name and foundation/activity options. All three are required: the metamodel carries scriptFormat and script as 0..1 for interchange, but a scriptless Script Task in a programmatic model is a bug — fail fast (SRD-064 §4.4).

func (*ScriptTask) ActivityType added in v0.1.1

func (t *ScriptTask) ActivityType() flow.ActivityType

func (*ScriptTask) BindIncoming added in v0.1.1

func (t *ScriptTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*ScriptTask) BindOutgoing added in v0.1.1

func (t *ScriptTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*ScriptTask) Clone added in v0.10.0

func (st *ScriptTask) Clone() (flow.Node, error)

Clone returns a per-instance copy of the ScriptTask (a fresh activity shell over the shared config).

func (*ScriptTask) Exec added in v0.10.0

Exec routes the script by its format to the registered Script Engine, runs it against the task's own read surface and commits the script's named outputs — each as its own Ready datum, in sorted name order (deterministic; ADR-031 §2.3). A routing miss or a script failure fails the task through the ordinary fault machinery.

func (*ScriptTask) Inputs added in v0.1.1

func (t *ScriptTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*ScriptTask) IsMultyinstance added in v0.1.1

func (t *ScriptTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*ScriptTask) LoadData added in v0.1.1

func (t *ScriptTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*ScriptTask) Node added in v0.10.0

func (st *ScriptTask) Node() flow.Node

Node returns the ScriptTask as a flow node.

func (*ScriptTask) Outputs added in v0.1.1

func (t *ScriptTask) Outputs() []*data.ItemAwareElement

Outputs returns a list of output parameters of the Task

func (*ScriptTask) Script

func (st *ScriptTask) Script() string

Script returns the script body.

func (*ScriptTask) ScriptFormat

func (st *ScriptTask) ScriptFormat() string

ScriptFormat returns the script's format MIME hint.

func (*ScriptTask) TaskType added in v0.10.0

func (st *ScriptTask) TaskType() flow.TaskType

TaskType returns the task type for ScriptTask.

func (*ScriptTask) UploadData added in v0.1.1

func (t *ScriptTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

type SendTask

type SendTask struct {
	// contains filtered or unexported fields
}

SendTask is a simple Task that is designed to send a Message to an external Participant (relative to the Process). Once the Message has been sent, the Task is completed.

func NewSendTask added in v0.1.1

func NewSendTask(
	name string,
	msg *bpmncommon.Message,
	taskOpts ...options.Option,
) (*SendTask, error)

NewSendTask builds a SendTask that sends msg to the engine's MessageBroker (ADR-014 v.1). A nil msg is rejected.

func (*SendTask) ActivityType added in v0.1.1

func (t *SendTask) ActivityType() flow.ActivityType

func (*SendTask) BindIncoming added in v0.1.1

func (t *SendTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*SendTask) BindOutgoing added in v0.1.1

func (t *SendTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*SendTask) Clone added in v0.1.1

func (st *SendTask) Clone() (flow.Node, error)

Clone returns a deep copy of the SendTask as a flow.Node.

func (*SendTask) CorrelationKey added in v0.1.1

func (st *SendTask) CorrelationKey() *bpmncommon.CorrelationKey

CorrelationKey returns the CorrelationKey this SendTask stamps onto its outgoing message, or nil for name-match only (ADR-016 v.1 §2.2).

func (*SendTask) Exec added in v0.1.1

Exec sends the task's message to the broker (ADR-014 v.1) and completes, returning the task's outgoing sequence flows.

func (*SendTask) Implementation

func (st *SendTask) Implementation() string

Implementation returns the technology used to send the message (empty until a sending technology beyond the broker is wired).

func (*SendTask) Inputs added in v0.1.1

func (t *SendTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*SendTask) IsMultyinstance added in v0.1.1

func (t *SendTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*SendTask) LoadData added in v0.1.1

func (t *SendTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*SendTask) Message

func (st *SendTask) Message() *bpmncommon.Message

Message returns the message the task sends.

func (*SendTask) MessageToSend added in v0.1.1

func (st *SendTask) MessageToSend() *bpmncommon.Message

MessageToSend returns the message the task publishes. Implements msgflow.MessageProducer.

func (*SendTask) Node added in v0.1.1

func (st *SendTask) Node() flow.Node

Node returns the task as a flow.Node.

func (*SendTask) Outputs added in v0.1.1

func (t *SendTask) Outputs() []*data.ItemAwareElement

Outputs returns a list of output parameters of the Task

func (*SendTask) TaskType added in v0.1.1

func (st *SendTask) TaskType() flow.TaskType

TaskType returns the BPMN task type.

func (*SendTask) UploadData added in v0.1.1

func (t *SendTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

type ServiceTask

type ServiceTask struct {
	// contains filtered or unexported fields
}

ServiceTask inherits the attributes and model associations of Activity. In addition the following constraints are introduced when the Service Task references an Operation:

  • The Service Task has exactly one inputSet and at most one outputSet. It has a single Data Input with an ItemDefinition equivalent to the one defined by the Message referenced by the inMessageRef attribute of the associated Operation. If the Operation defines output Messages, the Service Task has a single Data Output that has an ItemDefinition equivalent to the one defined by the Message referenced by the outMessageRef attribute of the associated Operation.

If the Service Task is associated with an Operation, there MUST be a Message Data Input on the Service Task and it MUST have an itemDefinition equivalent to the one defined by the Message referred to by the inMessageRef attribute of the operation. If the operation defines output Messages, there MUST be a single Data Output and it MUST have an itemDefinition equivalent to the one defined by Message referred to by the outMessageRef attribute of the Operation.

func NewServiceTask

func NewServiceTask(
	name string,
	operation service.Operation,
	taskOpts ...options.Option,
) (*ServiceTask, error)

NewServiceTask creates a new service task named name and operation as service engine with some options.

It accepts the option FAMILIES below — that is what the constructor dispatches on, so an option added to one of these families is accepted here whether or not it is named. The members listed are today's; the family is the contract (FIX-034 §3.2.5).

  • SrvTaskOption — WithTimeout, WithWorker, WithWorkerTrust, WithErrorMapper, WithStatus, WithOutputMapping
  • taskOption — WithMultyInstance
  • ActivityOption — WithLoop, WithCompensation, WithStartQuantity, WithCompletionQuantity, WithParameters, WithoutParams
  • RoleOption — WithRoles
  • data.PropertyOption — the process-data property options
  • foundation.BaseOption — WithID, WithDoc

func (*ServiceTask) ActivityType added in v0.1.1

func (t *ServiceTask) ActivityType() flow.ActivityType

func (*ServiceTask) BindIncoming added in v0.1.1

func (t *ServiceTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*ServiceTask) BindJobInput added in v0.9.0

func (st *ServiceTask) BindJobInput(
	ctx context.Context,
	r service.DataReader,
) (*data.ItemDefinition, error)

BindJobInput binds the operation's input message from r (without executing), for the engine to build the enqueued job's payload at park time (SRD-036).

func (*ServiceTask) BindOutgoing added in v0.1.1

func (t *ServiceTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*ServiceTask) Clone added in v0.1.1

func (st *ServiceTask) Clone() (flow.Node, error)

Clone returns a per-instance copy of the ServiceTask. The embedded task is cloned (config shared by reference, fresh activity shell, zero dataPath) and the implementation string is copied. The operation gets a per-instance clone (shared definition, fresh message carriers) so the exec-mutated message item state is not shared across concurrent instances.

func (*ServiceTask) Dehydratable added in v0.10.0

Dehydratable reports that a ServiceTask does NOT release the instance's goroutines (ADR-007 v.2 §2.4): an external-worker job is active work in flight (ADR-021's fetch-and-lock queue owns it), not a passive wait, and an in-process operation never parks — so the instance stays resident either way.

func (*ServiceTask) Exec added in v0.1.1

Exec runs single node and returns its valid output sequence flows on success or error on failure.

Exec runs the operation on a PER-EXECUTION clone (its message carriers are exec-mutated state — ADR-010 §2.3): the input message is filled from the execution's data resolution, the operation runs, and its result is handed to the frame as node-produced data, which the producer stage copies into the execution's output instance.

func (*ServiceTask) Implementation

func (st *ServiceTask) Implementation() string

Implementation returns the ServiceTask implementation description.

func (*ServiceTask) Inputs added in v0.1.1

func (t *ServiceTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*ServiceTask) IsMultyinstance added in v0.1.1

func (t *ServiceTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*ServiceTask) LoadData added in v0.1.1

func (t *ServiceTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*ServiceTask) Node

func (st *ServiceTask) Node() flow.Node

Node returns underlying node object.

func (*ServiceTask) Operation added in v0.10.0

func (st *ServiceTask) Operation() service.Operation

Operation returns the Operation the ServiceTask invokes. It is never nil: NewServiceTask rejects a nil operation, so every constructed task carries one.

Read-only accessor for consumers that must reconstruct the task's service binding without executing it — notably BPMN export, which writes the operation id back as operationRef (SRD-051 §FR-6).

func (*ServiceTask) Outputs added in v0.1.1

func (t *ServiceTask) Outputs() []*data.ItemAwareElement

Outputs returns a list of output parameters of the Task

func (*ServiceTask) ProcessEvent added in v0.9.0

func (st *ServiceTask) ProcessEvent(
	_ context.Context,
	eDef flow.EventDefinition,
) error

ProcessEvent receives the synthetic WorkerOutcome the instance loop delivers to the parked track and stashes it for Exec to classify + apply on resume (SRD-036 §3.5, SRD-037 §3.5).

func (*ServiceTask) TaskType

func (st *ServiceTask) TaskType() flow.TaskType

TaskType returns a type of the Task.

func (*ServiceTask) UploadData added in v0.1.1

func (t *ServiceTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

func (*ServiceTask) WorkerConfig added in v0.9.0

func (st *ServiceTask) WorkerConfig() (tasks.Policy, bool)

WorkerConfig reports the ServiceTask's per-service outcome policy — its WithErrorMapper, WithRetryPolicy, and WithOutputMapping — for the engine to resolve (two-level, over the engine-wide defaults) and ship in the enqueued Job.Policy so the policy owner can classify / retry / map the outcome. ok == false for an in-process task (tasks.WorkerConfig, SRD-038 §3.3, SRD-039 M8).

func (*ServiceTask) WorkerTopic added in v0.9.0

func (st *ServiceTask) WorkerTopic() (tasks.Topic, bool)

WorkerTopic reports the external-worker topic and whether this ServiceTask is worker-dispatched. The instance loop diverts a worker-dispatched task to the wait-node park path; an in-process task (ok == false) runs its operation.

type SndTaskOption added in v0.1.1

type SndTaskOption func(*sndTaskConfig)

SndTaskOption is a SendTask-specific construction option (e.g. WithCorrelationKey). NewSendTask separates these from the embedded task's options and applies them to the SendTask itself.

func WithCorrelationKey added in v0.1.1

func WithCorrelationKey(key *bpmncommon.CorrelationKey) SndTaskOption

WithCorrelationKey declares the CorrelationKey the SendTask correlates its outgoing message on (ADR-016 v.1 §2.2): Send derives the key from the message payload and stamps it onto the published Envelope so a keyed consumer can correlate. A nil key is a no-op (name-match only).

func (SndTaskOption) Option added in v0.9.0

func (SndTaskOption) Option()

Option marks SndTaskOption as an options.Option; NewSendTask applies it by calling the func directly.

type SrvTaskOption added in v0.9.0

type SrvTaskOption func(*srvTaskConfig) error

SrvTaskOption is a ServiceTask-specific construction option (e.g. WithTimeout). NewServiceTask separates these from the embedded task's options and applies them to the ServiceTask itself; a bad option value is rejected with an error.

func WithErrorMapper added in v0.9.0

func WithErrorMapper(m tasks.ErrorMapper) SrvTaskOption

WithErrorMapper sets the per-service ErrorMapper that classifies a worker's raw fault into a Business Error / Business Status / technical outcome (ADR-021 §2.6, SRD-037). A nil mapper is rejected. Governs the worker outcome, so it is valid only on a worker-dispatched ServiceTask (checked at NewServiceTask).

func WithImplementation added in v0.12.0

func WithImplementation(impl string) SrvTaskOption

WithImplementation sets the BPMN `implementation` hint of a ServiceTask — the technology that realizes it, e.g. "##WebService" or a URI naming a concrete binding.

BPMN carries `implementation` as an attribute of the ServiceTask itself, alongside `operationRef` (§10.5.7). gobpm otherwise derives the value from the Operation's Implementor, which is right for a task an embedder builds and wires, and impossible for a task an importer builds from a document: an imported Operation is a catalog stub with no Implementor, so there is nowhere for the file's own hint to live. This option gives it one.

Unset, the derived value stands, so no existing caller changes.

func WithOutputMapping added in v0.9.0

func WithOutputMapping(rules ...tasks.OutputRule) SrvTaskOption

WithOutputMapping shapes a worker's raw Complete response body into the ServiceTask's output via {body-path → output variable} rules (ADR-021 §2.5, SRD-037 FR-7). Absent a mapping, the Complete payload is taken as the output directly. Each rule needs a non-nil Path and a non-empty Var. Valid only on a worker-dispatched ServiceTask (checked at NewServiceTask).

func WithRetryPolicy added in v0.9.0

func WithRetryPolicy(p tasks.RetryPolicy) SrvTaskOption

WithRetryPolicy sets the per-service RetryPolicy that governs technical-fault retries for the worker-dispatched task (ADR-021 §2.7, SRD-038). A nil policy is rejected. Overrides the engine-wide WithWorkerRetryPolicy default; absent both, the engine's DefaultRetryPolicy applies. Valid only on a worker-dispatched ServiceTask (checked at NewServiceTask).

func WithStatus added in v0.9.0

func WithStatus(statusName string, overwrite bool) SrvTaskOption

WithStatus names the task-scoped variable a Business Status outcome writes, and whether it may overwrite an existing one (ADR-021 §2.6, SRD-037 FR-5). An empty name is rejected. overwrite=false makes a pre-existing variable a runtime collision fault (no silent clobber). Valid only on a worker-dispatched ServiceTask (checked at NewServiceTask).

func WithTimeout added in v0.9.0

func WithTimeout(d time.Duration) SrvTaskOption

WithTimeout bounds the in-process Operation execution to d and makes it context-cancellable (ADR-021 v.1 §2.9, SRD-035). When d is positive, Exec runs the Operation in a sub-goroutine and returns as soon as the operation finishes, the context is canceled (a boundary interrupt or an instance abort), or d elapses — whichever comes first; a timeout faults the task.

A non-positive d (the default) means no bound: the operation runs synchronously to completion, exactly as before.

NOTE: the bound protects the ENGINE, not the operation — Go cannot terminate a goroutine. An operation that ignores its context keeps running in a leaked goroutine after a timeout; confine an operation's effects to its returned value (the engine binds only that), and honor the context for true cancellation.

func WithWorker added in v0.9.0

func WithWorker(topic string) SrvTaskOption

WithWorker makes the ServiceTask an EXTERNAL-worker wait node (ADR-021 §2.1, SRD-036): instead of running its Operation in-process, the engine enqueues a job on topic and parks the task until a worker fetches, executes, and reports the outcome. Valid only on a message-operation ServiceTask — a Go operation (an in-process closure) can't be shipped to a worker, so combining WithWorker with a Go operation is a build-time error (§2.3). An empty topic is a no-op (the task stays in-process).

func WithWorkerTrust added in v0.9.0

func WithWorkerTrust(mode tasks.TrustMode) SrvTaskOption

WithWorkerTrust sets the per-service trust mode — where the worker outcome's policy bundle (output mapping, classification, retry) executes: WorkerTrusted (the worker) or EngineAuthoritative (the engine's dispatcher) (ADR-021 §2.6, SRD-039). An invalid mode is rejected. Overrides the engine-wide WithWorkerTrustDefault; absent both, WorkerTrusted (the ADR default) applies. Valid only on a worker-dispatched ServiceTask (checked at NewServiceTask).

func (SrvTaskOption) Option added in v0.9.0

func (SrvTaskOption) Option()

Option marks SrvTaskOption as an options.Option; NewServiceTask applies it by calling the func directly.

type StandardLoopCharacteristics added in v0.10.0

type StandardLoopCharacteristics struct {
	foundation.BaseElement
	// contains filtered or unexported fields
}

StandardLoopCharacteristics is a sequential, condition-driven loop (BPMN §13.3.6): the inner activity runs repeatedly while loopCondition holds, optionally bounded by loopMaximum. testBefore selects a pre-tested (while) or post-tested (do-while, the default) loop.

func NewStandardLoop added in v0.10.0

func NewStandardLoop(
	loopCondition data.FormalExpression,
	opts ...StandardLoopOption,
) (*StandardLoopCharacteristics, error)

NewStandardLoop creates a StandardLoopCharacteristics from a boolean loopCondition and options. loopCondition must be non-nil and evaluate to a bool (BPMN §13.3.6). It returns an error on an invalid condition or option.

func (*StandardLoopCharacteristics) LoopCondition added in v0.10.0

LoopCondition returns the boolean continuation expression.

func (*StandardLoopCharacteristics) LoopMaximum added in v0.10.0

func (sl *StandardLoopCharacteristics) LoopMaximum() (int, bool)

LoopMaximum returns the iteration cap and whether one is set. When ok is false the loop is unbounded (subject only to loopCondition).

func (*StandardLoopCharacteristics) Result added in v0.12.0

Result is the declared result strategy, or nil for the last-wins default.

func (*StandardLoopCharacteristics) TestBefore added in v0.10.0

func (sl *StandardLoopCharacteristics) TestBefore() bool

TestBefore reports whether the loop is pre-tested (a while loop). False is a post-tested do-while loop (the BPMN §13.3.6 default).

type StandardLoopOption added in v0.10.0

type StandardLoopOption func(*StandardLoopCharacteristics) error

StandardLoopOption configures a StandardLoopCharacteristics at construction.

func WithLoopMaximum added in v0.10.0

func WithLoopMaximum(n int) StandardLoopOption

WithLoopMaximum caps the loop at n iterations regardless of loopCondition. n must be positive; a zero or negative cap is rejected (to run zero times, use a pre-tested loop with a false condition).

func WithLoopResultArray added in v0.12.0

func WithLoopResultArray(name, item string) StandardLoopOption

WithLoopResultArray declares that the passes' results are indexed by pass ORDINAL and published under name at completion (ADR-025 §2.6.1).

An engine extension: BPMN gives a Standard Loop no output aggregation at all, only a Multi-Instance.

func WithLoopResultMap added in v0.12.0

func WithLoopResultMap(
	name, item string, key data.FormalExpression, opts ...MapOption,
) StandardLoopOption

WithLoopResultMap declares that the passes' results are keyed by key, evaluated in the completing pass's own frame — see WithResultMap.

func WithLoopResultReduce added in v0.12.0

func WithLoopResultReduce(name string) StandardLoopOption

WithLoopResultReduce names the accumulating default under name — see WithResultReduce. For a Standard Loop the fold is the shape's whole point, which is why naming it matters more here than anywhere.

func WithTestBefore added in v0.10.0

func WithTestBefore() StandardLoopOption

WithTestBefore makes the loop pre-tested (a while loop): loopCondition is checked before each run, so zero iterations are possible. Without it the loop is post-tested (a do-while, the BPMN §13.3.6 default): it runs once, then tests.

type SubProcess added in v0.9.0

type SubProcess struct {
	flow.ElementsContainer
	// contains filtered or unexported fields
}

SubProcess is the embedded Sub-Process (ADR-023 §2.2): an activity in its parent's graph AND the container of its own inner graph. Its inner flow is seeded when the host token arrives (the §2.3 validated shapes: a unique None Start Event, or every flow-less inner activity/gateway); it completes when its scope drains (BPMN §13.3.4). Inner elements are added exactly like a process's (Add + flow.Link — the same-container rule confines inner flows to this container).

func NewSubProcess added in v0.9.0

func NewSubProcess(
	name string,
	opts ...options.Option,
) (*SubProcess, error)

NewSubProcess creates an empty embedded Sub-Process. Inner elements are added afterwards via Add; the shape rules are enforced by Validate at process validation (registration), not at construction — a container is legitimately built element by element. WithTriggeredByEvent makes it an Event Sub-Process instead.

func (*SubProcess) AcceptIncomingFlow added in v0.9.0

func (a *SubProcess) AcceptIncomingFlow(_ *flow.SequenceFlow) error

AcceptIncomingFlow checks if it possible to use sf as IncomingFlow for the activity.

func (*SubProcess) ActivityType added in v0.9.0

func (sp *SubProcess) ActivityType() flow.ActivityType

ActivityType returns the SubProcess activity type.

func (*SubProcess) AdHoc added in v0.10.0

func (sp *SubProcess) AdHoc() AdHocSpec

AdHoc returns the container's routing configuration, or nil when this Sub-Process is not ad-hoc. It is how the runtime reaches the Router and the ordering rules without the model exposing its internals.

func (*SubProcess) Add added in v0.9.0

func (sp *SubProcess) Add(e flow.Element) error

Add adds a flow element into the Sub-Process's inner graph, binding it to the Sub-Process as its container (flow.Container). A Data Object is stored off-graph as a SubProcess-level named container (SRD-063 FR-4); everything else (nodes, sequence flows) goes into the ElementsContainer.

func (*SubProcess) AddArtifacts added in v0.12.0

func (sp *SubProcess) AddArtifacts(arts ...artifacts.Artifact) error

AddArtifacts attaches artifacts to the Sub-Process. Artifacts are model-only carriers (ADR-039): held for BPMN loading, never executed, never cloned into an instance. A nil artifact and a duplicate id are refused.

func (*SubProcess) AddBoundaryEvent added in v0.9.0

func (a *SubProcess) AddBoundaryEvent(be flow.BoundaryEvent) error

AddBoundaryEvent attaches a boundary event to the activity. Multiplicity (at most one interrupting handler per Event Declaration) is enforced by BoundaryEvent.BoundTo before this is called; this stores the attachment.

func (*SubProcess) Artifacts added in v0.12.0

func (sp *SubProcess) Artifacts() []artifacts.Artifact

Artifacts returns a copy of the Sub-Process's artifact collection, in the order the artifacts were added.

func (*SubProcess) BoundaryEvents added in v0.9.0

func (a *SubProcess) BoundaryEvents() []flow.BoundaryEvent

BoundaryEvents returns list of events bounded to the acitvity.

func (*SubProcess) Clone added in v0.9.0

func (sp *SubProcess) Clone() (flow.Node, error)

Clone implements flow.Node: the activity base clones per the shared contract (config by reference, per-instance state fresh, the host's own boundary events left for the enclosing graph's rebind), and the inner graph deep-clones through the container core — every inner node via its own Clone (a nested Sub-Process recurses), inner flows relinked, inner defaults remapped and inner boundaries rebound between the clones (flow.WireClonedGraph, one wiring implementation for every level).

func (*SubProcess) DataObjects added in v0.10.0

func (sp *SubProcess) DataObjects() []*dataobjects.DataObject

DataObjects returns the Sub-Process-level Data Objects (SRD-063 FR-4).

func (*SubProcess) DataStoreReferences added in v0.10.0

func (sp *SubProcess) DataStoreReferences() []*datastores.DataStoreReference

DataStoreReferences returns the Sub-Process-level Data Store References (SRD-068 FR-3).

func (*SubProcess) DefaultFlow added in v0.9.0

func (a *SubProcess) DefaultFlow() *flow.SequenceFlow

DefaultFlow returns the activity's default outgoing flow, or nil when none is set (the gateway-getter symmetry, SRD-046).

func (*SubProcess) Exec added in v0.9.0

Exec runs after the scope drained and the host resumed (SRD-049 FR-9): the inner work is done, so the composite's execution is exactly the standard activity completion — select the outgoing flows (conditional / default rules included).

func (*SubProcess) ForCompensation added in v0.10.0

func (a *SubProcess) ForCompensation() bool

ForCompensation reports whether the activity is a compensation handler (isForCompensation, set by WithCompensation): it lives outside the normal flow and runs only when compensation is thrown (ADR-026 §2.3, SRD-059 FR-2).

func (*SubProcess) IncidentRetryPolicy added in v0.12.0

func (a *SubProcess) IncidentRetryPolicy() tasks.RetryPolicy

IncidentRetryPolicy returns the activity's incident retry policy — nil when the activity relies on the engine-wide default or on the operator (SRD-079 §3.5). The instance loop reads it through a capability assertion at raise.

func (*SubProcess) IsAdHoc added in v0.10.0

func (sp *SubProcess) IsAdHoc() bool

IsAdHoc reports whether this Sub-Process is an Ad-Hoc Sub-Process (BPMN §13.3.5, ADR-035 v.1) — a container whose inner activities are ordered by a Router rather than by sequence flows. The runtime uses it to route succession through the Router; validation uses it to apply the ad-hoc containment rules.

func (*SubProcess) IsEventSubProcess added in v0.9.0

func (sp *SubProcess) IsEventSubProcess() bool

IsEventSubProcess reports whether this Sub-Process is an Event Sub-Process (triggeredByEvent) — a scope-armed handler, not a flow-reached activity (ADR-023 v.2 §2.10). The runtime uses it to skip the handler from entry seeding and arm it instead (SRD-052).

func (*SubProcess) IsTransaction added in v0.10.0

func (sp *SubProcess) IsTransaction() bool

IsTransaction reports whether this Sub-Process is a Transaction Sub-Process (BPMN §10.7, ADR-028 §2.1), i.e. whether it carries transaction characteristics. The runtime uses it to resolve a Cancel abort to this scope; the model uses it to gate Cancel End/boundary placement (§2.6).

func (*SubProcess) LaneSets added in v0.11.0

func (sp *SubProcess) LaneSets() []*lanes.LaneSet

LaneSets returns a copy of the Sub-Process's lane sets, in declaration order. Lanes are carried and never executed (SRD-076).

func (*SubProcess) LoopCharacteristics added in v0.10.0

func (a *SubProcess) LoopCharacteristics() LoopCharacteristics

LoopCharacteristics returns the activity's loop/multi-instance marker, or nil when the activity runs exactly once (ADR-025). The runtime reads it to decide whether — and how — to iterate the activity.

func (*SubProcess) Node added in v0.9.0

func (sp *SubProcess) Node() flow.Node

Node returns the SubProcess itself — the concrete-type override every node provides (the embedded activity base would otherwise surface, stripping the container and executor capabilities from flow targets).

func (*SubProcess) NodeType added in v0.9.0

func (a *SubProcess) NodeType() flow.NodeType

NodeType returns Activity's node type.

func (*SubProcess) ProcessEvent added in v0.9.0

func (sp *SubProcess) ProcessEvent(
	_ context.Context,
	eDef flow.EventDefinition,
) error

ProcessEvent accepts the scope-completion delivery that resumes the parked host track (SRD-049 FR-9): the engine loop is the only producer for a composite — the delivery itself IS the completion signal, so nothing binds here. Implements eventproc's EventProcessor surface the track's deliver dispatches to.

func (*SubProcess) Properties added in v0.9.0

func (a *SubProcess) Properties() []*data.Property

Properties implements an data.PropertyOwner interface and returns copy of the Activity properties.

func (*SubProcess) Remove added in v0.9.0

func (sp *SubProcess) Remove(e flow.Element) error

Remove removes a flow element from the Sub-Process's inner graph (flow.Container).

func (*SubProcess) Roles added in v0.9.0

func (a *SubProcess) Roles() []*hi.ResourceRole

Roles returns list of ResourceRoles of the activity.

func (*SubProcess) SetDefaultFlow added in v0.9.0

func (a *SubProcess) SetDefaultFlow(flowID string) error

SetDefaultFlow sets default flow from the Activity — the flow taken when no conditional outgoing flow fires (SRD-046). The flow must be one of the activity's outgoing flows and must NOT carry a condition (the BPMN rule the gateway's UpdateDefaultFlow enforces too). If the flowId is empty, then default flow cleared for Activity.

func (*SubProcess) SupportOutgoingFlow added in v0.9.0

func (a *SubProcess) SupportOutgoingFlow(_ *flow.SequenceFlow) error

SuportOutgoingFlow checks if it possible to source sf SequenceFlow from the activity.

func (*SubProcess) Transaction added in v0.12.0

func (sp *SubProcess) Transaction() *TransactionCharacteristics

Transaction returns the transaction characteristics (ADR-028 §2.1) — the abort method and the stated protocol — or nil when this Sub-Process is not a Transaction. The runtime binds a Transaction scope to its coordinator by them; execution never reads the protocol.

func (*SubProcess) Validate added in v0.9.0

func (sp *SubProcess) Validate() error

Validate checks the Sub-Process's inner graph — the ADR-023 §2.3 shape rules realized at the process-validation seam (the per-node hook of Process.Validate calls it; an enclosing SubProcess recurses into it the same way):

  • every inner flow's endpoints are inner nodes;
  • exactly one None Start Event, XOR no start event with at least one flow-less inner activity/gateway (the two normative §13.3.4 shapes);
  • a triggered start, multiple starts, a mixed shape, or an empty container are classified errors;
  • an inner boundary event's host is an inner node;
  • inner nodes' own Validate hooks run (a nested SubProcess validates its body — recursion).

type SubProcessOption added in v0.9.0

type SubProcessOption func(*subProcessConfig) error

SubProcessOption is a SubProcess-specific construction option. NewSubProcess separates these from the embedded activity's options and applies them to the SubProcess itself.

func WithAdHoc added in v0.10.0

func WithAdHoc(r adhoc.Router) SubProcessOption

WithAdHoc makes the SubProcess an Ad-Hoc Sub-Process (BPMN §13.3.5, ADR-035 v.1) routed by r: inner activities carry no fixed order, and r answers which of them may run next each time the container's scope opens and each time an inner activity settles. An empty answer ends the container.

The ordering defaults to AdHocParallel and remaining instances are canceled when routing stops (the metamodel's cancelRemainingInstances default); WithAdHocOrdering, WithAdHocManualSelection, WithAdHocCancelRemaining and WithAdHocCompletion adjust that. A nil Router is rejected — routing is never implied, and in particular never inferred from the order elements were added (ADR-035 v.1 §2.9).

Mutually exclusive with WithTriggeredByEvent and WithTransaction.

func WithAdHocCancelRemaining added in v0.10.0

func WithAdHocCancelRemaining(cancel bool) SubProcessOption

WithAdHocCancelRemaining sets what happens to inner activities still running when routing stops (BPMN §13.3.5 `cancelRemainingInstances`): true — the metamodel default — cancels them, false waits for them to finish.

func WithAdHocCompletion added in v0.10.0

func WithAdHocCompletion(expr data.FormalExpression) SubProcessOption

WithAdHocCompletion attaches BPMN's `completionCondition` (§13.3.5): it is evaluated after each inner activity settles and, when true, ends the container. It composes with the Router rather than competing with it — a true condition is the empty answer, otherwise the Router decides (ADR-035 v.1 §2.4).

func WithAdHocManualSelection added in v0.10.0

func WithAdHocManualSelection() SubProcessOption

WithAdHocManualSelection makes selection explicit: instead of running the Router's answer directly, the container offers it as the enabled set and waits for a host to activate one of the candidates. It is how BPMN's "one enabled activity is selected, typically by a Human Performer" is expressed without the engine blocking on a person (ADR-035 v.1 §2.6).

func WithAdHocOrdering added in v0.10.0

func WithAdHocOrdering(o AdHocOrdering) SubProcessOption

WithAdHocOrdering sets how many inner activities may run at once (BPMN §13.3.5 `ordering`). It applies only to an Ad-Hoc Sub-Process, so it must follow WithAdHoc.

func WithTransaction added in v0.10.0

func WithTransaction(opts ...TransactionOption) SubProcessOption

WithTransaction makes the SubProcess a Transaction Sub-Process (BPMN §10.7, ADR-028 §2.1): a plain embedded Sub-Process in every respect except that reaching a Cancel End Event inside it triggers an ACID-like abort — compensate its completed inner activities, terminate the running ones, and leave through its Cancel boundary. The characteristics permit Cancel (End + boundary), name the scope a cancel aborts, and carry the abort method and coordination protocol the document stated (ADR-028 §2.7); with no options the method is compensate and no protocol is stated. Mutually exclusive with WithTriggeredByEvent (a handler is not a transaction).

func WithTriggeredByEvent added in v0.9.0

func WithTriggeredByEvent() SubProcessOption

WithTriggeredByEvent marks the SubProcess as an Event Sub-Process (BPMN §13.5.4, ADR-023 v.2 §2.10): a handler armed while its enclosing scope is open, entered only when its single triggered Start Event fires — not by a sequence flow. Its inner graph must then have exactly one interrupting triggered start (Message/Timer/Signal/Error/Conditional) instead of the embedded Sub-Process's None-start / flow-less entry (SRD-052).

func (SubProcessOption) Option added in v0.9.0

func (SubProcessOption) Option()

Option marks SubProcessOption as an options.Option; NewSubProcess applies it by calling the func directly.

type TransactionCharacteristics added in v0.12.0

type TransactionCharacteristics struct {
	// contains filtered or unexported fields
}

TransactionCharacteristics is what makes a Sub-Process a Transaction (ADR-028 §2.1): the abort method and the coordination protocol the document states. Immutable after construction and shared by clones, like the Ad-Hoc spec; execution reads the method when it binds the scope to its coordinator and never reads the protocol.

func (*TransactionCharacteristics) Method added in v0.12.0

Method returns the coordinator this transaction aborts through.

func (*TransactionCharacteristics) Protocol added in v0.12.0

func (tc *TransactionCharacteristics) Protocol() string

Protocol returns the coordination protocol the document stated, or "" when it stated none. Carried for loading, round-trip and a future coordinator; never interpreted by the engine.

type TransactionMethod added in v0.12.0

type TransactionMethod string

TransactionMethod names the coordinator that aborts a Transaction Sub-Process (BPMN §10.7 `method`, ADR-028 §2.7). The set is open — the schema's tTransactionMethod admits any URI — so the model carries whatever a document names and registration decides whether this engine has a coordinator for it.

const TransactionCompensate TransactionMethod = "compensate"

TransactionCompensate is the one coordinator the engine provides and the default: abort undoes completed work by running compensation handlers.

func ParseTransactionMethod added in v0.12.0

func ParseTransactionMethod(s string) TransactionMethod

ParseTransactionMethod reads a document's method attribute. An absent (blank) value and both compensate spellings yield TransactionCompensate; any other value is carried as is, trimmed, for registration to judge (ADR-028 §2.7).

type TransactionOption added in v0.12.0

type TransactionOption func(*TransactionCharacteristics) error

TransactionOption configures the characteristics WithTransaction builds.

func WithTransactionMethod added in v0.12.0

func WithTransactionMethod(m TransactionMethod) TransactionOption

WithTransactionMethod sets the abort method. Any non-blank identifier is accepted here; whether this engine coordinates it is checked at process registration (ADR-028 §2.7).

func WithTransactionProtocol added in v0.12.0

func WithTransactionProtocol(p string) TransactionOption

WithTransactionProtocol sets the coordination protocol the document stated. Opaque to the engine; a blank value states nothing and is refused.

type UserTask added in v0.1.1

type UserTask struct {
	// contains filtered or unexported fields
}

UserTask is a typical "workflow" Task where a human performer performs the Task with the assistance of a software application. The lifecycle of the Task is managed by a software component (called task manager) and is typically executed in the context of a Process.

The User Task can be implemented using different technologies, specified by the implementation attribute. Besides the Web service technology, any technology can be used. A User Task for instance can be implemented using WSHumanTask by setting the implementation attribute to “http://docs.oasis-open.org/ns/bpel4people/ws-humantask/protocol/ 200803.”

The User Task inherits the attributes and model associations of Activity (see Table 10.3). Table 10.13 presents the additional attributes and model associations of the User Task. If implementations extend these attributes (e.g., to introduce subjects or descriptions with presentation parameters), they SHOULD use attributes defined by the OASIS WSHumanTask specification.

func NewUserTask added in v0.1.1

func NewUserTask(
	name string,
	userTaskOpts ...options.Option,
) (*UserTask, error)

NewUserTask tries to create a new UserTask with name and options.

It accepts the option FAMILIES below — that is what the constructor dispatches on, so an option added to one of these families is accepted here whether or not it is named. The members listed are today's; the family is the contract (FIX-034 §3.2.5). This block previously named only the first and last families, which is how the Camunda triad options went undocumented when SRD-034 added them.

  • UsrTaskOption — WithRenderer, WithOutput, WithAssignee / WithAssigneeExpr, WithCandidateUsers / WithCandidateUsersExpr, WithCandidateGroups / WithCandidateGroupsExpr

  • taskOption — WithMultyInstance

  • ActivityOption — WithLoop, WithCompensation, WithStartQuantity, WithCompletionQuantity, WithParameters, WithoutParams

  • data.PropertyOption — the process-data property options

  • RoleOption — WithRoles. A UserTask rejected this family until SRD-075, which is why a declared HumanPerformer / PotentialOwner could not reach the one task type whose eligibility they decide (ADR-020 v.3 §2.5.4).

  • foundation.BaseOption — WithID, WithDoc

    activity options:

  • WithMultyInstance

  • WithCompensation

  • WithLoop

  • WithStartQuantity

  • WithCompletionQuantity

  • WithParameters

  • WithoutParams

    data options:

  • WithProperties

func (*UserTask) ActivityType added in v0.1.1

func (t *UserTask) ActivityType() flow.ActivityType

func (*UserTask) Assignments added in v0.9.0

func (ut *UserTask) Assignments() []*hi.Assignment

Assignments returns the UserTask's declared triad members (assignee, candidate users, candidate groups) in slot order, skipping undeclared slots. It is the typed accessor for the triad — the single source of truth, coexisting with the generic activity Roles() rather than projected into it (ADR-020 §2.5).

func (*UserTask) Authorize added in v0.9.0

func (ut *UserTask) Authorize(
	ctx context.Context,
	actor hi.Actor,
	src data.Source,
	eng expression.Engine,
) error

Authorize reports whether actor may act on the task, per ADR-020 §2.5: if an assignee is declared, only a matching UserID is authorized (the restrictive gate); otherwise a matching candidateUser OR an intersecting candidateGroup authorizes; a task with no triad member declared is open to any actor. A failed/empty expression resolves to an empty set, i.e. denies. A nil verdict means authorized; a non-nil error is a non-terminal denial (the caller keeps the task parked and waits for the right actor).

It resolves the triad and applies the verdict through interactor.Eligibility, so the rule and its denial error have a single author (SRD-073 FR-5b/FR-5d). The engine's own checks read a snapshot resolved at distribution; this method stays as the entry point for an embedder wanting to pre-flight an actor against a task (SRD-073 §4.6).

func (*UserTask) BindIncoming added in v0.1.1

func (t *UserTask) BindIncoming(ia *data.Association) error

BindIncoming adds new incoming data association to the Task.

func (*UserTask) BindOutgoing added in v0.1.1

func (t *UserTask) BindOutgoing(oa *data.Association) error

BindOutgoing adds new outgoing data association.

func (*UserTask) Clone added in v0.1.1

func (ut *UserTask) Clone() (flow.Node, error)

Clone returns a per-instance copy of the UserTask. The embedded task is cloned (config shared by reference, fresh activity shell); the outputs resource and renderers are shared by reference as immutable configuration.

func (*UserTask) Dehydratable added in v0.10.0

func (ut *UserTask) Dehydratable(context.Context, renv.RuntimeEnvironment) bool

Dehydratable reports that a parked UserTask releases the instance's goroutines (ADR-007 v.2 §2.4): a human task is a passive wait, often for hours or days, and its holder (the task distributor) can wake the instance.

func (*UserTask) Exec added in v0.1.1

Exec binds the outputs a completed UserTask delivered — stored by ProcessEvent when the completion event reached the parked track — into the execution frame, then advances onto the outgoing flow(s). A UserTask is a wait node: it parked (checkNodeType marks it a human task), was announced to the TaskDistributor, and resumed only on an authorized, validated Complete (ADR-020 §2.1, §2.4). So Exec is reached exactly once, after acceptance; it never blocks.

func (*UserTask) Implementation added in v0.1.1

func (ut *UserTask) Implementation() []string

Implementation returns the UserTask implementations.

func (*UserTask) Inputs added in v0.1.1

func (t *UserTask) Inputs() []*data.ItemAwareElement

Inputs returns list of input parameters's ItemAwareElements.

func (*UserTask) IsMultyinstance added in v0.1.1

func (t *UserTask) IsMultyinstance() bool

IsMultyinstance returns Task multyinstance settings.

func (*UserTask) LoadData added in v0.1.1

func (t *UserTask) LoadData(ctx context.Context, f exec.Frame) error

LoadData instantiates the Task's inputs, outputs and properties in the execution frame and fills the input instances from the Task's incoming data associations. The IoSpec definitions on the node stay untouched — every execution works on its own instances (ADR-010 §2.3).

func (*UserTask) Node added in v0.1.1

func (ut *UserTask) Node() flow.Node

Node returns the UserTask as a flow node.

func (*UserTask) Outputs added in v0.1.1

func (ut *UserTask) Outputs() []*bpmncommon.ResourceParameter

Outputs returns outputs expected from renderers.

func (*UserTask) ProcessEvent added in v0.9.0

func (ut *UserTask) ProcessEvent(
	_ context.Context,
	eDef flow.EventDefinition,
) error

ProcessEvent receives the synthetic completion event the instance loop delivers to the parked track and stores its outputs for Exec to bind. It runs on the track goroutine (via deliver); the outputs were already authorized and validated by the loop (ADR-020 §2.4), so it only records them.

func (*UserTask) Renderers added in v0.1.1

func (ut *UserTask) Renderers() []hi.Renderer

Renderers returns all renders registered for the UserTask.

func (*UserTask) ResolveEligibility added in v0.10.0

func (ut *UserTask) ResolveEligibility(
	ctx context.Context,
	src data.Source,
	eng expression.Engine,
) interactor.Eligibility

ResolveEligibility resolves the task's assignment triad against src via eng into a frozen interactor.Eligibility (ADR-020 v.2 §2.7). It is called once, when the task is distributed and its instance is still resident; every later authorization check reads that snapshot instead of re-resolving, so a candidate set cannot shift under a waiting task and an owner cannot lose the ability to finish work it already holds.

Each slot records whether the model declared it, independently of what it resolved to: a declared slot resolving to an empty set authorizes no one (BPMN treats a failed resource query as an empty result set), while an undeclared slot is absent from the verdict.

func (*UserTask) TaskPriority added in v0.11.0

func (ut *UserTask) TaskPriority() int

TaskPriority returns the task's priority — BPMN's Table 10.14 instance attribute (§10.3.4.1), whose entire normative text is "Returns the priority of the User Task".

The standard supplies no scale, no direction, no default and no behavior that reads it, so the engine supplies none either: the value is reported to the distributor on TaskInfo for an embedder to order its own inbox by, and drives no engine decision (ADR-020 v.3 §2.11). Zero when unset.

func (*UserTask) TaskType added in v0.1.1

func (ut *UserTask) TaskType() flow.TaskType

TaskType returns the task type for UserTask.

func (*UserTask) UploadData added in v0.1.1

func (t *UserTask) UploadData(ctx context.Context, f exec.Frame) error

UploadData fills the not-Ready output instances of the execution frame and pushes the Task's outgoing data associations from those instances.

func (*UserTask) ValidateOutputs added in v0.9.0

func (ut *UserTask) ValidateOutputs(outputs []data.Data) error

ValidateOutputs checks submitted outputs against the task's output spec (Outputs()): every required parameter must be present by name, every provided output must correspond to a declared parameter (no unknown extras), and a present output's value type must match its declared parameter type. Failure is non-terminal — the caller keeps the task parked and the actor resubmits.

type UsrTaskOption added in v0.1.1

type UsrTaskOption func(cfg *usrTaskConfig) error

UsrTaskOption represents a configuration option for UserTask

func WithAssignee added in v0.9.0

func WithAssignee(userID string) UsrTaskOption

WithAssignee sets the task's assignee (actual owner) to a static user id. When set, only that user may read/complete the task (ADR-020 §2.5). Rejects an empty id.

func WithAssigneeExpr added in v0.9.0

func WithAssigneeExpr(expr data.FormalExpression) UsrTaskOption

WithAssigneeExpr sets the task's assignee from a FormalExpression evaluated per instance to the owning user id. Rejects a nil expression.

func WithCandidateGroups added in v0.9.0

func WithCandidateGroups(groupIDs ...string) UsrTaskOption

WithCandidateGroups sets the static group ids whose members may claim/complete the task. Rejects an empty list or an empty id.

func WithCandidateGroupsExpr added in v0.9.0

func WithCandidateGroupsExpr(expr data.FormalExpression) UsrTaskOption

WithCandidateGroupsExpr sets the candidate groups from a FormalExpression evaluated per instance to a list of group ids. Rejects a nil expression.

func WithCandidateUsers added in v0.9.0

func WithCandidateUsers(userIDs ...string) UsrTaskOption

WithCandidateUsers sets the static user ids eligible to claim/complete the task. Rejects an empty list or an empty id.

func WithCandidateUsersExpr added in v0.9.0

func WithCandidateUsersExpr(expr data.FormalExpression) UsrTaskOption

WithCandidateUsersExpr sets the candidate users from a FormalExpression evaluated per instance to a list of user ids. Rejects a nil expression.

func WithOutput added in v0.1.1

func WithOutput(name, pType string, required bool) UsrTaskOption

WithOutput register new output parameter from renderer.

func WithRenderer added in v0.1.1

func WithRenderer(r hi.Renderer) UsrTaskOption

WithRenderer adds new unique Render to user task config.

func WithTaskPriority added in v0.11.0

func WithTaskPriority(priority int) UsrTaskOption

WithTaskPriority sets the UserTask's priority — the BPMN instance attribute of Table 10.14 (§10.3.4.1).

The SETTER is an engine extension, registered as such in SAD-001 §14.2. BPMN defines taskPriority as an instance attribute, which no XML definition can set; the standard's whole normative text for it is "Returns the priority of the User Task" — no scale, no direction, no default, and no behavior in §13 that reads it. Camunda invented camunda:priority for the same reason.

The engine therefore assigns the value NO meaning: it does not sort, schedule, escalate or route on it, and deliberately does not feed it to an Ad-Hoc Router (ADR-020 v.3 §2.11). It is carried and reported for an embedder to order its own inbox by. Any value is accepted, including a negative one, because the standard supplies no range to validate against — inventing one would be the same over-reach as inventing an ordering.

func (UsrTaskOption) Option added in v0.9.0

func (UsrTaskOption) Option()

Option marks UsrTaskOption as an options.Option; newUserTask applies it by calling the func directly after its type-switch matches.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL