can an ActorSystem be found?

707 views
Skip to first unread message

Pepe

unread,
Apr 4, 2012, 10:13:24 AM4/4/12
to Akka User List
if the next line is executed:
ActorSystem.create("my-system");

Does Akka offer the possibility of searching for a previously created
ActorSystem?:
ActorSystem mySystem = ?????.find("my-system")

√iktor Ҡlang

unread,
Apr 4, 2012, 10:15:29 AM4/4/12
to akka...@googlegroups.com
What's the use-case?

Cheers,
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Pepe

unread,
Apr 4, 2012, 10:28:57 AM4/4/12
to Akka User List
I guess that's a convoluted way of saying "No".
;)

√iktor Ҡlang

unread,
Apr 4, 2012, 10:41:36 AM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 4:28 PM, Pepe <ppr...@googlemail.com> wrote:
I guess that's a convoluted way of saying "No".
;)

No, that's a way of me trying to understand what you're trying to do, so I can offer a better suited alternative.

Cheers,

 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Pepe

unread,
Apr 4, 2012, 10:43:58 AM4/4/12
to Akka User List
I thought that the name parameter used when creating an ActorSystem
was some kind of unique identifier.
I run the next code:
ActorSystem s1 = ActorSystem.create("s1");
ActorSystem s2 = ActorSystem.create("s1");
System.out.println("==? " + (s1==s2));
System.out.println("s1: " + s1);
System.out.println("s2: " + s2);
I was expecting:
- an error when creating the second ActorSystem
- or that s1 and s2 were the same object
but the console output was:
==? false
s1: akka://s1
s2: akka://s1

What's the purpose of the ActorSystem's name ??

√iktor Ҡlang

unread,
Apr 4, 2012, 10:46:03 AM4/4/12
to akka...@googlegroups.com

Cheers,
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Pepe

unread,
Apr 4, 2012, 10:49:03 AM4/4/12
to Akka User List
I was trying to create a custom Dispatcher.
That dispatcher needs to create an internal counter Actor to count the
messages queued and processed.
I need an ActorSystem to create that counter.
I was thinking on using the default ActorSystem.
Should I create a new one just for that actor?

Pepe

unread,
Apr 4, 2012, 11:22:52 AM4/4/12
to Akka User List
Maybe I'm too thick but I cannot get an explanation of having two
ActorSystem with the same name.

Akka Team

unread,
Apr 4, 2012, 11:32:08 AM4/4/12
to akka...@googlegroups.com
Same reason you can have the same username at different domains:

 
Cheers,


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

Pepe

unread,
Apr 4, 2012, 11:40:42 AM4/4/12
to Akka User List
What has the "domain" role in the ActorSystem example ?

On Apr 4, 5:32 pm, Akka Team <akka.offic...@gmail.com> wrote:
> On Wed, Apr 4, 2012 at 5:22 PM, Pepe <ppr...@googlemail.com> wrote:
> > > The docs shall set you free:
> >http://doc.akka.io/docs/akka/2.0/general/addressing.html
>
> > Maybe I'm too thick but I cannot get an explanation of having two
> > ActorSystem with the same name.
>
> Same reason you can have the same username at different domains:
>
> viktor.kl...@typesafe.com != viktor.kl...@gmail.com

√iktor Ҡlang

unread,
Apr 4, 2012, 10:57:21 AM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 4:49 PM, Pepe <ppr...@googlemail.com> wrote:
I was trying to create a custom Dispatcher. 
That dispatcher needs to create an internal counter Actor to count the
messages queued and processed.

You don't need to create a custom dispatcher for that. Make the Actor that keeps track of the unfinished work manifested in your application.

Cheers,
 
I need an ActorSystem to create that counter.
I was thinking on using the default ActorSystem. 
Should I create a new one just for that actor?
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Akka Team

unread,
Apr 4, 2012, 11:45:53 AM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 5:40 PM, Pepe <ppr...@googlemail.com> wrote:
What has the "domain" role in the ActorSystem example ?

It's pretty well explained in the previously mentioned link.

Cheers,

Pepe

unread,
Apr 4, 2012, 11:58:06 AM4/4/12
to Akka User List
not so well explained.

I can see that there can be two actors with the same name in different
ActorSystem.
What I cannot see is how there can be two ActorSystem with the same
name in the same JVM.

√iktor Ҡlang

unread,
Apr 4, 2012, 12:01:00 PM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 5:58 PM, Pepe <ppr...@googlemail.com> wrote:
not so well explained.

I can see that there can be two actors with the same name in different
ActorSystem.
What I cannot see is how there can be two ActorSystem with the same
name in the same JVM.

What is the underlying assumption that makes you not see that?



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Pepe

