by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 17 17:14
    briansain commented #4567
  • Sep 17 16:59
    briansain synchronize #4568
  • Sep 17 16:27
    VaclavK closed #51
  • Sep 17 16:27
    VaclavK closed #50
  • Sep 15 14:57
    BartHuls closed #4569
  • Sep 15 14:18
    Aaronontheweb commented #4563
  • Sep 15 13:53
    Zetanova commented #4563
  • Sep 15 13:41
    Aaronontheweb commented #4563
  • Sep 15 13:38
    Zetanova commented #4563
  • Sep 15 13:28
    Zetanova commented #4563
  • Sep 15 13:15
    Aaronontheweb commented #4567
  • Sep 15 13:11
    Aaronontheweb commented #4569
  • Sep 15 09:59
    BartHuls commented #4569
  • Sep 13 16:51
    to11mtm commented #4568
  • Sep 11 18:45
    briansain synchronize #4568
  • Sep 11 16:18
    briansain commented #4567
  • Sep 11 15:50
    briansain commented #4567
  • Sep 11 15:37
    ismaelhamed commented #4567
  • Sep 11 15:24
    dependabot-preview[bot] synchronize #146
  • Sep 11 15:24

    dependabot-preview[bot] on nuget

    Bump AkkaVersion from 1.4.9 to … (compare)

feng3245
@feng3245
Is there anyway to use ask with akka.net clustering? I only see pub sub which is a very difficult pattern where ask is inherently simple and without need to explicitly maintain state.
Aaron Stannard
@Aaronontheweb
@feng3245 you can always use Ask with remote actor references
that's definitely supported
@heyixiaoran you'll want to add this to your HOCON configuration at the time you create your ActorSystem:
var actorSystem = ActorSystem.Create("clusterNodes", config
                .WithFallback(ClusterClientReceptionist.DefaultConfig())
                .WithFallback(DistributedPubSub.DefaultConfig()));
serializer 9 is DistributedPubSub
@psandler no, it should fail and scream loudly
that's what I would expect in that scenario
might be that the way that plugin is implemented is screwy
@chriskolenko yep, we provide consulting / support / training for Akka.NET: https://petabridge.com/services/consulting/
feng3245
@feng3245
@Aaronontheweb Is var actorSystem = ActorSystem.Create("clusterNodes", config
.WithFallback(ClusterClientReceptionist.DefaultConfig())
.WithFallback(DistributedPubSub.DefaultConfig())); How one creates the actorsystem for clustering with remote?
Aaron Stannard
@Aaronontheweb
let me paste the full sample
this is a new code sample I'm going to propose that we add to the Akka.NET repository to help explain how to use the ClusterClient
because the current documentation on the subject doesn't give you 100% of the information you need
IMHO
private static void Main(string[] args)
        {
            // region is for DocFX targeting

            #region HOCON

            Config config = @"
                akka.actor.provider = cluster
                akka.remote.dot-netty.tcp.hostname = localhost
                akka.remote.dot-netty.tcp.port = 0 #random port
                akka.cluster{
                    seed-nodes = [""akka.tcp://clusterNodes@localhost:13310""]
                    roles = [worker]
                }
            ";

            #endregion

            #region worker-startup

            // need to include ClusterClientReceptionist.DefaultConfig() to load serializers
            var actorSystem = ActorSystem.Create("clusterNodes", config
                .WithFallback(ClusterClientReceptionist.DefaultConfig())
                .WithFallback(DistributedPubSub.DefaultConfig()));

            var worker = actorSystem.ActorOf(Props.Create(() => new WorkerActor()), "work");

            #endregion

            actorSystem.WhenTerminated.Wait();
        }
    }
to start up akka.cluster
this is the key line in the HOCON configuration
akka.actor.provider = cluster
that loads the clustering engine itself
 akka.remote.dot-netty.tcp.hostname = localhost
 akka.remote.dot-netty.tcp.port = 0 #random port
that specifies the network address of the node (ActorSystem) that will be joining the cluster
akka.cluster{
                    seed-nodes = [""akka.tcp://clusterNodes@localhost:13310""]
                    roles = [worker]
                }
that tells Akka.Cluster "which nodes do I contact at startup in order to try to join the rest of the cluster?" and "what types of work can I execute inside the cluster?"
roles are useful in distinguishing different services from each other inside a single cluster
does that make sense?
feng3245
@feng3245
@Aaronontheweb How do you get this or any actor path by using actorselection?
Aaron Stannard
@Aaronontheweb
if you want to communicate between nodes in a cluster, there are two ways of doing it
one is subscribing to the cluster's membership events and manually composing ActorSelections
the other method is to use something like a clustered group router
which does that for you behind-the-scenes
feng3245
@feng3245
By manually composing actorselection s do you mean you must have the host address/name as well?
Aaron Stannard
@Aaronontheweb
yes you do
but that data gets exposed on the Member property of the MemberUp and MemberRemoved events
so all you have to do to compose an ActorSelection is something like var actorpath = new RootActorPath(member.Address) / "user" / "foo"
Context.ActorSelection(actorpath).Tell("bar");
no need for string manipulation
the / operator is overloaded on the ActorPath class
and RootActorPath will take an Address as a starting argument
you can see where we do this here
does that help?
feng3245
@feng3245
Say if I use actorselection to get actor ref of node1 then requests will only go to node1 right?
@Aaronontheweb forgot @
Aaron Stannard
@Aaronontheweb
correct
those messages only go to node 1
since an ActorSelection addresses only a single node explicitly
feng3245
@feng3245
kind of defeats the purpose of clustering but It's probably something I'd use since the code is closely tied to remoting and ask right now but with multiple addresses which are available
feng3245
@feng3245
Next step would be to add an abstraction on top of ActorSelection and Ask that does the pub sub
Alex Hofer
@alexhofer
@Aaronontheweb can you comment on what ActorProducerPluginBase might be replaced with? We are using it currently and wanna switch to the new thing if its in place already. Or keep it on our radar whenever its replacement arrives :)