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 8420413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:52:58+00:00 2026-06-10T02:52:58+00:00

My app gets a new instance of Something via an API call on a

  • 0

My app gets a new instance of Something via an API call on a stateless controller. After I do my mission critical stuff (like saving it to my Postgres database and committing the transaction) I would now like to do a bunch of fire-and-forget operations.

In my controller I send the model instance to the post-processor:

import _root_.com.eaio.uuid.UUID
import akka.actor.Props
// ... skip a bunch of code
play.api.libs.concurrent.Akka.system.actorOf(
    Props[MySomethingPostprocessorActor],
    name = "somethingActor"+new UUID().toString()
) ! something

The MySomethingPostprocessorActor actor looks like this:

class MySomethingPostprocessorActor extends Actor with ActorLogging {

    def receive = {
        case Something(thing, alpha, beta) => try {
                play.api.libs.concurrent.Akka.system.actorOf(
                    Props[MongoActor],
                    name = "mongoActor"+new UUID().toString()
                ) ! Something(thing, alpha, beta)
                play.api.libs.concurrent.Akka.system.actorOf(
                    Props[PubsubActor],
                    name = "pubsubActor"+new UUID().toString()
                ) ! Something(thing, alpha, beta)
                // ... and so forth
        } catch {
            case e => {
                log.error("MySomethingPostprocessorActor error=[{}]", e)
            }
        }
    }
}

So, here’s what I’m not sure about:

I know Actor factories are discouraged as per the warning on this page. My remedy for this is to name each actor instance with a unique string provided by UUID, to get around the your-actor-is-not-unique errors:

play.core.ActionInvoker$$anonfun$receive$1$$anon$1:
    Execution exception [[InvalidActorNameException:
        actor name somethingActor is not unique!]]

Is there a better way to do the above, i.e. instead of giving everything a unique name? All examples in the Akka docs I encountered give actors a static name, which is a bit misleading.

(any other comments are welcome too, e.g. the if the bundling pattern I use is frowned upon, etc)

  • 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-10T02:52:59+00:00Added an answer on June 10, 2026 at 2:52 am

    As far as I’m aware the name paramater is optional.

    This may or may not be the case with Akka + Play (haven’t checked). When working with standalone actor systems though, you usually only name an actor when you need that reference for later.

    From the sounds of it you’re tossing out these instances after using them, so you could probably skip the naming step.

    Better yet, you could probably save the overhead of creating each actor instance by just wrapping your operations in Futures and using callbacks if need be: http://doc.akka.io/docs/akka/2.0.3/scala/futures.html

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

Sidebar

Related Questions

Is there an easy way to detect when a .NET app gets or loses
When I am trying to release the object of UIPopoverController ,app gets crashed with
I have a Django app that gets it's data completely from an external source
I have made an app that gets an array of addresses from a web
I'm trying to build an app that gets JSON from server and then shows
I am making an application (iPhone app) which gets information (jokes) from an RSS
I'm writing a WP7 app which gets website information using WebClient 's DownloadStringAsync method.
I am developing an Android app which gets an image encoded in base 64
When a user gets mailed the change password link in our app from our
I am trying to get my app automatically launched when the phone gets connected

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.