Package kalix.javasdk
Class Kalix
Object
kalix.javasdk.Kalix
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionkalix.javasdk.KalixRunnerCreates a KalixRunner using the currently configured services.kalix.javasdk.KalixRunnercreateRunner(com.typesafe.config.Config config) Creates a KalixRunner using the currently configured services, using the supplied configuration.kalix.javasdk.impl.MessageCodecINTERNAL API The returned codec includes all registered descriptors and is meant to be used internally for eventing testkit.When locating protobufs, if both a Java and a ScalaPB generated class is found on the classpath, this specifies that Java should be preferred.When locating protobufs, if both a Java and a ScalaPB generated class is found on the classpath, this specifies that Scala should be preferred.register(ActionProvider<A> provider) Register an action using an {ActionProvider}.<S,E, ES extends EventSourcedEntity<S, E>>
Kalixregister(EventSourcedEntityProvider<S, E, ES> provider) Register an event sourced entity using a {EventSourcedEntityProvider}.<D extends kalix.replicatedentity.ReplicatedData,E extends ReplicatedEntity<D>>
Kalixregister(ReplicatedEntityProvider<D, E> provider) Register a replicated entity using aReplicatedEntityProvider.<S,E extends ValueEntity<S>>
Kalixregister(ValueEntityProvider<S, E> provider) Register a value based entity using a {ValueEntityProvider}.register(ViewProvider provider) Register a view using aViewProvider.<S,W extends AbstractWorkflow<S>>
Kalixregister(WorkflowProvider<S, W> provider) CompletionStage<akka.Done> start()Starts a server with the configured entities.CompletionStage<akka.Done> start(com.typesafe.config.Config config) Starts a server with the configured entities, using the supplied configuration.withClassLoader(ClassLoader classLoader) Sets the ClassLoader to be used for reflective access, the default value is the ClassLoader of the Kalix class.withDefaultAclFileDescriptor(Optional<com.google.protobuf.DescriptorProtos.FileDescriptorProto> aclDescriptor) INTERNAL API - subject to change without noticewithSdkName(String sdkName) INTERNAL API - subject to change without noticewithTypeUrlPrefix(String prefix) Sets the type URL prefix to be used when serializing and deserializing types from and to Protobuf Any values.
-
Constructor Details
-
Kalix
public Kalix()
-
-
Method Details
-
withClassLoader
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
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
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
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
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 aReplicatedEntityProvider. The concreteReplicatedEntityProvideris generated for the specific entities defined in Protobuf, for exampleCustomerEntityProvider.ReplicatedEntityOptionscan be defined by in theReplicatedEntityProvider.- Returns:
- This stateful service builder.
-
register
Register a value based entity using a {ValueEntityProvider}. The concreteValueEntityProvideris generated for the specific entities defined in Protobuf, for exampleCustomerEntityProvider.{
ValueEntityOptions} can be defined by in theValueEntityProvider.- Returns:
- This stateful service builder.
-
register
public <S,E, Kalix registerES extends EventSourcedEntity<S, E>> (EventSourcedEntityProvider<S, E, ES> provider) Register an event sourced entity using a {EventSourcedEntityProvider}. The concreteEventSourcedEntityProvideris generated for the specific entities defined in Protobuf, for exampleCustomerEntityProvider.{
EventSourcedEntityOptions} can be defined by in theEventSourcedEntityProvider.- Returns:
- This stateful service builder.
-
register
-
register
Register a view using aViewProvider. The concreteViewProvideris generated for the specific views defined in Protobuf, for exampleCustomerViewProvider.- Returns:
- This stateful service builder.
-
register
Register an action using an {ActionProvider}. The concreteActionProvideris generated for the specific entities defined in Protobuf, for exampleCustomerActionProvider.- Returns:
- This stateful service builder.
-
start
Starts a server with the configured entities.- Returns:
- a CompletionStage which will be completed when the server has shut down.
-
start
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.
-