actix icon indicating copy to clipboard operation
actix copied to clipboard

Question: How to wait for an event on actor startup?

Open LasseRosenow opened this issue 3 years ago • 1 comments

I have an Actor that sets up an MQTT Server, but I only want the server to start, after I received a Message DatabaseConnection.

What would be the recommended way to do this?

LasseRosenow avatar Mar 22 '22 03:03 LasseRosenow

Two ideas:

  1. Use another actor to spawn the actor that manages the MQTT server, that second actor has an handler for the database connection message.
  2. In the actor, make the managed server and option and spawn in the handler of the database connection message

Sytten avatar May 24 '22 22:05 Sytten