These are chat archives for akkadotnet/akka.net

26th
Apr 2018
Thomas Lazar
@thomaslazar
Apr 26 2018 10:53
good time of the day to you all.
just wanted to ask if there are ways to use akka.net in a xamarin.forms ios app yet?
Keith Nicholas
@keithn
Apr 26 2018 12:25
New to akka.net (well, I have done a little with it in the past, but trying to dig into how clustering works) .... In a cluster, how is state and identity handled? For example, lets say I have a very simple "iot" system which tracks toggle switches ( so each activation would toggle something between off and on) . You have a number of nodes that can handle switch activations. I'm thinking initially you'd have something that would register something like switch23 and some node that gets the registration message would create an actor for switch23 and track its state. So now, on some other node via some kind of gateway to real hardware, we get a message saying switch23 was pressed. How do you get to the right node that has switch23? If that node disappears, how does another node pickup where the last one left it?
Paweł Bańka
@pmbanka
Apr 26 2018 12:28
@keithn you can use cluster sharding for that https://petabridge.com/blog/introduction-to-cluster-sharding-akkadotnet/
Keith Nicholas
@keithn
Apr 26 2018 12:37
ok, so that handles it by relying on a persistence store that's visible to all nodes. Sort of cheating as it pushes the distributed problem to the store? I would guess the other way would be to replicate the state to all nodes ( much like replication in your persistence store ) if you didn't want to rely on external persistence?
me-slove
@me-slove
Apr 26 2018 12:39
It's not necessarily persistent @keithn . Sharding is a routing technique. You can certainly persist the events (Commands as they are named to match CQRS I imagine) if you wish.
Keith Nicholas
@keithn
Apr 26 2018 12:42
not necessarily persistent? the above link seems to imply it has to be?
me-slove
@me-slove
Apr 26 2018 12:43
from the doc: Often times end-users will create persistent actors so the entities can recover their state from a database when started again in the future. In this case we’re going to stick with a simple actor, non-persistent actor.
Keith Nicholas
@keithn
Apr 26 2018 12:45
just after that it says "Since cluster sharding makes use of Akka.Persistence plugin to keep consistent view on a location of each shard, we need to setup both an event journal and a snapshot store. The thing to remember here is that those stores must refer to a database that can be accessed by every cluster node participating in cluster sharding protocol."
me-slove
@me-slove
Apr 26 2018 12:45
the key point for sharding is properly defining your entity id so that anything related to a specific actor gets routed there so you can manage the state in one actor. You may, especially in your case, decide not to persist individual switch states if they are changing somewhat rapidly AND the history of state changes is not critical. On the other hand, you could if you need to precisely reproduce all states.
right. the point about that is that if you use persistence, you have to use a centralized store because you can't know where the shard may be located (one of the most powerful features of cluster, imo, is location independence)
I highly recommend the petabridge training. @Aaronontheweb goes into detail and is great at explaining the complexities and answering questions.
me-slove
@me-slove
Apr 26 2018 12:50
I don't get a cut but have been through it and received tremendous insight and value
Keith Nicholas
@keithn
Apr 26 2018 12:56
The training looks good, but at the moment I'm more at an evaluation stage. Also, looking at http://getakka.net/articles/clustering/cluster-sharding.html it says there is a experimental distributed data module that can be used also
me-slove
@me-slove
Apr 26 2018 13:06
I haven't used it so because our use cases don't really need it but it does look interesting
Peter Shrosbree
@pshrosbree
Apr 26 2018 13:45
What is the thinking behind the logging methods other Error than not taking an exception as an argument?
If you have an exception in hand, such as a transient error from an Azure call, you want to log the exception as an exception and retry. This is not an error, because it is an expected condition that the system is designed to handle. You want to log the exception as a special parameter to leverage the exception support in the logging provider, so that if it happens frequently you can investigate. You do not want to log it as an error, because errors may support calls.
I would expect all the logging methods to have the same signatures as Error.
Is there an intentional reason they do not?
Aaron Stannard
@Aaronontheweb
Apr 26 2018 15:35
@me-slove glad you liked it! Also, just realized I screwed up the YAML that we use to power our training schedule and somehow our April 30th Design Patterns training date wasn't listed. Just fixed that a few minutes ago: https://petabridge.com/training/#schedule
note to self: probably time to start automating more of that...
@pshrosbree ah I see what you're getting at
yeah, I'd support that API change
although... let me check something rq
yeah, ok that's what I thought
we'd need to add some new constructors to the Info, Debug event classes
and nearly 100% of those event types are created from inside this base class: https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka/Event/LoggingAdapterBase.cs
so I think all we'd need to do is add some new overloads to LoggingAdapterBase and some new constructor overloads to the other event types... And all of the string formatting around printing those log event types out is handled internally in their .ToString() methods IIRC
Aaron Stannard
@Aaronontheweb
Apr 26 2018 15:40
so I think those changes could probably be made in a binary-compatible way
I'd need to see what the other core devs think but IMHO, seems like a reasonable change to me
would you mind opening an issue?
@hhko hmm, just saw this
yeah we use pooled buffers by default
I'll DM you - I think it'd be useful to get some more data on this issue
the memory consumption bits
as for the ActorSelection stuff
Aaron Stannard
@Aaronontheweb
Apr 26 2018 15:48
there are some very weird inconsistencies that I've been meaning to fix here: akkadotnet/akka.net#3296
Peter Shrosbree
@pshrosbree
Apr 26 2018 15:52
@Aaronontheweb Sure, I'll open an issue.
Aaron Stannard
@Aaronontheweb
Apr 26 2018 15:53
much appreciated
Ryan Anthony
@ryandanthony_twitter
Apr 26 2018 16:02

