Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8932603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:21:04+00:00 2026-06-15T09:21:04+00:00

I have a top level actor (under the guardian), called Groups which on startup

  • 0

I have a top level actor (under the guardian), called Groups which on startup needs to load the list of groups from the database and create a bunch of child actors based on those groups in the database.

I have placed the database load code inside of the preStart function as I don’t want any messages to be processed before the groups are loaded.

Currently my Groups actor looks like this;

var groups: Map[String, ActorRef] = Map()

override def preStart() = {
  groups = getGroupsFromDB() map createGroup
}

def createGroup(pair: (String, Long)) = {
  val (name, id) = pair
  val group = context.actorOf(Props(new Group(id, name)), name = name)

  name -> group
}

However I don’t believe this is the best way to handle this, as what happens if the database server is not available? So what is the best pratice way of handling data initialization from a database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:21:05+00:00Added an answer on June 15, 2026 at 9:21 am

    The Akka documentation explains how to supervise top level actors for fault-tolerance.

    You can apply the principles there to manage the exceptions you may find if the DB is not available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a top level application called SearchApp which has a sub-app called TeamApp
I have a list which only shows the top level by default. When you
My application has several independent top-level windows, which all have completely different functions/workflows. I
In the top Form1 level I have: List<float> cyclicSelectedIndex = new List<float>(2); int currentCyclicIndex;
I have a top-level page called ReceiveItem . Within that page, I have a
I have a top-level menu item which is responsible for refreshing a datagrid in
Goal I have a top-level Collection named Players and a Session variable called 'n'.
I have few top level directory which contains sub directories e.g www which are
I have a top level file called Datatypes.hs . It's exposed in my cabal
In my application I have a top level entity called Organization. The relationship between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.