Package com.arpnetworking.guice.pekko
Class GuiceActorCreator
java.lang.Object
com.arpnetworking.guice.pekko.GuiceActorCreator
- All Implemented Interfaces:
org.apache.pekko.actor.IndirectActorProducer
public class GuiceActorCreator
extends Object
implements org.apache.pekko.actor.IndirectActorProducer
A Guice-based factory for Pekko actors.
TODO(vkoskela): This is _duplicated_ in metrics-portal and should find its way to a common utility package.
- Author:
- Brandon Arp (brandon dot arp at inscopemetrics dot com)
-
Constructor Summary
ConstructorDescriptionGuiceActorCreator
(com.google.inject.Injector injector, Class<? extends org.apache.pekko.actor.Actor> clazz) Public constructor. -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends org.apache.pekko.actor.Actor>
org.apache.pekko.actor.Actor
produce()
static org.apache.pekko.actor.Props
Creates aProps
for this creator.static com.google.inject.Provider<org.apache.pekko.actor.ActorRef>
Creates a provider that is suitable for eager singleton binding.Generate a Steno log compatible representation.toString()
-
Constructor Details
-
GuiceActorCreator
public GuiceActorCreator(com.google.inject.Injector injector, Class<? extends org.apache.pekko.actor.Actor> clazz) Public constructor.- Parameters:
injector
- The Guice injector to use to construct the actor.clazz
- Class to create.
-
-
Method Details
-
props
public static org.apache.pekko.actor.Props props(com.google.inject.Injector injector, Class<? extends org.apache.pekko.actor.Actor> clazz) Creates aProps
for this creator.- Parameters:
injector
- the Guice injector to create actors fromclazz
- the class to create- Returns:
- a new
Props
-
provider
public static com.google.inject.Provider<org.apache.pekko.actor.ActorRef> provider(Class<? extends org.apache.pekko.actor.Actor> clazz, String name) Creates a provider that is suitable for eager singleton binding.- Parameters:
clazz
- the class to createname
- the name of the actor- Returns:
- a
Provider
that will create the actor
-
produce
public org.apache.pekko.actor.Actor produce()- Specified by:
produce
in interfaceorg.apache.pekko.actor.IndirectActorProducer
-
actorClass
- Specified by:
actorClass
in interfaceorg.apache.pekko.actor.IndirectActorProducer
-
toLogValue
Generate a Steno log compatible representation.- Returns:
- Steno log compatible representation.
-
toString
-