mardi 21 avril 2015

Why dont akka actors have a postStart method?

Here is a situation i have to deal with - I am using websockets with play framework and each websocket connection has its own Actor as described here. Now as soon as the websocket connection is made i need to start another Actor that subscribes to a Redis channel and on getting any published message to the channel passes that message to its parent i.e the Websocket Actor. So i need to start the Redis Subscriber Actor after the Websocket Actor has started. But actors dont have a postStart method. I tried creating the Redis Subscriber Actor in the preStart method of the Websocket Actor and it works fine but i dont understand the reason for Actors not having a postStart method. Isn't this a common scenario where actors create children actors. Or is this approach of doing things incorrect?

Aucun commentaire:

Enregistrer un commentaire