These are chat archives for akkadotnet/akka.net

7th
Sep 2016
Daniel D'Agostino
@dandago2_twitter
Sep 07 2016 06:40
hi guys, when you Persist(), is there any mechanism that gives you the sequence number you just saved?
Vagif Abilov
@object
Sep 07 2016 08:21
Regarding Akka.Quartz.Actor: it would be great to publish a Nuget package for it.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 09:35
@dandago2_twitter persistent actor itself has property LastSequenceNr
Maciek Misztal
@mmisztal1980
Sep 07 2016 14:51
is anyone aware of a potential situation when Become(...) would make the actor unresponsive?
rsinohara
@rsinohara
Sep 07 2016 15:37
Hello everyone. Can someone help me? My IgnoreMessages() do not work when I run every test I have, but it works when I run just that one test.
I am recreating everything on the setup before each test.
Aaron Stannard
@Aaronontheweb
Sep 07 2016 15:37
@rsinohara you're using the Akka.NET TestKit and which implementation of it?
rsinohara
@rsinohara
Sep 07 2016 15:38
nunit
this behavior is consistent
Aaron Stannard
@Aaronontheweb
Sep 07 2016 15:38
if you're using the built-in mechanics there
and not reinventing the wheel
we guarantee that you start with a clean actorsystem each time
so this shouldn't be able to happen
@mmisztal1980 no, I'm not
rsinohara
@rsinohara
Sep 07 2016 15:40
Yes, I recreate every TestProbe, props and actors on [Setup]
If I run that test + any other one, it fails (because it doesn't ignore that message)
_actor.Tell(new GameActor.NewGameMessage(new List<PlayerData>() { _userData1, _userData2 }));

            _userActorProbe1.IgnoreMessages(m=> m is UserActor.WelcomeToGameMessage);
            _userActorProbe2.IgnoreMessages(m => m is UserActor.WelcomeToGameMessage);

            _userActorProbe1.ExpectMsg<UserActor.GameInitializedMessage>();
            _userActorProbe2.ExpectMsg<UserActor.GameInitializedMessage>();
wait. Should my IgnoreMsgs be before .Tell?
Aaron Stannard
@Aaronontheweb
Sep 07 2016 15:44
if the tell generates the messages that need to be ignored
then yep
rsinohara
@rsinohara
Sep 07 2016 15:44
I just did that and it works... why on earth did I have them after?
Aaron Stannard
@Aaronontheweb
Sep 07 2016 15:44
haha
rsinohara
@rsinohara
Sep 07 2016 15:44
Still puzzled about why it worked when that test was run individually, but there you go... I've had this issue for days lol
Aaron Stannard
@Aaronontheweb
Sep 07 2016 15:44
guess you just needed some "rubber duck debugging" for that one :p https://en.wikipedia.org/wiki/Rubber_duck_debugging
might have worked when 1 test at a time because this is a race condition
the actor will asynchronously receive those messages as part of the tell
rsinohara
@rsinohara
Sep 07 2016 15:45
I just needed to read the code after a few days off it :)
Aaron Stannard
@Aaronontheweb
Sep 07 2016 15:45
and the ignore messages is synchronous
so it was just coincidence that it worked at all - whereas when you ran the full suite you eventually hit a case where you lost the race
rsinohara
@rsinohara
Sep 07 2016 15:46
That's why this test is the only one that had this issue, as others I have ignores use TestActors
Maciek Misztal
@mmisztal1980
Sep 07 2016 15:46
@Aaronontheweb After a 3rd Become, I'm trying to do a Self.Tell(new Msg()) but that Msg is never received, even though the Receive<Msg>(...) is set in that Become(...) handler
rsinohara
@rsinohara
Sep 07 2016 15:46
btw congrats Aaron, besides the nice work on akka.net, you're an amazing speaker
rsinohara
@rsinohara
Sep 07 2016 16:15
Hmm, I cannot call methods on TestActor.UnderlyingActor... What is the recommended way to make a test actor become something, without having to go through all the state changes?
(Or is the only way to create a message handler just for this?)
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 16:28

@rsinohara think about this a little differently. Become essentially builds a state machine. C# await also builds a state machine:

DoSomething();
await DoSomethingAsync(); // in this continuation the behavior switches
DoSomethingElse();

How do you want to check if DoSomethingElse() has been called without calling first two methods before?

