I'm trying to build a server based around small parallel actors, and I'd rather not construct them from scratch because they're such a common and generic idea. However, I can't find a framework that has the particular combination of features I'd like, namely:
- Strongly typed messages
- async message handlers (i.e. I need the actor to be able to await)
- actors not being tied to specific processors (they should be executed as and when any CPU becomes available - this appears to rule out actix in particular)
- being able to put bounds on the size of the actor's mailbox
Is anyone aware of a framework that can do all these things at once?
(I'm currently using
xactor, but I'm asking the question because I've realized that it can't do bounded channels. Further, there does not seem to be much activity on the repo so I'm unsure if it would be worth writing a PR to do this. If anyone knows more about the state of that project, that'd be appreciated as well)
I know you said you didn't want to build them from scratch, but how about building them from scratch with Tokio?
Thanks for the suggestion. I'd definitely consider writing my own, but I was hoping to leverage an existing crate out of expediency, and not having to rebuild and test the fundamentals myself. (Particularly because I was also after being able to have indirect "interface" handles to actors that implement more than one message, but all the applicable frameworks I've seen do this)
Hey, seems like GitHub - Restioson/xtra: 🎭 A tiny actor framework might live up to most - if not all - of your requirements. You can do capped mailbox size with xtra::Context - Rust
That being said, Alice's blogpost is fantastic, and I'd really recommend checking it out and see if you can expand it with handling multiple message types
My blogpost handles multiple message types with enums, though I acknowledge that the match can involve some boilerplate.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.