Atin- Though it's tough to recommend an approach without knowing your specific requirements, you may want to look into Agents if they fit your use case. Sharing an Agent among Actors is perfectly safe and they provide well-defined semantics for concurrent updates. Reading the current value from an Agent is dead simple without the need to bounce messages around. You can either get the current value directly, or obtain a future that'll complete once all currently outstanding updates have been applied. Which you choose will depend on your requirements, of course.
Here's the relevant doc: http://doc.akka.io/docs/akka/snapshot/scala/agents.html I wouldn't overuse Agents in an architecture, but they're a very handy tool to have in your toolbox. That said, other comments on this thread still apply. The direct use of mutable shared state is verboten in concurrent applications! Agents safely wrap this state for you. Regards, Lance On Tuesday, August 18, 2015 at 11:05:44 AM UTC-4, Atin Sood wrote: > > Re posting since I wasn't able to get any feedback on the last post. > > On Tuesday, August 18, 2015 at 4:16:36 AM UTC-4, Atin Sood wrote: >> >> Hi >> >> >> I am new to learning akka and I am looking into a problem of trying to >> create a movie hall reservation system. I am trying to wrap my head around >> how to achieve concurrency with akka. If I end up creating multiple >> instances of akka actors then where/how should I share the global state of >> the total number of seats booked and how many are still available. >> >> >> I believe it should be in the same code that starts the actor system. Or >> am I misunderstanding the whole concept. >> >> >> In understand this is an extremely basic question but I wasn't able to >> find any good resources explaining this, so will really appreciate if you >> can point me in the right direction. >> >> >> Regards >> > -- >>>>>>>>>> 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.