rsinohara
@rsinohara
Sep 07 2016 16:35
@Horusiath I'm not sure what you mean. Suppose my actor goes S1->S2->S3. I want to test S3 behavior, without having to interact with the actor to make it follow nominal path from S1 to S3.
I just want to set that state, then test its behavior, not test the state change flow.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 16:37
what I'm trying to say, is that's impossible unless you already have some start point, which allows you to omit are intermediate steps
just like you cannot execute only the last line of the method without going through every statement before
rsinohara
@rsinohara
Sep 07 2016 16:39
Well I can create a message handler that will directly call the specific Become... but I'll be creating a handler just to accommodate tests - which I'd avoid unless there is no way
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 16:41
when writing tests for akka, I usually write the whole initialization code (if it's repeatable, make a separate method from it)
rsinohara
@rsinohara
Sep 07 2016 16:42
If Underlying actor exposed methods, that would be as simples as calling a method that Becomes what I need for the test in question.
A hack would be to do it through a property setter/getter (ewww)
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 16:42
if I make a shortcut to test only the specific behavior without steps that I need to make on the way, then I'm not truly testing that behavior. Simply because the tested scenario is artificial and doesn't occur in reality
heh, testing only the behavior is something that's going to happen, when akka-typed goes out :P
rsinohara
@rsinohara
Sep 07 2016 16:45
I get what you mean now
Maybe I should rethink my testing startegy
Is there any material on actor (unit) testing?
I'd love a book about that.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 16:49
the biggest reference is akka repository - around 4000 examples ;P
rsinohara
@rsinohara
Sep 07 2016 16:50
Aren't they too low level?
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 16:51
it depends, most of them are actually integration tests - using the testkit itself
rsinohara
@rsinohara
Sep 07 2016 16:52
Interesting then. I'll take a look. Thanks :)
Jeff
@jpierson
Sep 07 2016 16:59
Is there a way to create a ConsistentHashingGroup router where the hash id determined by the sender as opposed to something in each message?
On second thought, perhaps it would be better to have some other actor responsible for providing another actor for direct communication (routee) based on a consistent hash of the sender without using a router. Is this an existing pattern already that has a name? I'm running into this where I have interfaces between external services where I wanted ordered retry logic but don't want to force everything to be processed in serial, just in proper order based on the sender to keep the sender/receiver order guarantees.
Aaron Stannard
@Aaronontheweb
Sep 07 2016 20:03
I think I'll be able to add the ability to log anything on the Scheduler that wasn't executed at the time it was shutdown
as part of some of these changes
Michael
@michaelsg
Sep 07 2016 20:16
anyone have familiarity with the F# api? I have one nagging question about the implementation of pipe operator |!>.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 20:17
@michaelsg what's up?
Michael
@michaelsg
Sep 07 2016 20:20
Had a question about the implementation of the pipeTo (|!>) operator - how it's supposed to work. I gathered that it was supposed to be non-blocking but it uses Async.StartWithContinuations which starts the async on the current thread. I think it only work right for the things like in the examples of its use - that are already-running .net things wrapped in asyncs.
if I create an f# async - not just something wrapping a task or async pattern, it blocks.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 20:21
what are you creating F# async for?
Michael
@michaelsg
Sep 07 2016 20:22
to do background work :-) sorry. not trying to be cheeky. I don't know what you mean.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 20:23
I'm just asking for the use case ;) If you're working with something that already starts an async, it should be good to go.
Michael
@michaelsg
Sep 07 2016 20:24
so that's the thing. Async (the kind you make with async {}) aren't running when they are created. and starting one does not return an async - it returns unit.
Bartosz Sypytkowski
@Horusiath
Sep 07 2016 20:25
yep, it may be a problem ;) Probably something to be fixed - can you set a github issue on that?
Michael
@michaelsg
Sep 07 2016 20:26
async { do! Async.Sleep 50000.; return AMessageToSend("hello") } |!> mbx.Self
you agree that shouldn't block?
Corneliu
@corneliutusnea
Sep 07 2016 21:44
guys, any guidance on deploying Akka cluster on Azure?
Maciek Misztal
@mmisztal1980
Sep 07 2016 21:45
depends on what you need?
Corneliu
@corneliutusnea
Sep 07 2016 21:57
anything to make my life easy-ier :smile: e.g. how do deploy lighthouse-es, experiences, dealing with azure vm virtual ips
Maciek Misztal
@mmisztal1980
Sep 07 2016 22:00
right, so far I've used lighthouse deployed on to static IaaS VMs to act as a "fixed cluster anchor" with static public IPs. when setting up the config, you need to take both the public and the private IPs into account :) As for nodes joining the cluster - those can be pretty much anything... old Azure Service Roles, WebJobs, Functions?, ServiceFabric processes, Containers - take your pick :)
Corneliu
@corneliutusnea
Sep 07 2016 22:09
thanks, that's already good advice
I'm thinking of doing everything on VMs just to keep it simpler