unread,
Apr 4, 2012, 12:06:44 PM4/4/12
to Akka User List
the definition of name itself (from WordNet database):
"A language unit by which a person or thing is known"
> Typesafe <http://www.typesafe.com/> - The software stack for applications
> that scale
>
> Twitter: @viktorklang

√iktor Ҡlang

unread,
Apr 4, 2012, 12:11:12 PM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 6:06 PM, Pepe <ppr...@googlemail.com> wrote:
the definition of name itself (from WordNet database):
"A language unit by which a person or thing is known"

There's 3 people in Sweden named "Viktor Klang", how is that possible?
Name does not imply uniqueness.

Cheers,



--
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Pepe

unread,
Apr 4, 2012, 12:25:13 PM4/4/12
to Akka User List
But there can only be one "viktor...@akka.io", or one "www.akka.io"
Curiously, there can only be one actor called "a1" in a given
ActorSystem.

√iktor Ҡlang

unread,
Apr 4, 2012, 12:28:04 PM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 6:25 PM, Pepe <ppr...@googlemail.com> wrote:
But there can only be one "viktor...@akka.io", or one "www.akka.io"

That's exactly my point. And that's exactly what is explained in the link. The ActorSystem's name is just a part of the identifier.
 
Curiously, there can only be one actor called "a1" in a given
ActorSystem.

That's not true. The name of the Actor need not be unique. It's path needs to however.
Just as you can have:

/usr/local/foo/bar
and
/usr/local/baz/bar



--
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Pepe

unread,
Apr 4, 2012, 12:36:04 PM4/4/12
to Akka User List
(Then I can simply re-state my initial question)
Does Akka offer the possibility of searching for a previously created
ActorSystem?:
Collection<ActorSystem> mySystems = ?????.find("my-system")

Akka Team

unread,
Apr 4, 2012, 12:42:04 PM4/4/12
to akka...@googlegroups.com
(Alright, then I follow up with)
What's the use-case?

Cheers,
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Pepe

unread,
Apr 4, 2012, 12:56:44 PM4/4/12
to Akka User List
Ok, it is not supported by Akka

√iktor Ҡlang

unread,
Apr 4, 2012, 1:00:58 PM4/4/12
to akka...@googlegroups.com
On Wed, Apr 4, 2012 at 6:56 PM, Pepe <ppr...@googlemail.com> wrote:
Ok, it is not supported by Akka

No, your proposed solution doesn't exist. And as long as you do not state what problem you're trying to solve, I am unable to offer you a suitable alternative solution.

Cheers,
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Roland Kuhn

unread,
Apr 5, 2012, 3:46:26 AM4/5/12
to akka...@googlegroups.com, Akka User List
Hi Pepe,

there was a ticket for creating such a registry, but we were not satisfied with what we got when trying to specify the semantics in detail. One part is that we removed all global state so that different parts of an application can use Akka without having to worry about each other and a global feature would break this. Another is that it would encourage get-or-create usage—my pet peeve—which would make the semantics unclear: you give a name and a config, but if the name already exists you potentially get back a differently configured system (which is usually quite fatal).

There is nothing stopping you from putting a hashmap in some central place of your application, (pre-)populate that with the actor systems you need and be done, that's basically a one-liner (which is another reason for not including it in Akka, because instead of a simple solution to a very narrow problem we'd have to think of a solution to a much more generic problem).

What concerns the name: as I explained there is no global instance keeping watch over system names, hence you can create different systems with the same name. The systems will crash if their configuration requires the same resource (e.g. a local port), but other than that they are completely independent and consequently are not “equal”. It is like several people using viktor...@typesafe.com for their email address: they may all think they are fine until they actually try to receive email.


Regards,

Roland Kuhn
Typesafe — The software stack for applications that scale
twitter: @rolandkuhn

On 4 apr 2012, at 18:56, Pepe <ppr...@googlemail.com> wrote:

> Ok, it is not supported by Akka
>

Muki

unread,
May 31, 2012, 7:09:34 AM5/31/12
to Akka User List
Hi,

I'm interested in such a feature, too. As Akka 2.1 will support OSGi
again
(thanks to Gert Vanthienen) I want to implement an
ActorSystemDirectoryService.

My framework provides data-mining functionality on top of akka and
osgi.
When executing a data-mining model the user should be able to choose
from an existing running actor-system (created by the UI layer) or
creating
a new one (local, cluster).

Of course it would be possible to register all created ActorSystems as
an
OSGi service via the ActorSystem trait. However with this solution the
programmer has to worry about registering and deregistering the
ActorSystem.

cheers,
Muki
Reply all
Reply to author
Forward
0 new messages