These are chat archives for akkadotnet/akka.net

23rd
Mar 2018
Onur Gumus
@OnurGumus
Mar 23 2018 01:21
In persistent FSM if you do return Stop().AndThen(...) The code block in AndThen doesn't work. However if I do return Stop.Applying(someEvent).Andthen(...) then it works. Is this the expected behavior ?
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 07:21

Hey guys, I am still working out the web crawler example, I can't I am doing anything different from github, but sometimes I get this message:

[ERROR][3/23/18 7:18:28 AM][Thread 0003][akka://scraper/user/$b/StreamSupervisor-1/Flow-0-1-actorRefSource] The LinkedList is empty.
Cause: System.InvalidOperationException: The LinkedList is empty.
at System.Collections.Generic.LinkedList1.RemoveFirst() at Akka.Streams.Implementation.ActorRefSourceActor1.ReceiveElement(T message)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.ReceiveMessage(Object message)
at Akka.Actor.ActorCell.Invoke(Envelope envelope)

What does that mean?
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 10:07
Hello Geeks. Please how can I get the actor ref of the actor that throw an exception in the supervision stratgy?
managerger
@managerger
Mar 23 2018 11:22
@OnurGumus I've tried to invoke async operation as you suggested. But in this case we are unable to handle exceptions in decent way.
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 12:07
I think I solved my issue, I think it is a performance issue on my pc.
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 12:23
Guys, as akka.net is dotnet standard 2, I can also use it on Xamarin (droid) Do I need something like xmpp to connect the actors? Someone ever tried something like that? Just curious.
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 13:57
Would AMQP be a good way to address this, mobile clients, every mobile client a topic of their own, and an "actor system" topic to send messages back to.
?
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 14:15
AltcoinsBattle
@AltcoinsBattle_twitter
Mar 23 2018 14:49
Hey Guys,
I need to send the same message to thousands actors.
Is that OK to send it in the foreach loop or I need to consider setting up a timer and split sending to several stages (e.g. hundred actors in one tick) ?
Aaron Stannard
@Aaronontheweb
Mar 23 2018 14:58
@AltcoinsBattle_twitter love the username
but no, a for loop is fine
you're not going overwhelm anyone
@Tochemey access the Sender inside the SupervisionStrategy
that will give you what you need
AltcoinsBattle
@AltcoinsBattle_twitter
Mar 23 2018 14:59
@Aaronontheweb awesome! thanks)
Aaron Stannard
@Aaronontheweb
Mar 23 2018 14:59
@AndreSteenbergen we have a bunch of folks using Akka.NET in Xamarin apps
I, unfortunately, am not one of them
but so far it looks like most of them communicate with Akka.NET systems either using something like AMQP, Akka.Remote, or Akka.IO (direct sockets)
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 15:00
Thanks, I think I am going for the AMQP route
Aaron Stannard
@Aaronontheweb
Mar 23 2018 15:01
I'd discourage the use of Akka.Remote in its present form for client apps - Akka.Remote is extremely powerful and therefore, extremely dangerous if it's security is compromised over the public network
plus it requires you to open an inbound socket, which I believe is disallowed on some mobile platforms
we should probably just ship a client-only transport that can works only for outbound connections
and it can just use the public key exposed by a TLS-ed Akka.Remote server-side connection
but yeah, the AMQP route is fine
personally worked with some users who are doing that at scale
(more IOT than mobile, but same principle)
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 15:04
Thanks for the extra insight
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:07
Hello how do I cast an ActorSelection to IActorRef?
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:08
await actorSelection.ResolveOne(timeout)
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:08
You don't
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:08
the resolve one call give you the ref of the first actor who responds
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:08
you beat me to it
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:09
Can I use the Anchor property?
The reason I asked the question is that I need the pointer of the created Actor
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:16
Don't know, but resolving the selection returns an IActorRef, you shouldn't work with the actor instance directly
Why do you need a pointer directly to the actor? It might not even live in the current runtime
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:19
Assuming in a web api controller I have this:
subcriptionManager = _actorSystem.ActorSelection("/user/SubscriptionsManager/");
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:20
the snippet Arraon posted will give the correct ActorRef which you can tell stuff
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:20
Ok
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:21
Let me check for you I have somthing similar in my codebase
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:21
@AndreSteenbergen Thank you
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:22
var chatserverRef = system.ActorSelection("akka.tcp://chatserver@localhost:9081/user/ConversationHub").ResolveOne(TimeSpan.FromSeconds(10)).Result;
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:22
Good one
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:23
that's using Akka.Remote, but it will work with all actorselections you can think of, it will timeout if it can't find an actor
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:25
@AndreSteenbergen Thank you so much
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:25
@Aaronontheweb is there a way I can call the hyperion serializer manually? I am working on a simple chat application, and I think I read somwhere the newer hyperion serializer is better suited then json.
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:26
well you can just install the Hyperion package and instantiate it manually if need be
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:26
@Tochemey no problem, Aaron already provided the correct answer ;)
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:26
but otherwise, if Hyperion is registered as part of your ActorSystem
you can still tap into it manually
Joshua Garnett
@joshgarnett
Mar 23 2018 20:26
I strongly recommend using protobufs for actor to actor messages
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:26
Context.System.Serialization.GetSerializerForType(messageClrType)
I second what @joshgarnett said though
Joshua Garnett
@joshgarnett
Mar 23 2018 20:26
or messagepack or something else like it
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:27
schema-based serialization is your friend once you go into production
decouples the way your messages are represented on the wire from how they're represented inside your C# code
Joshua Garnett
@joshgarnett
Mar 23 2018 20:27
Only annoying thing is protobufs in C# aren’t immutable so you have to be careful
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:27
makes it much easier to manage versioning in a tolerant manner going forward
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:28
ok thanks, I'll invest some time to change my messages into protobuf compatible types
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:29
the polymorphic serialization we provide out of the box is mostly for convenience
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:29
basically I need to define order of the properties if I am not mistaken
Joshua Garnett
@joshgarnett
Mar 23 2018 20:29
Aaron, are you usually leaving your seeds untouched when rolling out code changes to an akka cluster?
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:29
yep
usually
only exception is when I need to upgrade Akka.NET itself
Joshua Garnett
@joshgarnett
Mar 23 2018 20:29
Got it
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:29
in which case, I will do a one-time deployment for the seed nodes
replace them one at a time
Joshua Garnett
@joshgarnett
Mar 23 2018 20:29
I’m finally getting around to doing a multi-node setup, we’ve been playing in our single node sandbox
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:30
and then upgrade everything else
Joshua Garnett
@joshgarnett
Mar 23 2018 20:30
I expect we’ll find some bad things we are doing :P
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:30
you might be interested in this: petabridge/akkadotnet-code-samples#66
Dockerized Lighthouse and WebCrawler
this week
Joshua Garnett
@joshgarnett
Mar 23 2018 20:30
oh cool
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:31
going to be doing a tutorial on that stuff soon - have an Akka.NET and a DevOps tool release that I need to finish first
but all of the code is there
works nicely with docker-compose
Joshua Garnett
@joshgarnett
Mar 23 2018 20:31
The nice thing is we are in k8, so each container gets a unique IP in the cluster
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:31
next phase is doing something with k8s
Joshua Garnett
@joshgarnett
Mar 23 2018 20:31
Makes clustering much easier
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:31
wow
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:32
I included a bash script in this repo: https://github.com/petabridge/akkadotnet-bootstrap
and a C# class that reads in some environment variables I standardized in Docker
for grabbing stuff like seed node addresses
nathvi
@nathvi
Mar 23 2018 20:32
Does "AKKA" stand for anything?
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:32
but that bash script will automatically grab your container's IP address
and inject it into the Akka.Remote configuration via an environment variable
@nathvi name of a mountain in Sweden
AFAIK, since it was the Scala Akka guys who came up with the name
Joshua Garnett
@joshgarnett
Mar 23 2018 20:33
Nice, I was just going to use NetworkInterface and build a remoting override in code
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:33
well let me know if that bootstrapper is helpful if you end up using it
Joshua Garnett
@joshgarnett
Mar 23 2018 20:33
k
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:33
or if it sucks / doesn't work in your environment etc
designed it for .NET Core on Linux
should theoretically work on Windows too
Joshua Garnett
@joshgarnett
Mar 23 2018 20:34
Yeah, we are an OSX/Linux shop for the most part
Linux for servers
A few devs on Windows
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:34
but the images we're building from that are all targeting whatever flavor of Linux the base .NET Core images are on
Joshua Garnett
@joshgarnett
Mar 23 2018 20:34
debian
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:34
Hello if I may ask is it possible to join a developer community to build some interesting stuffs with akka?
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:34
@Tochemey when you're in this room, you're part of one!
<3
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:35
@Aaronontheweb Thank you Sir
Aaron Stannard
@Aaronontheweb
Mar 23 2018 20:35
I regularly retweet cool stuff people are building with Akka.NET from our official Twitter account, like this project: https://github.com/SAFE-Stack/SAFE-Chat
so if you have something you want to share that you're working on, feel free to mention it in here
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:35
I would to love to assist on some projects to improve upon my Akka skills
Very cool project
nathvi
@nathvi
Mar 23 2018 20:36
From what I understand, Akka.net is basically magic that abstracts much of the network infrastructure code away and also helps to remove concurrency issues.
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:36
However I am not fun of F#
@nathvi Nope.
Joshua Garnett
@joshgarnett
Mar 23 2018 20:37
Functional programming can be interesting, I’ve seen horrible things done with it though :P
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:37
Aaron made some nice tech demos as well, check out his webcrawler
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:37
@nathvi Akka is a library around the Actor model.
to build very very cool stuffs
If you want to build network related stuff you can use DotNetty
that is also a great tool I have abused of
nathvi
@nathvi
Mar 23 2018 20:39
@Tochemey , but AKKA.Net has networking things built into it...
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:39
Yep
because it needs it to perform things like clustering
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:40
It's one of many modules, the base is the actor model
nathvi
@nathvi
Mar 23 2018 20:41
Would I be correct in assuming AKKA.Net is useful in making microservices?
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:41
You can use it to do that.
It gives you an edge to implement microservices.
nathvi
@nathvi
Mar 23 2018 20:43
I assume the following is possible. Install n number of windows services on n number of machines. Each machine has one microservice. Then have one microservice deploy Actors to the client machines. This way you can change functionality quickly.
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:43
One good thing I have learnt during my little experience with Akka is how I could use it to avoid c# event delegate
Just by abusing of the message pattern
Oh yep
nathvi
@nathvi
Mar 23 2018 20:44
That is freaking awesome!
I just recently learned of AKKA
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:44
Welcome to the family
nathvi
@nathvi
Mar 23 2018 20:44
I've been looking for something like this for a while.
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:45
@nathvi for a good introduction in akka, you could try the bootcamp
nathvi
@nathvi
Mar 23 2018 20:45
@AndreSteenbergen ! I've gotten through most of the first part :)
Very well written.
Your documentation as far as I know is really good.
I was manually implementing much of the actor model with redis + msgs queues
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:49
Can't take credit for the documentation, you should credit @Aaronontheweb and others.
Marc Piechura
@marcpiechura
Mar 23 2018 20:49
@Tochemey if you’re looking for something you want to contribute directly to akka I would look for issues with the „good for first time contributors“ label. Some of them are C# only and some requiring to port some scala code to C# but all are small enough to get you started
nathvi
@nathvi
Mar 23 2018 20:49
@Aaronontheweb , your documentation is amazing. Please never let it get as bad as servicestack.
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 20:49
@marcpiechura Thanks for the advice
nathvi
@nathvi
Mar 23 2018 20:50
What else can you use AKKA.NET besides microservices?
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 20:53
Any high concurrent system I guess, based on the 1 message at a time idea with lots of actors in a system
no locks needed etc.
Joshua Garnett
@joshgarnett
Mar 23 2018 20:53
Telecom industry used actors a lot, typically with Erlang
nathvi
@nathvi
Mar 23 2018 20:53
I read that.
Erickson language?
Functional?
late 80s?
Joshua Garnett
@joshgarnett
Mar 23 2018 20:54
Yeah oldschool
The actor model is based off a paper in the 70s
nathvi
@nathvi
Mar 23 2018 20:55
Nice
I heard some guy used it at ABB
Saw a YouTube video on it
Joshua Garnett
@joshgarnett
Mar 23 2018 21:01
We are using it on our game servers at Zynga
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 21:04
We have used to build the entire payment platform at hubtel in Ghana (https://hubtel.com/payments/)
where I am the dev lead.
I can tell you we have increased our processing power by almost 80%
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 21:06
@joshgarnett I am trying the protobuf changes right now, would you recommend a proto file, or c# attributes
Joshua Garnett
@joshgarnett
Mar 23 2018 21:06
Use proto3 vs protobuf.net
so proto file :)
AndreSteenbergen
@AndreSteenbergen
Mar 23 2018 21:07
thanks, that way I can leave my c# classes alone right
Joshua Garnett
@joshgarnett
Mar 23 2018 21:07
Yep
Marc Piechura
@marcpiechura
Mar 23 2018 21:07
Maybe we should add a success stories page to the docs 😄
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:07
@nathvi I have a lot of customers in IOT who use Akka.NET in everything from power plants, shipping / transportation, manufacturing, etc
we have one but it's pretty spare at the moment
Marc Piechura
@marcpiechura
Mar 23 2018 21:08
Oh really ? Where? ^^
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 21:08
:smile:
would you guys mind submitting some pull requests to this? @joshgarnett @Tochemey
Arsene Tochemey GANDOTE
@Tochemey
Mar 23 2018 21:10
That will be great.
Joshua Garnett
@joshgarnett
Mar 23 2018 21:10
Once we ship, I’ll work on getting permission from Legal. Big orgs get cranky about some of that stuff.
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:10
yeah, that's a common problem @joshgarnett
I'm hiring an assistant who can help me finally gather some case studies from Petabridge's customers, which has been something I've been totally slacking on
not because it's not important, but because it's not urgent - project has been growing rapidly on word of mouth alone. But the success stories are important for developers who really want to use the technology to persuade management to buy-in
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:15
"social proof," as the saying goes
nathvi
@nathvi
Mar 23 2018 21:18
@Aaronontheweb , this framework is magic
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:19
@nathvi welp, @marcpiechura and other members of the core team like me are glad you think so :D
it's been a game changer for all of us too
nathvi
@nathvi
Mar 23 2018 21:19
I haven't even implemented microservices using it, and I can't imagine doing it without it XD
The ability to remotely deploy actors is amazing
Plus, the way it integrates with lighthouse + gossip. Amazing
Essentially creating a distributed directory for the services in the event of network failures
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:21
it builds upon the solid original designs of the JVM Akka team
but that cluster design methodology comes from Amazon's DynamoDb originally
nathvi
@nathvi
Mar 23 2018 21:21
Nice.
This stuff is really quite fascinating.
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:21
the original whitepaper they wrote was one of the original inspirations for the NoSQL movement, along with the big table and map reduce white papers by Google
distributed databases like Riak and Cassandra are built off of the same cluster design for high availability
what's cool about Akka vs any of that stuff though
is that it gives you the ability to build stuff from scratch on top of the protocol
rather than just using a piece of off-the-shelf software that does it
nathvi
@nathvi
Mar 23 2018 21:23
Standing on the shoulders of giants
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:23
an apt way of putting it
nathvi
@nathvi
Mar 23 2018 21:23
Standing on the Akka mountain.
I could use this to build my crypto currency!
yaaas
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:26
yep
in theory you could
nathvi
@nathvi
Mar 23 2018 21:26
If possible, can you link me to those whitepapers?
that's the big list for all of the Amazon ones
which runs the gamut
actually
that looks like a bunch of marketing stuff
let me find the real deal
nathvi
@nathvi
Mar 23 2018 21:29
lol
here you go
that's the original technical whitepaper
not some marketing BS for people who can't figure out if they need Dynamo or Oracle
Joshua Garnett
@joshgarnett
Mar 23 2018 21:30
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:30
the original Dynamo concepts I think were the idea of ring-based partitioning and using that to drive replicas too
and the usage of a gossip protocol was necessary for getting all of the topology information about which replicas were / were not available
"tunable consistency"
like, I think what was original about Dynamo wasn't any one idea
nathvi
@nathvi
Mar 23 2018 21:31
Thanks!
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:31
but the combination of all of them
Akka.NET's "ring-based partitioning" comes from consistent hashing routers and Cluster.Sharding's use of the same algos for shard placement
doesn't quite have the same opinionated design that Dynamo does since we're not a database - we're a multi-purpose framework
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:33
thanks! hope you liked it
nathvi
@nathvi
Mar 23 2018 21:33
I did. Though, I'm not sure I understand this...
"I can’t understate ..." Should that be "I can't overstate"?
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:34
probably
I just kind of rifle those posts out extemporaneously
nathvi
@nathvi
Mar 23 2018 21:34
:)
Aaron Stannard
@Aaronontheweb
Mar 23 2018 21:34
and I don't go back and revise them
which... is probably not a best practice
nathvi
@nathvi
Mar 23 2018 21:34
lol,
I think open source software has had a huge part in pushing Microsoft to be more open
It's hard to compete with free
Looking to make my own company.