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

    Constructors
    Constructor
    Description
    GuiceActorCreator(com.google.inject.Injector injector, Class<? extends org.apache.pekko.actor.Actor> clazz)
    Public constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Class<? extends org.apache.pekko.actor.Actor>
     
    org.apache.pekko.actor.Actor
     
    static org.apache.pekko.actor.Props
    props(com.google.inject.Injector injector, Class<? extends org.apache.pekko.actor.Actor> clazz)
    Creates a Props for this creator.
    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.
    Generate a Steno log compatible representation.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 a Props for this creator.
      Parameters:
      injector - the Guice injector to create actors from
      clazz - 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 create
      name - 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 interface org.apache.pekko.actor.IndirectActorProducer
    • actorClass

      public Class<? extends org.apache.pekko.actor.Actor> actorClass()
      Specified by:
      actorClass in interface org.apache.pekko.actor.IndirectActorProducer
    • toLogValue

      public Object toLogValue()
      Generate a Steno log compatible representation.
      Returns:
      Steno log compatible representation.
    • toString

      public String toString()
      Overrides:
      toString in class Object