Best practice for naming akka-actors (in the companion object)Discovery of Akka actors in clusterConfusion over Akka Actors vs Java Objectscreating Akka actor hierarchies lazilyHow do I create a TestActorRef in Scala for an Actor with constructor params?Akka - Common service actor: Identify or ExtensionAkka cluster-sharding: Can Entry actors have dynamic propsWhat are the implications of nesting an akka Actor class in an object to the members of the class?How do I create a “Locator” for Akka ActorsAkka and singleton actorsScala: How to extend an Akka actor?

Is exact Kanji stroke length important?

Unreliable Magic - Is it worth it?

Why Were Madagascar and New Zealand Discovered So Late?

How can I kill an app using Terminal?

CREATE opcode: what does it really do?

How to pronounce the slash sign

Do sorcerers' Subtle Spells require a skill check to be unseen?

How does Loki do this?

Escape a backup date in a file name

Is a stroke of luck acceptable after a series of unfavorable events?

How to draw lines on a tikz-cd diagram

What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?

How to be diplomatic in refusing to write code that breaches the privacy of our users

Was Spock the First Vulcan in Starfleet?

How does it work when somebody invests in my business?

Is expanding the research of a group into machine learning as a PhD student risky?

What is the opposite of 'gravitas'?

How do I extract a value from a time formatted value in excel?

Customer Requests (Sometimes) Drive Me Bonkers!

Trouble understanding the speech of overseas colleagues

Increase performance creating Mandelbrot set in python

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Anatomically Correct Strange Women In Ponds Distributing Swords

What happens if you roll doubles 3 times then land on "Go to jail?"



Best practice for naming akka-actors (in the companion object)


Discovery of Akka actors in clusterConfusion over Akka Actors vs Java Objectscreating Akka actor hierarchies lazilyHow do I create a TestActorRef in Scala for an Actor with constructor params?Akka - Common service actor: Identify or ExtensionAkka cluster-sharding: Can Entry actors have dynamic propsWhat are the implications of nesting an akka Actor class in an object to the members of the class?How do I create a “Locator” for Akka ActorsAkka and singleton actorsScala: How to extend an Akka actor?













0















I have several akka-actors defined like this:



object SomethingActor 
val name: String = "somethingActor"
def props: Props = Props(new SomethingActor())


class somethingActor extends Actor
verride def receive: Receive = ???


// somewhere else
final val myActor = actorSystem.actorOf(SomethingActor.props, SomethingActor.name)


Of these actors, only up to one single instant is "alive" at any given moment of my application, so e.g. a new SomethingActor actor can only be created if the old SomethingActor is dead.



Now, I don't think defining the actor name like this: val name: String = "somethingActor" is very nice, so I have been wondering if I can use something like this:



object SomethingActor 
val name: String = this.getClass.getName
def props: Props = Props(new SomethingActor())



Would this be considered bad practice? Is there a better way to handle this? I (think I) need to save the name in the companion object to be able to search for the actor from another point in my program using ActorSystem.actorSelection(path: String) (docu).










share|improve this question






















  • I think this.getClass.getName is a good practice. Of these actors, only up to one single instant is alive at any given moment of my application Kindly confirm the mentioned feature you want or not ?

    – Shantiswarup Tunga
    Mar 22 at 9:58











  • Of these actors, only up to one single instant is alive at any given moment of my application This is the case in my application and I do not intend to change that. :)

    – Florian Baierl
    Mar 22 at 13:04











  • Then I think your approach is a good.

    – Shantiswarup Tunga
    Mar 22 at 17:14















0















I have several akka-actors defined like this:



object SomethingActor 
val name: String = "somethingActor"
def props: Props = Props(new SomethingActor())


class somethingActor extends Actor
verride def receive: Receive = ???


// somewhere else
final val myActor = actorSystem.actorOf(SomethingActor.props, SomethingActor.name)


Of these actors, only up to one single instant is "alive" at any given moment of my application, so e.g. a new SomethingActor actor can only be created if the old SomethingActor is dead.



Now, I don't think defining the actor name like this: val name: String = "somethingActor" is very nice, so I have been wondering if I can use something like this:



object SomethingActor 
val name: String = this.getClass.getName
def props: Props = Props(new SomethingActor())



Would this be considered bad practice? Is there a better way to handle this? I (think I) need to save the name in the companion object to be able to search for the actor from another point in my program using ActorSystem.actorSelection(path: String) (docu).










