Comments (4)
That appears to be working for me. Pity to loose some of the strong typing, but that'd be the same with BoxedMessage.
Thanks for the advice.
from ractor.
Can you make your message type
dyn Any
?
Similar to what boxed message is doing behind the scenes. It means you have to cast to the expected type within your actors handler, however that's pretty similar to what Erlang does since there is no strong typing. If you want to go that route, the supervision model will protect you from unexpected casting errors causing your actor to crash
Does that solve your need? I also have kind of stumbled across this and didn't have a great solution at the time, however I have not myself explored using the Any
type but I think it should work.
from ractor.
I'll have a look at using Any
and see.
the supervision model will protect you from unexpected casting errors causing your actor to crash
Having the Actor crash on a bad cast would prevent the next cast attempt from being tried, no? I may be misunderstanding you.
I'll try adding the Any
and see where that gets me.
from ractor.
Yes you are right, on a crash you will lose the pending message queue as it'll be cleaned up with actor teardown. If you want to persist the message queue, usually what we would do is have a supervisor, of that single actor which is trying the downcast, which manages the queue and only allows the child to process one message at a time and maintain no queue.
It would sort of be like a factory of one, where the factory maintains an internal state of the messages in queue, and the child is a worker. If the child crashes, the supervisor can capture the crash and restart the child without losing the pending message queue
from ractor.
Related Issues (20)
- Bidirectional linking can cause stack overflow on actor shutdown
- `CallResult` should return errors that occured handling the message HOT 2
- Add `Scope`-> `GroupName` mapping HOT 3
- Mod Driver Aplikasi Fake GPS HOT 1
- About section needs update for async-std
- Support `async fn` in traits. HOT 1
- Request for TCP Echo Server Example with TcpListener and TcpStream as Actors HOT 1
- Enum contains type of itself HOT 4
- When panic=abort is on, panic is not captured. HOT 1
- Lifetimes do not match method in trait HOT 2
- Subscriber-Driven OutputPort Subscriptions
- Enhancing OutputPort Backpressure Handling via RecvError::Lagged Management and Buffer Configurability HOT 6
- `post_stop` of children are being called when supervisor fails. HOT 1
- Not depend protobuf-src on windows HOT 1
- Compiler panics HOT 2
- Handle multiple message types HOT 1
- Awaiting input in an actor HOT 1
- SpawnErr when spawning named actor will permanently pollute that name
- As a subscriber, I should can subscribe multiple type of messages from publisher HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ractor.