Class AkkaServerless


  • public final class AkkaServerless
    extends Object
    The AkkaServerless class is the main interface to configuring entities to deploy, and subsequently starting a local server which will expose these entities to the AkkaServerless Proxy Sidecar.
    • Constructor Detail

      • AkkaServerless

        public AkkaServerless()
    • Method Detail

      • withClassLoader

        public AkkaServerless withClassLoader​(ClassLoader classLoader)
        Sets the ClassLoader to be used for reflective access, the default value is the ClassLoader of the AkkaServerless class.
        Parameters:
        classLoader - A non-null ClassLoader to be used for reflective access.
        Returns:
        This AkkaServerless instance.
      • withTypeUrlPrefix

        public AkkaServerless withTypeUrlPrefix​(String prefix)
        Sets the type URL prefix to be used when serializing and deserializing types from and to Protobyf Any values. Defaults to "type.googleapis.com".
        Parameters:
        prefix - the type URL prefix to be used.
        Returns:
        This AkkaServerless instance.
      • preferJavaProtobufs

        public AkkaServerless preferJavaProtobufs()
        When locating protobufs, if both a Java and a ScalaPB generated class is found on the classpath, this specifies that Java should be preferred.
        Returns:
        This AkkaServerless instance.
      • preferScalaProtobufs

        public AkkaServerless preferScalaProtobufs()
        When locating protobufs, if both a Java and a ScalaPB generated class is found on the classpath, this specifies that Scala should be preferred.
        Returns:
        This AkkaServerless instance.
      • register

        public <S,​E extends ValueEntity<S>> AkkaServerless register​(ValueEntityProvider<S,​E> provider)
        Register a value based entity using a {ValueEntityProvider}. The concrete ValueEntityProvider is generated for the specific entities defined in Protobuf, for example CustomerEntityProvider.

        {ValueEntityOptions} can be defined by in the ValueEntityProvider.

        Returns:
        This stateful service builder.
      • register

        public AkkaServerless register​(ViewProvider provider)
        Register a view using a ViewProvider. The concrete ViewProvider is generated for the specific views defined in Protobuf, for example CustomerViewProvider.
        Returns:
        This stateful service builder.
      • register

        public AkkaServerless register​(ActionProvider provider)
        Register an action using an {ActionProvider}. The concrete ActionProvider is generated for the specific entities defined in Protobuf, for example CustomerActionProvider.
        Returns:
        This stateful service builder.
      • start

        public java.util.concurrent.CompletionStage<akka.Done> start()
        Starts a server with the configured entities.
        Returns:
        a CompletionStage which will be completed when the server has shut down.
      • start

        public java.util.concurrent.CompletionStage<akka.Done> start​(com.typesafe.config.Config config)
        Starts a server with the configured entities, using the supplied configuration.
        Returns:
        a CompletionStage which will be completed when the server has shut down.
      • createRunner

        public com.akkaserverless.javasdk.AkkaServerlessRunner createRunner()
        Creates an AkkaServerlessRunner using the currently configured services. In order to start the server, `run()` must be invoked on the returned AkkaServerlessRunner.
        Returns:
        an AkkaServerlessRunner
      • createRunner

        public com.akkaserverless.javasdk.AkkaServerlessRunner createRunner​(com.typesafe.config.Config config)
        Creates an AkkaServerlessRunner using the currently configured services, using the supplied configuration. In order to start the server, `run()` must be invoked on the returned AkkaServerlessRunner.
        Returns:
        an AkkaServerlessRunner