You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use LocalAffinityStrategy feature but it is not available in go version. So I used cluster.WithMemberStrategy to customize the member strategy, but it didn't work. I looked at the source code and found that cluster.Get does not follow the logic of MemberStrategy.
Is this a BUG? Or is there any other way for me to achieve the same purpose? I don’t want to modify the source code of protoactor-go.
The text was updated successfully, but these errors were encountered:
import (
"github.com/asynkron/protoactor-go/actor"
"github.com/asynkron/protoactor-go/cluster"
)
// Custom Member Strategy (Local Affinity or any other strategy)
type MyCustomStrategy struct {
// Custom strategy fields
}
func (s *MyCustomStrategy) SelectMember(ctx cluster.Context, members []cluster.Member) cluster.Member {
// Custom logic for selecting member
// Return the selected member
return members[0]
}
func main() {
// Initialize cluster with custom member strategy
customStrategy := &MyCustomStrategy{}
// Create actor system
system := actor.NewActorSystem()
// Use the custom member strategy in the cluster
cluster.Configure(cluster.WithMemberStrategy(customStrategy))
// Initialize the cluster and run your actor system
cluster.Start()
}
I want to use LocalAffinityStrategy feature but it is not available in go version. So I used cluster.WithMemberStrategy to customize the member strategy, but it didn't work. I looked at the source code and found that cluster.Get does not follow the logic of MemberStrategy.
Is this a BUG? Or is there any other way for me to achieve the same purpose? I don’t want to modify the source code of protoactor-go.
The text was updated successfully, but these errors were encountered: