Exemple #1
0
func main() {
	props := actor.FromInstance(&HelloActor{})
	actor := actor.Spawn(props)
	actor.Tell(Hello{Who: "Roger"})

	//why wait?
	//Stop is a system message and is not processed through the user message mailbox
	//thus, it will be handled _before_ any user message
	//we only do this to show the correct order of events in the console
	time.Sleep(1 * time.Second)
	actor.Stop()

	console.ReadLine()
}
Exemple #2
0
func main() {
	props := actor.FromInstance(&HelloActor{})
	pid := actor.Spawn(props)
	pid.Tell(Hello{Who: "Roger"})
	console.ReadLine()
}