Getting started with the stact framework
Asked Answered
E

1

7

I have been looking through the Topshelf code, and notice that it is using an assembly called 'stact.dll'. There does not seem to be a lot of information around on this. It seems to be a library for building concurrent applications using actors and 'channels'. I find the Topshelf code a bit hard to follow, but I am interested in finding out more about this style of programming. Has anyone had any experience with this library? How did you go about learning how to use it?

Existentialism answered 30/3, 2011 at 8:12 Comment(1)
This description of Actor v.s. thread modeling in Erlang / Scala is conceptually related to Stact. Perhaps it helps to give some background. ruben.savanne.be/articles/concurrency-in-erlang-scala And these are references collected by Chris himself blog.phatboyg.com/2011/11/26/…Rior
L
6

Stact is currently only really used internally at the moment. It's something we've built up from our experiences writing concurrent software and mostly the work of Chris Patterson (https://github.com/phatboyg/Stact).

The simplest example I can think of that's out there is from Cashbox. https://github.com/Cashbox/Cashbox/blob/v1.0/src/Cashbox/Engines/FileStorageEngine.cs

You have a channel which passes messages. On one end of that channel you set up the message subscriptions. Line 72 builds the subscriptions, setting a handler action for each message type it expects. The HandleOnFiber(_fiber) is forcing all messages to be processed on the same thread and they are queued up as they are received. There are other handle calls and hopefully the API is rather discoverable.

Now this example hides all the channels and fibers in one class, you might have channels connecting different classes in which case a reference to the channel in question would have to be passed around.

Stact is really an Actor library. There aren't any great examples, at the moment, of using it to write actors. I hope this helps.

Lonnielonny answered 30/3, 2011 at 11:55 Comment(2)
Thanks Travis. I'll check out the cashbox example and try and get my head around it.Existentialism
So it is, updated to one that works. This is using an old version of Stact, so I'm not sure how much the APIs have changed. I haven't touched this code in a couple years. I think the ideas are still the same, just might have to explore the APIs a little bit to find the right place.Lonnielonny

© 2022 - 2024 — McMap. All rights reserved.