share|improve this question






















  • I think this.getClass.getName is a good practice. Of these actors, only up to one single instant is alive at any given moment of my application Kindly confirm the mentioned feature you want or not ?

    – Shantiswarup Tunga
    Mar 22 at 9:58











  • Of these actors, only up to one single instant is alive at any given moment of my application This is the case in my application and I do not intend to change that. :)

    – Florian Baierl
    Mar 22 at 13:04











  • Then I think your approach is a good.

    – Shantiswarup Tunga
    Mar 22 at 17:14













0












0








0








I have several akka-actors defined like this:



object SomethingActor 
val name: String = "somethingActor"
def props: Props = Props(new SomethingActor())


class somethingActor extends Actor
verride def receive: Receive = ???


// somewhere else
final val myActor = actorSystem.actorOf(SomethingActor.props, SomethingActor.name)


Of these actors, only up to one single instant is "alive" at any given moment of my application, so e.g. a new SomethingActor actor can only be created if the old SomethingActor is dead.



Now, I don't think defining the actor name like this: val name: String = "somethingActor" is very nice, so I have been wondering if I can use something like this:



object SomethingActor 
val name: String = this.getClass.getName
def props: Props = Props(new SomethingActor())



Would this be considered bad practice? Is there a better way to handle this? I (think I) need to save the name in the companion object to be able to search for the actor from another point in my program using ActorSystem.actorSelection(path: String) (docu).










share|improve this question














I have several akka-actors defined like this:



object SomethingActor 
val name: String = "somethingActor"
def props: Props = Props(new SomethingActor())


class somethingActor extends Actor
verride def receive: Receive = ???


// somewhere else
final val myActor = actorSystem.actorOf(SomethingActor.props, SomethingActor.name)


Of these actors, only up to one single instant is "alive" at any given moment of my application, so e.g. a new SomethingActor actor can only be created if the old SomethingActor is dead.



Now, I don't think defining the actor name like this: val name: String = "somethingActor" is very nice, so I have been wondering if I can use something like this:



object SomethingActor 
val name: String = this.getClass.getName
def props: Props = Props(new SomethingActor())



Would this be considered bad practice? Is there a better way to handle this? I (think I) need to save the name in the companion object to be able to search for the actor from another point in my program using ActorSystem.actorSelection(path: String) (docu).







scala akka akka-actor






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 15:59









Florian BaierlFlorian Baierl

7551829




7551829












  • I think this.getClass.getName is a good practice. Of these actors, only up to one single instant is alive at any given moment of my application Kindly confirm the mentioned feature you want or not ?

    – Shantiswarup Tunga
    Mar 22 at 9:58











  • Of these actors, only up to one single instant is alive at any given moment of my application This is the case in my application and I do not intend to change that. :)

    – Florian Baierl
    Mar 22 at 13:04











  • Then I think your approach is a good.

    – Shantiswarup Tunga
    Mar 22 at 17:14

















  • I think this.getClass.getName is a good practice. Of these actors, only up to one single instant is alive at any given moment of my application Kindly confirm the mentioned feature you want or not ?

    – Shantiswarup Tunga
    Mar 22 at 9:58











  • Of these actors, only up to one single instant is alive at any given moment of my application This is the case in my application and I do not intend to change that. :)

    – Florian Baierl
    Mar 22 at 13:04











  • Then I think your approach is a good.

    – Shantiswarup Tunga
    Mar 22 at 17:14
















I think this.getClass.getName is a good practice. Of these actors, only up to one single instant is alive at any given moment of my application Kindly confirm the mentioned feature you want or not ?

– Shantiswarup Tunga
Mar 22 at 9:58





I think this.getClass.getName is a good practice. Of these actors, only up to one single instant is alive at any given moment of my application Kindly confirm the mentioned feature you want or not ?

– Shantiswarup Tunga
Mar 22 at 9:58













Of these actors, only up to one single instant is alive at any given moment of my application This is the case in my application and I do not intend to change that. :)

– Florian Baierl
Mar 22 at 13:04





Of these actors, only up to one single instant is alive at any given moment of my application This is the case in my application and I do not intend to change that. :)

– Florian Baierl
Mar 22 at 13:04













Then I think your approach is a good.

– Shantiswarup Tunga
Mar 22 at 17:14





Then I think your approach is a good.

– Shantiswarup Tunga
Mar 22 at 17:14












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284553%2fbest-practice-for-naming-akka-actors-in-the-companion-object%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284553%2fbest-practice-for-naming-akka-actors-in-the-companion-object%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript