-
-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contextualizing Tell #69
Comments
If we go for this approach, we also need to solve how to talk to PID's from outside an actor.
That would be a "contextless" Tell.
I think this would be fairly clean, even if this approach is more verbose than what we have currently. |
I'm not too familiar with how the context and PID interact yet, but from a user perspective I think it's important that there are as few ways as possible of doing something, preferably just one if possible. Would it be a bad coupling if the PID knew about the context it belongs to? So calling |
making the PID know about the current context is possible in e.g C# using AsyncLocal and all that black magic. (The same PID could flow through multiple contexts in e.g. a message, so it is not tied to the context in any way) Another option could be to provide the context into the that would be less intrusive on the current design, right? Just tossing around ideas here |
Discussed API:
We could either go for: or Related tasks
e.g. type struct Message {
Headers MessageHeaders // string -> string map
Object interface{}
Bytes []byte
Sender *PID //this could be tricky as PID lives in actor package
}
e.g. func main() {
pid := ...
...
ctx := NewRootContext()
ctx.Headers().Add("TraceID", "123") //the rootcontext can be configured with some initial values
//or possibly, root context headers should be set on creation?
ctx.Tell(pid, message)
} One question we need to decide on, |
In order to fully support passing contextual information the current
PID.Tell
model will not work.One suggestion is to move the
Tell
operation over to the actor Context.e.g.
This would allow us to build things like tracing using e.g. Zipkin.
It would also greatly simplyfy having multiple actor systems running at the same time. e.g. for parallel testing.
ctx would then be like a phone and the PID would just be the phone number.
Currently PID is both.
This would be a major breaking change, so I'm not completely sold on this idea myself, but I do see the added value it brings
The text was updated successfully, but these errors were encountered: