How to use actor singleton?

95 views
Skip to first unread message

akhil

unread,
Jan 22, 2014, 2:08:01 PM1/22/14
to akka...@googlegroups.com
Hi,

I went through other posts and docs on ClusterSingletonManager but a little confused how to use it?

I have created an actor using:

system.actorOf(ClusterSingletonManager.props(
      singletonProps = handOverData => Props(classOf[TestSI]),
      singletonName = "master",
      terminationMessage = PoisonPill,
      role = Some("worker")),
      name = "singleton")


How do I send message to this actor?

Akhil

√iktor Ҡlang

unread,
Jan 22, 2014, 2:19:13 PM1/22/14
to Akka User List
Hi, (Just off the top of my head so I may be wrong here)

have you tried to store the resulting ActorRef in a val and sending it the message?

val singleton = system.actorOf(ClusterSingletonManager.props(…), )

singleton ! "my message"




--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--
Cheers,

———————
Viktor Klang
Chief Architect - Typesafe

Twitter: @viktorklang

akhil

unread,
Jan 22, 2014, 2:21:45 PM1/22/14
to akka...@googlegroups.com
Yes...doesn't work

Patrik Nordwall

unread,
Jan 22, 2014, 3:25:32 PM1/22/14
to akka...@googlegroups.com
Hi Akhil,

Read the following sections of the documentation carefully, and ask again if that is unclear...
"With the names given above the path of singleton actor can be constructed"


/Patrik

PS. Personally, I find it most convenient to register the singleton actor in the replicated registry, but I understand if you might find that one too many component to start with.

PS2. Perhaps we should provide this singleton proxy out of the box, and the usage could be exactly as Viktor proposed.

Patrik Nordwall
Typesafe Reactive apps on the JVM
Twitter: @patriknw

Akhil Kodali

unread,
Jan 22, 2014, 3:45:36 PM1/22/14
to akka...@googlegroups.com
Hi Patrik,

I had to write the proxy based on ConsumerProxy in the doc to use it. I was wondering if there was any other ways of doing it?

Akhil

----
Regards,
Akhil Kodali


You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/us9q2HPbDbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Patrik Nordwall

unread,
Jan 23, 2014, 2:10:39 AM1/23/14
to akka...@googlegroups.com
On Wed, Jan 22, 2014 at 9:45 PM, Akhil Kodali <akhil....@gmail.com> wrote:
Hi Patrik,

I had to write the proxy based on ConsumerProxy in the doc to use it. I was wondering if there was any other ways of doing it?

That is the way to do it. The alternative is to let it publish its existence with for example: http://doc.akka.io/docs/akka/2.2.3/contrib/distributed-pub-sub.html

/Patrik
Reply all
Reply to author
Forward
0 new messages