Package kalix.javasdk

Class Kalix

Object
kalix.javasdk.Kalix

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

    • Kalix

      public Kalix()
  • Method Details

    • withClassLoader

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

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

      public Kalix 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 Kalix instance.
    • preferScalaProtobufs

      public Kalix 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 Kalix instance.
    • withSdkName

      public Kalix withSdkName(String sdkName)
      INTERNAL API - subject to change without notice
      Parameters:
      sdkName - the name of the SDK used to build this Kalix app (i.e. kalix-java-sdk)
      Returns:
      This Kalix instance.
    • withDefaultAclFileDescriptor

      public Kalix withDefaultAclFileDescriptor(Optional<com.google.protobuf.DescriptorProtos.FileDescriptorProto> aclDescriptor)
      INTERNAL API - subject to change without notice
      Parameters:
      aclDescriptor - - the default ACL file descriptor
      Returns:
      This Kalix instance.
    • register

      public <D extends kalix.replicatedentity.ReplicatedData, E extends ReplicatedEntity<D>> Kalix register(ReplicatedEntityProvider<D,E> provider)
      Register a replicated entity using a ReplicatedEntityProvider. The concrete ReplicatedEntityProvider is generated for the specific entities defined in Protobuf, for example CustomerEntityProvider.

      ReplicatedEntityOptions can be defined by in the ReplicatedEntityProvider .

      Returns:
      This stateful service builder.
    • register

      public <S, E extends ValueEntity<S>> Kalix 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 <S, E, ES extends EventSourcedEntity<S, E>> Kalix register(EventSourcedEntityProvider<S,E,ES> provider)
      Register an event sourced entity using a {EventSourcedEntityProvider}. The concrete EventSourcedEntityProvider is generated for the specific entities defined in Protobuf, for example CustomerEntityProvider.

      {EventSourcedEntityOptions} can be defined by in the EventSourcedEntityProvider.

      Returns:
      This stateful service builder.
    • register

      public <S, W extends AbstractWorkflow<S>> Kalix register(WorkflowProvider<S,W> provider)
    • register

      public Kalix 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 <A extends Action> Kalix register(ActionProvider<A> 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 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 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 kalix.javasdk.KalixRunner createRunner()
      Creates a KalixRunner using the currently configured services. In order to start the server, `run()` must be invoked on the returned KalixRunner.
      Returns:
      a KalixRunner
    • createRunner

      public kalix.javasdk.KalixRunner createRunner(com.typesafe.config.Config config)
      Creates a KalixRunner using the currently configured services, using the supplied configuration. In order to start the server, `run()` must be invoked on the returned KalixRunner.
      Returns:
      a KalixRunner
    • getMessageCodec

      @InternalApi public kalix.javasdk.impl.MessageCodec getMessageCodec()
      INTERNAL API The returned codec includes all registered descriptors and is meant to be used internally for eventing testkit.