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

1
open
LasseRosenow
LasseRosenow
Posted 1 year ago

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

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?

Sytten
Sytten
Created 10 months ago

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