Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding multiple actors into ActorGroup #143

Open
darthur11 opened this issue Dec 12, 2024 · 2 comments
Open

Adding multiple actors into ActorGroup #143

darthur11 opened this issue Dec 12, 2024 · 2 comments

Comments

@darthur11
Copy link

Hi,

I have a question on this part in the documentation. So, basically it looks like multiple actors could be within one actor group. However, I didn't get how to do that properly. Cause this code doesn't work, since strategy moved due to mount method call, in previous iteration of loop.

let topology = elfo::Topology::empty();
let strategy = topology.local("strategy");
let md = topology.local("md");
for strat_bp in strategy_container.strategy_actor {
  strategy.mount(strat_bp);
};

Is there a way to configure topology in such manner that we have an ActorGroup and several actors inside it.

Thanks!

@darthur11
Copy link
Author

@loyd , could you please help here?

@loyd
Copy link
Collaborator

loyd commented Dec 14, 2024

@darthur11, thanks for the question.

If I understand correctly, you're trying to achieve the following schema:
image

Actors in a group can be spawned only by incoming messages, and you shouldn't mount them directly (you mount the blueprint for the whole group, the same for all actors inside it). I need to clarify this in the documentation.

I've written the example to help you understand the basic concepts of elfo for your case (run with cargo run --bin md, also with RUST_LOG=trace if you want to see also messaging in logs for better understanding). Note that it uses the 0.2.0-alpha version; I suggest you use it as it is very close to being released and has a lot of differences from the 0.1.x versions).

In the example, I show slightly more complex communication (strategies subscribe to interesting markets), but you can use broadcasting from MD actors. The example is simplified (without proper error handling), but I hope it will help you.

Feel free to ask more questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants