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
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!