HI all, I am looking for some advice here. If I have a stream of events from Kafka (as a consumer) I need to ingest into my Akka system, do I create an actor to do that work? i.e. is there an existing idea of a “service” actor that does non-message based work and uses Akka system to manage its lifecycle? If there isn’t one built in, is there any reason I shouldn’t create one?

Or do I create a non-actor based service that uses an:

Akka.Actor.Inbox

?

Aaron Stannard
@Aaronontheweb
Apr 26 2018 16:04
@ryandanthony_twitter would this be helpful? AkkaNetContrib/Alpakka#32
we have an Akka.Streams adapter that can ingest events from Kafka, although that's still staged in a PR. But that's the approach I'd recommend
but anyway, when working with other external messaging systems
i.e. WebSockets, message brokers, Azure Queues, EventHubs, etc
the approach I've gone with is Akka.Streams adapters of some kind
Ryan Anthony
@ryandanthony_twitter
Apr 26 2018 16:05
k let me dive into this
Aaron Stannard
@Aaronontheweb
Apr 26 2018 16:05
had really great success consuming real-time order book data over a websocket feed (cryptocurrency exchange) using this technique personally
haven't tried it with Kafka specifically myself though
Ryan Anthony
@ryandanthony_twitter
Apr 26 2018 16:06
yea. I was actually planning on using NATS streaming instead of Kafka, but it was easier to say Kafka :)
Aaron Stannard
@Aaronontheweb
Apr 26 2018 16:07
haha
Seyedamirhossein Hesamian
@amir734jj
Apr 26 2018 17:03
Hi, I am wondering is there Akka client for C# .net?
Ryan Anthony
@ryandanthony_twitter
Apr 26 2018 17:19
random question for anyone who has done the Petabridge tranining.. How long are the sessions? looks like they start at 16:00 UTC...
6 hours? 8 hours?
me-slove
@me-slove
Apr 26 2018 17:21
ours varied a bit but @Aaronontheweb stayed on until everyone's questions were answered. all were over 4 hours
Marc Piechura
@marcpiechura
Apr 26 2018 17:23
@amir734jj I suppose you think you are in the Java Akka room ? But in fact you’re already at the right place, this is the room of the .Net port from Akka ;-)
Gabriel Marquez
@gblmarquez
Apr 26 2018 17:42
hello, I have a doubt about ClientCluster.
We have an akka cluster and we need to send message to a webapp that not belongs to the cluster, so we decide to use the ClusterClient method.
We are having issues when the cluster client (webapp), because it not found the receptionist when the register service are not on the initial nodes.
Do we need use initial nodes as the same nodes that had registered the services? Because we are using the lighthouse nodes (5) as the initial nodes.
Ryan Anthony
@ryandanthony_twitter
Apr 26 2018 18:04
@me-slove thanks
Aaron Stannard
@Aaronontheweb
Apr 26 2018 18:06
@gblmarquez it should be able to find other nodes that join the cluster
but yeah, the nodes that receive contact from the ClusterClient initially
need to be configured to listen for incoming cluster client connections
so if your app is contacting lighthouse
you might want to make sure those lighthouse nodes have the cluster client receptionist running
you can do that via HOCON
Gabriel Marquez
@gblmarquez
Apr 26 2018 18:08
for now, if the webapp (cluster client) uses as initial nodes the non-lighthouse nodes everything works fine. but if we use the lighthouse, the messages are not delivered
@Aaronontheweb thanks! I'll test again, with that.
Gabriel Marquez
@gblmarquez
Apr 26 2018 19:00
@Aaronontheweb the lighthouse nodes must have the same class types thar are been sending from webapp to the other nodes?
Ryan Anthony
@ryandanthony_twitter
Apr 26 2018 20:56

If i have an actor that does: Context.System.EventStream.Publish(@event), how do I subscribe to it via a stream?

I have tried:

           Source.AsSubscriber<object>()
               .RunForeach(@object =>
               {
                   Console.WriteLine($"@object:{@object.GetType().Name}");
               }, materializer);
Onur Gumus
@OnurGumus
Apr 26 2018 23:15
I am looking for symbols of akka.net.