grav icon indicating copy to clipboard operation
grav copied to clipboard

Multiple OnType message handlers

Open oskoi opened this issue 3 years ago • 2 comments

It would be nice to add more complex Pod type that can handle multiple message types. Pod would be like Actor

oskoi avatar Aug 20 '21 18:08 oskoi

Absolutely! #37 is designed to help with that :)

cohix avatar Aug 21 '21 01:08 cohix

Oh, I see. But we also need guarantees that one pod group can handle one message at a time. Now all pods are independent and handle messages concurrently. We can add a message handling strategy to PodGroup (serial, concurrently, etc.) I want to use it like

func mkPodGroup() *PodGroup {
  var state State

  pods := g.PodGroup()
  pods.New().On(...) // state is used here
  pods.New().OnType(...) // state is used here

  return pods
}

It looks a bit hacky but it's a good start for stateful handling :) Grav can be good alternative to Vertx in Go world.

oskoi avatar Aug 21 '21 10:08 oskoi