These are chat archives for akkadotnet/akka.net

23rd
Feb 2018
Vasily Kirichenko
@vasily-kirichenko
Feb 23 2018 08:42
I think Cassandra is the best option.
Martin Clode
@MClode
Feb 23 2018 10:15
The Cassandra plugin is pretty out of date, while the SQL server one seems to be being maintained. I am in the process of experimenting with all these things, just trying to find the path of least resistance :D
TonyLo1
@TonyLo1
Feb 23 2018 10:45
@Horusiath, In Akkling there does not appear to be an equivalent to Partition. Is this by design? What is the suggested alternative? My first thought is broadcast plus filters, any other suggestions?
TonyLo1
@TonyLo1
Feb 23 2018 11:11
@Horusiath, I have answered this myself :) - Partition is a junction not a flow - so not part of Akkling API currently
Bartosz Sypytkowski
@Horusiath
Feb 23 2018 13:43
@TonyLo1 Akkling API may lag a bit behind Akka.Streams - I'm not always aware about the new parts being added.
@mmisztal1980 AFAIK persistent FSM persists on events not commands - StateFunction also should be applied after event has been persisted successfully
also events describe facts that already happened, they cannot be revoked. If some state change is invalid, it should be checked before applying an event, not after that
Maciek Misztal
@mmisztal1980
Feb 23 2018 14:26
@Horusiath precisely, so in that case, how do I differentiate between a command and an event? When handles commands and Applying handles events?
Bartosz Sypytkowski
@Horusiath
Feb 23 2018 14:56
@mmisztal1980 yes, basically:
When(currentFiniteState, (e, state) =>
{
    switch (e.FsmEvent)  // this is command
    {
        case AddItem add: 
            return GoTo(nextFiniteState)
                .Applying(new ItemAdded(add.Item)); // this is event
        default: return state; // other cases
    }
});
I know that FsmEvent is misleading
Hyungho Ko
@hhko
Feb 23 2018 15:47
Hi. I've read akkadotnet/akka.net#1061
Any plans to port Akka.Http to .NET?
Ondrej Pialek
@ondrejpialek
Feb 23 2018 15:59
When I register a Cluster Singleton, do its props need t be serializable? I am registering the singleton on each node that it could run on...
Marc Piechura
@marcpiechura
Feb 23 2018 18:17
@hhko not really, we would love to but it’s too big and we don’t have the resources.
Joshua Garnett
@joshgarnett
Feb 23 2018 18:30
Yeah, Akka.Http actually started out as Spray, so lived on its own a long time before it was brought in as an Akka project
Maciek Misztal
@mmisztal1980
Feb 23 2018 18:49
@Horusiath and what would state be in this case? right now I'm getting only nulls
Dino
@DinoSourcesRex
Feb 23 2018 19:02

Hey,

I'm new to akka and I'm wondering if anyone can help me get my head around the concepts.

Using the example of sensors which poll IR tags to get positions does this sound reasonable:

A PositionMessage with a tagId,sensorType, position and a timestamp. A TagActor (per tagId) which receives this message, stores a list of x number of PositionMessage's and runs business logic to determine which position is the "true" position (sensorType can mean that one position is more likely to be correct than another).

These TagActor's can then be queried for their CalculatedPosition.

Have I gone tragically wrong anywhere with how to do this from an actor model perspective? How would I handle storage if I wanted to persist the CalculatedPosition - once calculated would I call a StorePositionActor which stores something to a datastore?

Thanks!

Joshua Garnett
@joshgarnett
Feb 23 2018 19:53
@DinoSourcesRex you can make TagActor a persistent actor, which persists events and then restores them on start. It follows the event sourcing model, so you have to manage journals/snapshots.
In general I find akka persistence a bad fit for unbouded data sets
Since when the actor is started it has to store all of that in memory
I’ve typically worked around this by creating an akka extension that wraps some database interface and returns Tasks. You can then pipe the results of those Tasks to your actor.
Martin Clode
@MClode
Feb 23 2018 20:11
That sounds like a good solution, @joshgarnett. Do you have a concrete example you could share? I'd like to play around with something similar :)
Dino
@DinoSourcesRex
Feb 23 2018 20:11
@joshgarnett The persistence of the list of Position's need only be a few seconds, and does not need to be persisted in a database - it should just be used for calculations. The CalculatedPosition is the bit I need persisting, as it is what the clients need to use.
So when the actor starts it's fine if it has no information, since the information is transient.
I'll do some reading on akka.net and persistence - I've not actually touched on that yet, just done a brief pluralsight course
Joshua Garnett
@joshgarnett
Feb 23 2018 20:17
@MClode atm it’s all internal code. I’ll see if I can open source something later on. I’ve got a pretty slick key/value store impl I’ve tossed together that has support for queries.
Martin Clode
@MClode
Feb 23 2018 20:19
That would be nice, the more examples out there of akka.net in use the better.
Joshua Garnett
@joshgarnett
Feb 23 2018 20:21
https://github.com/zynga/protoc-gen-zsharp is the most recent thing we open sourced. I need to improve the documentation and finish cleaning up a few things, but it’s a protoc plugin that generates C# protobuf code that supports event sourcing. It plays really well with Akka.Persistence.
Joshua Garnett
@joshgarnett
Feb 23 2018 20:27
Martin Clode
@MClode
Feb 23 2018 20:33
thanks :)
Maciek Misztal
@mmisztal1980
Feb 23 2018 20:44
@Horusiath and what is state in this case? I'm getting nulls all the time so far
Bartosz Sypytkowski
@Horusiath
Feb 23 2018 20:52
@mmisztal1980 this may be bug
but you should be able to reach current state from properties of PersistentFSM anyway