Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • 08:49
    Zetanova review_requested #5273
  • 03:30
    Zetanova synchronize #5273
  • 02:41
    Zetanova commented #5273
  • 00:44
    Arkatufus closed #5284
  • Sep 16 21:14
    Arkatufus opened #5284
  • Sep 16 20:05
    Arkatufus synchronize #5282
  • Sep 16 19:47
    Aaronontheweb commented #5273
  • Sep 16 19:28
    Aaronontheweb commented #5273
  • Sep 16 19:18
    Aaronontheweb commented #5273
  • Sep 16 19:16
    Aaronontheweb commented #5273
  • Sep 16 19:15
    Aaronontheweb commented #5273
  • Sep 16 19:11
    Aaronontheweb commented #5273
  • Sep 16 16:52
    Aaronontheweb commented #4989
  • Sep 16 16:17
    dependabot[bot] labeled #5283
  • Sep 16 16:17
    dependabot[bot] opened #5283
  • Sep 16 16:17

    dependabot[bot] on nuget

    Bump Google.Protobuf from 3.17.… (compare)

  • Sep 16 16:07
    Arkatufus synchronize #5282
  • Sep 16 16:07
    Arkatufus opened #5282
  • Sep 16 15:10
    Arkatufus opened #5281
  • Sep 16 14:28
    Martin-Molinero commented #4989
hi! I have a problem: there are two independent projects and I am using Akka Remoting for connection. I am also using Autofac DI.
Two projects. Two actor systems. Two Autofac DI containers.
Actor of the first ActorSystem calls actor of the second ActorSystem which should have constructor injection.
But the first actor system doesn't know (and shouldn't know) about this dependencies.
Is it possible to call this actor after resolving dependency through the second actor system?
Aaron Stannard
@AnchishkinAlex are you remotely deploying those actors?
if not, then none of this stuff matters - both actors are started independently
and neither needs to know about each other's constructor arguments
they just need to acquire a remote actor reference to each other
which you can via an ActorSelection initially
Ok, we tried to use ActorSelection but it needs hardcode address of actor.
Is it possible to get address of actor from HOCON?
Aaron Stannard
yep, you can create a custom HOCON field
to store the address a remote node
I do this inside the client-server app from our Akka.NET trainings
let me see if I can grab it...
              handshake-timeout = 4.0s #max time to complete the handshake timeout process
              verify-timeout = 1.0s #max time to authentication an end-user locally on the server
              verify-chat = on
             server = "akka.tcp://akkatime@"

          akka {
the akkatime section is custom
and I have a akkatime.server property that the client reads from configuration in order to figure out how to contact the server
var actorSystem = ActorSystemRefs.AkkaTimeSystem = ActorSystem.Create("akkatime");
            var serverAddress = ActorSystemRefs.ServerAddress = Address.Parse(actorSystem.Settings.Config.GetString("akkatime.server"));
            var serverStatus =ActorSystemRefs.ServerConnectivityActor =
                    Props.Create(() => new ServerConnectivityStatusActor((Address)serverAddress.Clone(), ServerConnectivityStatus.Disconnected)),
which I then read in here when I'm starting my ActorSystem
and that serverAddress gets passed to an actor that uses an ActorSelection to contact another actor on the server
Thank you. Could you provide link to this example? I'll explain it
Aaron Stannard
wish I could, but it's part of the training materials we distribute to our customers
that being said, we do have all of these ones
the WebCrawler one for Akka.Cluster is probably the most relevant there
Thanks! I saw Akka.NET Bootcamp, Chat Server Example but not this samples :smile:
Aaron Stannard
you're welcome!
And I know about your post "When I should use Actor Selection?". Is this situation relevant, isn't it?
Aaron Stannard
yes it is
generally, IActorRef is going to be both more performant and flexible at run-time
since it has the benefit of location transparency and doesn't need to be "resolved"
but ActorSelection is ideal in situations where you don't have a reference to an actor yet but still need to contact it
and you know roughly where it is in the hierarchy
most people build their actor hierarchies top-down
where the top level actors filter messages down to their children and so forth
so by convention, most developers treat their top level actors like "public APIs"
therefore, it's usually safe to select those and trust that your message will eventually be routed to the correct concrete actor who will actually do the processing
and that actor will send you a reply back directly
you can also do some cool stuff with wildcard actor selections
i.e. akka.tcp://mysys@*/myGrandChild
you can dynamically select all of the grand children of myParent named myGrandChild without knowing what the parent's name is
I used that to build our actor hierarchy visualizer in Petabridge.Cmd: https://cmd.petabridge.com/articles/commands/actor-commands.html#actor-hierarchy
it's interesting
So well! We will try Actor Selection for this moment. Thanks again! All the best! :smile:
Can some please explain the philosophy behind this Cluster Sharding shenanigans.
Aaron Stannard
@vicosoft4real Cluster.Sharding tries to guarantee that there is exactly one copy of a given entity inside your cluster at any given time
where each entity is represented as its own actor
it has tooling in place to do things such as redistribute entities when the cluster changes
buffer messages being sent to a given entity while it's being moved
and a placement algorithm for figuring out where it should spawn new ones
each entity should, ideally, persist its state somewhere