These are chat archives for akkadotnet/akka.net

15th
Aug 2016
Vagif Abilov
@object
Aug 15 2016 10:46
I need to better understand how to execute persistence queries. Earlier I submitted a bug report when a query never returned. It appeared that the reason for it being stuck was Take(nnn) clause, and as long they were less than "nnn" rows in the query result stream, it didn't complete.
Fair enought, but what if a client application needs to retrieve first 100 results of the persistence query, and it's not certain that there are 100 rows satistying the query. How is such situation resolved?
Vagif Abilov
@object
Aug 15 2016 11:01
Oh I see, it's TakeWithin!
Bartosz Sypytkowski
@Horusiath
Aug 15 2016 11:01
@object akka persistence queries are not the same as standard database queries. They are live which means, that they will continuously return results as they come. In case of first 100 results from query, the flow won't be completed until 100 results will actually come or the upstream itself will complete.
Vagif Abilov
@object
Aug 15 2016 11:02
@Horusiath yes, I was too quick to treat them as LINQ queries, of coures they are not. But it looks like TakeWithin is what should be used in this case.
Bartosz Sypytkowski
@Horusiath
Aug 15 2016 11:05
TakeWithin is working as form of time window. If you need to take 100 from query, but without making them live queries, you can use readJournal.CurrentEventsByPersistenceId
Vagif Abilov
@object
Aug 15 2016 11:05
Oh that's event better in my case, thanks!
Bartosz Sypytkowski
@Horusiath
Aug 15 2016 11:05
this will create a stream of events, but only those persisted up to the time when the method has been called
Vagif Abilov
@object
Aug 15 2016 11:06
I see.
Peter Bergman
@peter-bannerflow
Aug 15 2016 13:16
A question on async operations inside actor message handlers, what would be the effect of calling an async method without awaiting it and without a call to PipeTo? Would it be like fire and forget?
Or would it just execute synchronously?
Bartosz Sypytkowski
@Horusiath
Aug 15 2016 13:17
@peter-bannerflow fire and forget :) How would you make it synchronous, if there was no way to say that async call has been made?
Peter Bergman
@peter-bannerflow
Aug 15 2016 13:18
Well, ehm yeah true :)
Gary Ewan Park
@gep13
Aug 15 2016 13:53
This might be a stupid question, but... brand new to using Akka.net, and I am playing with a proof of concept. So here goes...
I am trying to use akka.net in a Console Appliation that is using a SerialPort for external communications. When a message is received, I want to Tell a message to another actor using ActorSelection.
However, when I try to do this, I get an error message "There is no active ActorContext, this is most likely due to use of async operations from within this actor"
I get this when I try to do Context.ActorSelection("user/gep13/ThingCoordinator").Tell(new ReceieveComPortMessage(messageBytes, thingAddress));
any ideas on why I am getting that?
can I use akka in the context of a SerialPort, specifically within the DataRecieved callback method for the SerialPort?
Alex Achinfiev
@aachinfiev
Aug 15 2016 14:27
@cconstantin Does the updated version include support for having tags on the table and have materialized views similarly to the way Scala's version is written? Is this feature for id lookup provided in a different manner? Thanks.
Alex Achinfiev
@aachinfiev
Aug 15 2016 14:34
@cconstantin Looks like it does. I will check it out. This is exactly the version I was looking for since currently doing tag based id lookups has to happen in a separate custom view. Thanks.
Chris Constantin
@cconstantin
Aug 15 2016 15:44
@aachinfiev yep
Lev Lehn
@llehn
Aug 15 2016 16:39
@gep13 the error message is on spot
you can't use Context.* from a callback from serial comm, use iactorref or actirselection directly
Gary Ewan Park
@gep13
Aug 15 2016 16:43
@llehn thanks! can you point me at an example? Only started using Akka today :-)
Lev Lehn
@llehn
Aug 15 2016 17:06
I don't have any at hand, but make sure anything you pass to the datareceived event is not a method of an actor. So basically get an IActorRef of the actor ThingCoordinator before you set up the callback and inside the callback use actorRef.Tell()
Gary Ewan Park
@gep13
Aug 15 2016 17:17
@llehn ok, thank you. I will try that tomorrow.