If the callback instance is a "stateless thread-safe service" it would be safe to share it between actor instances, otherwise your second more idiomatic approach sounds good.
/Patrik On Sun, Aug 10, 2014 at 1:58 PM, lranasingha <[email protected]> wrote: > Hi All, > I have a java client which is implemented to start a actorsystem and > connects to multiple remote akka clusters using Cluster Clients, it allows > users to execute queries passing a callback to get updates. The callback > doesn't hold any state/mutable data. But when the client execute a query it > creates multiple actors (each for a remote cluster) and use the same > callback instance to push the updates to client. I cannot use multiple > callbacks because it breaks the existing API. > > I am wondering whether this is the correct approach ? or should I create > a single actor which holds the callback and spawns multiple child actors to > execute queries and send the message to the parent actor (which holds the > callback), then parent actor pass all those messages to client through the > callback. > > This is my design at the moment > > > <https://lh3.googleusercontent.com/-7b3Z5UifpBQ/U-deEOebn6I/AAAAAAAAA9o/SpUGlrANC0c/s1600/client-callback-usage.jpg> > > > Thanks in advance. > > > > -- > >>>>>>>>>> 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 http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Patrik Nordwall Typesafe <http://typesafe.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
