Documentation ¶
Overview ¶
Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func BuiltinWorkflowFactory(engine *WorkflowEngine) func(logger.Logger) workflows.Workflow
- func IsWorkflowRequest(path string) bool
- func LoadWorkflowState(ctx context.Context, actorRuntime actors.Actors, actorID string, ...) (*workflowState, error)
- func NewActivityActor(scheduler workflowScheduler, config wfConfig) *activityActor
- func NewActorBackend(engine *WorkflowEngine) *actorBackend
- func NewDurableTimer(bytes []byte, generation uint64) durableTimer
- func NewWorkflowActor(scheduler workflowScheduler, config wfConfig) *workflowActor
- func NewWorkflowConfig(appID string) wfConfig
- func NewWorkflowState(config wfConfig) *workflowState
- type ActivityRequest
- type WorkflowEngine
- func (wfe *WorkflowEngine) Close(ctx context.Context) error
- func (wfe *WorkflowEngine) ConfigureGrpcExecutor()
- func (wfe *WorkflowEngine) DisableActorCaching(disable bool)
- func (wfe *WorkflowEngine) InternalActors() map[string]actors.InternalActor
- func (wfe *WorkflowEngine) RegisterGrpcServer(grpcServer *grpc.Server)
- func (wfe *WorkflowEngine) SetActivityTimeout(timeout time.Duration)
- func (wfe *WorkflowEngine) SetActorReminderInterval(interval time.Duration)
- func (wfe *WorkflowEngine) SetActorRuntime(actorRuntime actors.ActorRuntime)
- func (wfe *WorkflowEngine) SetExecutor(fn func(be backend.Backend) backend.Executor)
- func (wfe *WorkflowEngine) SetWorkflowTimeout(timeout time.Duration)
- func (wfe *WorkflowEngine) Start(ctx context.Context) (err error)
- func (wfe *WorkflowEngine) WaitForActorsReady(ctx context.Context)
Constants ¶
const ( WorkflowNameLabelKey = "workflow" ActivityNameLabelKey = "activity" )
const ( CallbackChannelProperty = "dapr.callback" CreateWorkflowInstanceMethod = "CreateWorkflowInstance" GetWorkflowMetadataMethod = "GetWorkflowMetadata" AddWorkflowEventMethod = "AddWorkflowEvent" PurgeWorkflowStateMethod = "PurgeWorkflowState" )
Variables ¶
var ComponentDefinition = componentsV1alpha1.Component{ TypeMeta: metav1.TypeMeta{ Kind: "Component", }, ObjectMeta: metav1.ObjectMeta{ Name: "dapr", }, Spec: componentsV1alpha1.ComponentSpec{ Type: "workflow.dapr", Version: "v1", Metadata: []commonapi.NameValuePair{}, }, }
var ErrDuplicateInvocation = errors.New("duplicate invocation")
Functions ¶
func BuiltinWorkflowFactory ¶
func BuiltinWorkflowFactory(engine *WorkflowEngine) func(logger.Logger) workflows.Workflow
func IsWorkflowRequest ¶
func LoadWorkflowState ¶
func NewActivityActor ¶
func NewActivityActor(scheduler workflowScheduler, config wfConfig) *activityActor
NewActivityActor creates an internal activity actor for executing workflow activity logic.
func NewActorBackend ¶
func NewActorBackend(engine *WorkflowEngine) *actorBackend
func NewDurableTimer ¶
func NewWorkflowActor ¶
func NewWorkflowActor(scheduler workflowScheduler, config wfConfig) *workflowActor
func NewWorkflowConfig ¶ added in v1.11.0
func NewWorkflowConfig(appID string) wfConfig
NewWorkflowConfig creates a new workflow engine configuration
func NewWorkflowState ¶
func NewWorkflowState(config wfConfig) *workflowState
Types ¶
type ActivityRequest ¶
type ActivityRequest struct {
HistoryEvent []byte
}
ActivityRequest represents a request by a worklow to invoke an activity.
type WorkflowEngine ¶
type WorkflowEngine struct { IsRunning bool // contains filtered or unexported fields }
func NewWorkflowEngine ¶
func NewWorkflowEngine(config wfConfig) *WorkflowEngine
func (*WorkflowEngine) Close ¶ added in v1.12.0
func (wfe *WorkflowEngine) Close(ctx context.Context) error
func (*WorkflowEngine) ConfigureGrpcExecutor ¶ added in v1.11.2
func (wfe *WorkflowEngine) ConfigureGrpcExecutor()
func (*WorkflowEngine) DisableActorCaching ¶
func (wfe *WorkflowEngine) DisableActorCaching(disable bool)
DisableActorCaching turns off the default caching done by the workflow and activity actors. This method is primarily intended to be used for testing to ensure correct behavior when actors are newly activated on nodes, but without requiring the actor to actually go through activation.
func (*WorkflowEngine) InternalActors ¶
func (wfe *WorkflowEngine) InternalActors() map[string]actors.InternalActor
InternalActors returns a map of internal actors that are used to implement workflows
func (*WorkflowEngine) RegisterGrpcServer ¶ added in v1.11.2
func (wfe *WorkflowEngine) RegisterGrpcServer(grpcServer *grpc.Server)
func (*WorkflowEngine) SetActivityTimeout ¶
func (wfe *WorkflowEngine) SetActivityTimeout(timeout time.Duration)
SetActivityTimeout allows configuring a default timeout for activity executions. If the timeout is exceeded, the activity execution will be abandoned and retried.
func (*WorkflowEngine) SetActorReminderInterval ¶
func (wfe *WorkflowEngine) SetActorReminderInterval(interval time.Duration)
SetActorReminderInterval sets the amount of delay between internal retries for workflow and activity actors. This impacts how long it takes for an operation to restart itself after a timeout or a process failure is encountered while running.
func (*WorkflowEngine) SetActorRuntime ¶
func (wfe *WorkflowEngine) SetActorRuntime(actorRuntime actors.ActorRuntime)
func (*WorkflowEngine) SetExecutor ¶ added in v1.11.2
func (wfe *WorkflowEngine) SetExecutor(fn func(be backend.Backend) backend.Executor)
SetExecutor sets the executor property. This is primarily used for testing.
func (*WorkflowEngine) SetWorkflowTimeout ¶
func (wfe *WorkflowEngine) SetWorkflowTimeout(timeout time.Duration)
SetWorkflowTimeout allows configuring a default timeout for workflow execution steps. If the timeout is exceeded, the workflow execution step will be abandoned and retried. Note that this timeout is for a non-blocking step in the workflow (which is expected to always complete almost immediately) and not for the end-to-end workflow execution.
func (*WorkflowEngine) WaitForActorsReady ¶ added in v1.12.0
func (wfe *WorkflowEngine) WaitForActorsReady(ctx context.Context)
WaitForActorsReady blocks until the actor runtime is set in the object (or until the context is canceled).