MCPcopy Create free account
hub / github.com/astercloud/aster / NewActorEngine

Function NewActorEngine

pkg/workflow/actor_engine.go:68–97  ·  view source on GitHub ↗

NewActorEngine 创建 Actor 化的工作流引擎

(config *EngineConfig, actorConfig *ActorEngineConfig)

Source from the content-addressed store, hash-verified

66
67// NewActorEngine 创建 Actor 化的工作流引擎
68func NewActorEngine(config *EngineConfig, actorConfig *ActorEngineConfig) (*ActorEngine, error) {
69 // 创建基础引擎
70 engine, err := NewEngine(config)
71 if err != nil {
72 return nil, err
73 }
74
75 if actorConfig == nil {
76 actorConfig = DefaultActorEngineConfig()
77 }
78
79 // 创建 Actor 系统
80 systemConfig := actor.DefaultSystemConfig()
81 systemConfig.MailboxSize = 10000
82 actorSystem := actor.NewSystemWithConfig(actorConfig.SystemName, systemConfig)
83
84 ae := &ActorEngine{
85 Engine: engine,
86 actorSystem: actorSystem,
87 agentPIDs: make(map[string]*actor.PID),
88 actorConfig: actorConfig,
89 }
90
91 // 创建协调器 Actor
92 coordinator := NewCoordinatorActor(ae)
93 ae.coordinatorPID = actorSystem.Spawn(coordinator, "coordinator")
94
95 wfLog.Info(context.Background(), "actor engine created", map[string]any{"system_name": actorConfig.SystemName})
96 return ae, nil
97}
98
99// ExecuteWithActors 使用 Actor 模型执行工作流
100func (e *ActorEngine) ExecuteWithActors(ctx context.Context, workflowID string, inputs map[string]any) (*WorkflowResult, error) {

Callers

nothing calls this directly

Calls 7

DefaultSystemConfigFunction · 0.92
NewSystemWithConfigFunction · 0.92
DefaultActorEngineConfigFunction · 0.85
NewCoordinatorActorFunction · 0.85
NewEngineFunction · 0.70
InfoMethod · 0.65
SpawnMethod · 0.45

Tested by

no test coverage detected