Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 08:34
    jiyeongj commented #4083
  • 08:33
    jiyeongj commented #4083
  • 08:33
    jiyeongj commented #4083
  • 07:57

    dependabot-preview[bot] on nuget

    (compare)

  • 07:57

    dependabot-preview[bot] on dev

    Bump MongoDB.Driver from 2.9.1 … (compare)

  • 07:57
    dependabot-preview[bot] closed #104
  • 07:52
    dependabot-preview[bot] synchronize #104
  • 07:52

    dependabot-preview[bot] on nuget

    Bump MongoDB.Driver from 2.9.1 … (compare)

  • 07:52
    dependabot-preview[bot] edited #104
  • 07:51
    dependabot-preview[bot] edited #104
  • 07:51
    dependabot-preview[bot] edited #104
  • 07:51
    Aaronontheweb commented #104
  • 07:43

    dependabot-preview[bot] on nuget

    (compare)

  • 07:43

    dependabot-preview[bot] on dev

    Bump Microsoft.NET.Test.Sdk fro… (compare)

  • 07:43
    dependabot-preview[bot] closed #102
  • 07:43
    Aaronontheweb commented #102
  • 06:35

    dependabot-preview[bot] on nuget

    (compare)

  • 06:35
    dependabot-preview[bot] closed #103
  • 06:35
    dependabot-preview[bot] commented #103
  • 06:35
    dependabot-preview[bot] labeled #104
Aaron Stannard
@Aaronontheweb
there's a reason they're disabled
hectorcaban
@hectorcaban

private void CreateChildUserIfNotExists(int userId)
{
if (!_srdapclients.ContainsKey(userId))
{
IActorRef newChildActorRef =
Context.ActorOf(Props.Create(() => new SRDAPClient(userId)).WithRouter(FromConfig.Instance), "SRDAPClient" + 1);

            _srdapclients.Add(userId, newChildActorRef);

            ColorConsole.WriteLineYellow(string.Format("UserCoordinatorActor created new child UserActor for {0} (Total SRDAPClient: {1})", userId, _srdapclients.Count));
        }
    }

if I am trying to configure round-robin using Hokon.

/SRDAPClient {
router = round-robin-pool
nr-of-instances = 5
routees.paths = ["/SRDAPCoornator/SRDAPClient/*"]
}

Stephen Riley
@stephen-riley
Hi gang, got a question about contexts (Contexts?) inside lambdas in Akka.net. I am trying to do a Tell() inside a ContinueWith( ...lambda... ) and the message always comes from deadLetters. However, when I put a self (closed over copy of Self) as the explicit sender in the Tell(), it works fine.
hectorcaban
@hectorcaban
since the actors are created dynamically, how do I configure the Hokon ?
Stephen Riley
@stephen-riley
So my question is, how does the Tell() work under normal circumstances when you don't give it an explicit sender?!
Code as follows:
Onur Gumus
@OnurGumus
@stephen-riley It defaults to NoSender AFAIK.
but that depends on from where you invoke I think.
Stephen Riley
@stephen-riley
var self = Self;

httpClient.GetAsync(req.Url).ContinueWith(responseTask =>
{
    var response = responseTask.Result;
    var duration = stopwatch.Elapsed.TotalMilliseconds;
    var msgResponse = new AkkaBlaster.Dto.WebResponse
    {
        StatusCode = response.StatusCode,
        Duration = duration
    };

    mylogger.Tell($"{(int)msgResponse.StatusCode} {msgResponse.Duration} - {req.Url}" /*, self */);        // <---
},
TaskContinuationOptions.AttachedToParent & TaskContinuationOptions.ExecuteSynchronously);
Onur Gumus
@OnurGumus
@stephen-riley Self itself is a property
and it requires to access to current actor within the current synch context.
what I do is ``` var self = Self; //now I can use self anywhere ````
Stephen Riley
@stephen-riley
within the current synch context
I think that's what I'm not getting.
Onur Gumus
@OnurGumus
Inside the actor if you run another thread like Task.Run ( you can't access to Self any more.
because Self invokes code and requires you to be on the message queue thread of the actor.
Stephen Riley
@stephen-riley
Yes, @OnurGumus , I have the var self = Self; thing, but I don't get why there's at least some Self defined inside the lambda I'm passing to ContinueWith().
because Self invokes code and requires you to be on the message queue thread of the actor.
OOOOOOOH! :-D
me-slove
@me-slove
It sounds like the issue isn't that. It's a closure problem. Assign a local variable and pass that through. You are running a task which means things can change
Stephen Riley
@stephen-riley
If Self is invoking code, I see the opportunity for what I'm seeing.
Okay.
Onur Gumus
@OnurGumus
yes it is. That's why I said offload it by var self = Self;
then you can use it anywhere.
Stephen Riley
@stephen-riley
I'm still not sure why my mylogger ActorSelection isn't carrying context with it, though.
var mylogger = Context.ActorSelection("/user/ConsoleLogger");
Why must I specify my closed-over self as the explicit sender in my call to mylogger.Tell()?
Onur Gumus
@OnurGumus
you don't need.
I thought you were trying to access self.
Stephen Riley
@stephen-riley
var mylogger = Context.ActorSelection("/user/ConsoleLogger");

mylogger.Tell("message");            // this does not work (always from deadLetters)

mylogger.Tell("message}", self);    // this works fine
Onur Gumus
@OnurGumus
that's not normal.
Stephen Riley
@stephen-riley
lol
Good, glad it's not just me. :smile:
Onur Gumus
@OnurGumus
No it's just you.
Stephen Riley
@stephen-riley
lol
Onur Gumus
@OnurGumus
You are probably doing some thing wrong.
Stephen Riley
@stephen-riley
Agreed. :wink:
Onur Gumus
@OnurGumus
mylogger.Tell("message"); // this should just work
Stephen Riley
@stephen-riley
Was hoping someone here would say "oh yeah, do x-y-z and you're fine". Guess I'll pull down source and deep-dive.
Onur Gumus
@OnurGumus
instead try to simplify and isolate the case.
I am sure you will find.
Stephen Riley
@stephen-riley
It totally did work until I put the code inside the lambda I'm passing to ContinueWith().
me-slove
@me-slove
actorselection is probably a reference. in which case you'd be back to the closure problem
Stephen Riley
@stephen-riley
I built the code first just using await httpClient.GetAsync()...
@me-slove , I've tried closing over it, too, and it still didn't work. Which is weird to me, cuz I figured if I'd closed over it, I'd get all the context linked to it and be fine.
me-slove
@me-slove
inside the same code block it should work though. that seems a little odd
Stephen Riley
@stephen-riley
Agreed, @me-slove , it is quite odd. I just re-tested that, still doesn't work.
var self = Self;
var context = Context;

httpClient.GetAsync(req.Url).ContinueWith(responseTask =>
{
    var mylogger = context.ActorSelection("/user/ConsoleLogger");
    var response = responseTask.Result;
    var duration = stopwatch.Elapsed.TotalMilliseconds;
    var msgResponse = new AkkaBlaster.Dto.WebResponse
    {
        StatusCode = response.StatusCode,
        Duration = duration
    };

    mylogger.Tell("message");
},
TaskContinuationOptions.AttachedToParent & TaskContinuationOptions.ExecuteSynchronously);
Onur Gumus
@OnurGumus
@stephen-riley can you actually try to resolve the selection by calling Resolve ?
Stephen Riley
@stephen-riley
The actor mylogger definitely receives the message, but it is from deadLetters, instead of from this httpclient actor.