Hi 

We have two requirement:

   1. Send *User based notification* to UI for some 
   Processing/operation(performed by User). Notifications for Operation will 
   be like(Started, In Progress,Completed) 
   2. Read messages/*User based notification* from RabbitMQ .Save these 
   messages in DB and then send *User based notification to UI*

*Technology *: *Server sent events was chosen* over short,long Polling and 
WebSockets
We are using *Akka Streaming along with Play framework *to implement 
SSE.(Scala(2.11/2.12) 
with Play framework(2.6.x). Library: *akka.stream.scaladsl.Source*)

We have written below code to add notifications in Queue. Now we want to 
push these notifications on UI

   object NotficationUtil {

      var userNotificationMap = Map[Integer, Queue[String]]()

      def addUserNotification(userId: Integer, message: String) = {
        var queue = userNotificationMap.getOrElse(userId, Queue[String]())
        queue += message
        userNotificationMap.put(userId, queue)

      }
    }


*Issue: Not sure which type of source should be created . Because as soon 
as all elements in source has been pushed to UI,  event streams got 
closed. *
*And in our use case , Queue or any collection will be empty if there are 
no messages to be pushed from Rabbit MQ or user has not performed some X 
operation.*

Question 1: Is *SSE valid USE CASE for our scenario*?
Question 2: If SSE is valid for our scenario*,how can we create **stream 
that will be infinite( and connection will remain open) and will be closed 
only my session is logged off or we can explicitly close it*.
Question 3: If we cannot *create infinite stream when s**erver does not 
have anything *for hours then if *browser trying to reestablish connection 
**every 
second will it be an overkill or Is this an acceptable solution in 
industry?*

-- 
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user 
google-group soon.
** This group will soon be put into read-only mode, and replaced by 
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>> 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to