For more Play Framework specific answers I'd ask on the play mailing list instead.
In general: If it has to be actors representing the websockets I'd let them register to a registry/broadcast actor that will keep a list of current web sockets (using watch to know if they terminate for example) and forward messages to all currently living web socket actors. In Akka Streams BroadcastHub will allow you to do something like this without involving actors directly. -- Johan Akka Team On Sun, Mar 19, 2017 at 1:08 PM, kant kodali <[email protected]> wrote: > Hi All, > > I have a message queue which doesn't have Actor concepts or anything so > what I plan to do is that on the application startup I want to start the > consumer which will then keep getting messages from the queue. Now, Play > framework creates an Actor for every Web Socket Connection and I want to be > able to group all the Actors that hold the Web Socket connection for a > particular ws endpoint so that I can broadcast all the messages that I > received from message queue on particular topic to those group of Actors. > > For Example the following end points will have an Actor created every time > a client initiates a request to any of the end point below. so lets call > them Foo actors and Bar Actors. > > ws://localshost/foo > > ws://localshost/bar > > https://www.playframework.com/documentation/2.5.x/JavaWebSockets > > Now all I want to do is this > > Pseudo code: > > messages = ReceiveMessagesFromQueue; // This is a live stream and it > never stops. > for message in messages: > if message has key1: > List<FooActors> foo_list = getAllFooActors > broadcast(message, foo_list) > else if message has key2: > List<BarActors> bar_list = getAllBarActors > broadcast(message, bar_list) > > Please Let me know if you have any suggestions on the best way to approach > this problem using Play Framework (I am using the latest version). > > Thanks! > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/ > current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
