Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 16:21
    ismaelhamed commented #3663
  • 16:08
    Zetanova commented #3663
  • Sep 30 18:09
    ismaelhamed commented #3663
  • Sep 30 17:10
    Zetanova commented #3663
  • Sep 30 04:27
    Horusiath commented #4570
  • Sep 29 17:35
    ingted commented #4570
  • Sep 29 17:31
    ingted commented #4570
  • Sep 29 17:31
    ingted commented #4570
  • Sep 29 07:35
    nagytech commented #4570
  • Sep 29 07:34
    nagytech commented #4570
  • Sep 29 06:07
    ingted commented #4570
  • Sep 28 13:38
    ismaelhamed commented #4570
  • Sep 26 16:37
    to11mtm commented #4563
  • Sep 26 16:34
    to11mtm commented #4563
  • Sep 25 07:59
    ingted commented #4570
  • Sep 25 07:57
    ingted commented #4570
  • Sep 25 07:54
    ingted commented #4570
  • Sep 25 06:10
    ismaelhamed commented #4570
  • Sep 24 22:46
    nagytech commented #4570
  • Sep 24 14:18
    ingted commented #4570
Aaron Stannard
@Aaronontheweb
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 :)
Aaron Stannard
@Aaronontheweb
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
I wouldn't say that
the purpose of clustering is to make you AWARE OF WHO IS IN THE NETWORK
and any given time
that's what the events are for
if you want to make WHO YOU ARE COMMUNICATING WITH transparent
use a tool like a clustered router
you can just Ask the router
and it will do the right thing
and hide all of those implementation details
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 :)
@alexhofer at the moment, that issue looks like something more complicated than I originally anticipated
I don't think it's going to get replaced necessarily since it contains some context-specific data inside of it
but the way we propagate that data inside Props is just really odd today
Blue
@heyixiaoran
@Aaronontheweb tks. It's work. Now sender publish a topic and receiver subscribe a topic. Then sender can send a message to receiver. Can I get the sender path when receive message and send a message back use the path ?
DSanchen
@DSanchen
Someone any Idea why resolving an actor (created with ActorOfAsTestActorRef) can fail sometimes ??
tkeegan-ealink
@tkeegan-ealink
I have been reading about the use of async/await (or more to the point the warning not to), as i understand it...it is generally safe to use the async/await at the beginning (i.e. prior to entering into the actor system)....but what if within the actor it is going to call async methods on other classes?
In particular, i have a command, class that defines an async Execute method, which will internally perform an Ask on a target actor. This is working fine if i am calling it from a controller....Can someone tell me if i going to expect issues if i were to call the same Execute method from within another actor....and how i should address this?
Blue
@heyixiaoran
@Aaronontheweb Hi . I use shard and run one lighthouse ,sender1 and receiver1. receiver1 can receive messages from sender1. Then run sender2 and receiver2. sender1 and receiver1 still receive the messages. How can make one message just received by one receiver ? I mean one message just handle once.
using (var system = ActorSystem.Create(_systemName, _config.WithFallback(ClusterClientReceptionist.DefaultConfig())
                                                                       .WithFallback(DistributedPubSub.DefaultConfig())))
            {
                var shardRegion = ClusterSharding.Get(system).Start(
                    nameof(SenderActor),
                    Props.Create<SenderActor>(),
                    ClusterShardingSettings.Create(system).WithRole(Roles.Sharding),
                    new MessageExtractor());

                for (int i = 0; i < 100; i++)
                {
                    Thread.Sleep(2000);
                    shardRegion.Tell(new ShardEnvelope("1", "1", "test" + i));
                }

                system.WhenTerminated.Wait();
            }


public class SenderActor : ReceiveActor
    {
        private readonly IActorRef _mediator = DistributedPubSub.Get(Context.System).Mediator;

        public SenderActor()
        {
            Receive<string>(msg =>
            {
                Console.WriteLine(msg);

                _mediator.Tell(new Publish(Topics.SendMessageTopic, msg));
            });
        }
    }

public class ReceiverActor : ReceiveActor
    {
        private readonly IActorRef _mediator = DistributedPubSub.Get(Context.System).Mediator;

        public ReceiverActor()
        {
            Receive<string>(msg =>
            {
                Console.WriteLine(msg);
            });
        }

        protected override void PreStart()
        {
            base.PreStart();
            _mediator.Tell(new Subscribe(Topics.SendMessageTopic, Self));
        }

        protected override void PostStop()
        {
            _mediator.Tell(new Unsubscribe(Topics.SendMessageTopic, Self));
            base.PostStop();
        }
    }