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

Function NewSystemWithConfig

pkg/actor/system.go:139–173  ·  view source on GitHub ↗

NewSystemWithConfig 使用配置创建 Actor 系统

(name string, config *SystemConfig)

Source from the content-addressed store, hash-verified

137
138// NewSystemWithConfig 使用配置创建 Actor 系统
139func NewSystemWithConfig(name string, config *SystemConfig) *System {
140 if config == nil {
141 config = DefaultSystemConfig()
142 }
143
144 ctx, cancel := context.WithCancel(context.Background())
145
146 s := &System{
147 name: name,
148 actors: make(map[string]*actorCell),
149 mailbox: make(chan envelope, config.MailboxSize),
150 deadLetters: make(chan envelope, config.DeadLetterSize),
151 ctx: ctx,
152 cancel: cancel,
153 config: config,
154 stats: &SystemStats{
155 StartTime: time.Now(),
156 },
157 }
158
159 s.isRunning.Store(true)
160
161 // 启动消息分发器
162 s.wg.Add(1)
163 go s.dispatcher()
164
165 // 启动死信处理器
166 if config.EnableDeadLetterLogging {
167 s.wg.Add(1)
168 go s.deadLetterHandler()
169 }
170
171 actorLog.Info(context.Background(), "system started", map[string]any{"name": name})
172 return s
173}
174
175// Name 返回系统名称
176func (s *System) Name() string {

Callers 9

NewActorEngineFunction · 0.92
initializeA2AMethod · 0.92
TestSupervisorRestartMethod · 0.92
TestActorHighThroughputFunction · 0.92
runSupervisorDemoFunction · 0.92
NewSystemFunction · 0.85

Calls 5

dispatcherMethod · 0.95
deadLetterHandlerMethod · 0.95
DefaultSystemConfigFunction · 0.85
AddMethod · 0.65
InfoMethod · 0.65

Tested by 5

TestSupervisorRestartMethod · 0.74
TestActorHighThroughputFunction · 0.74