public class ActorRuntime extends Object
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
activate(String actorTypeName,
String actorId)
Activates an actor for an actor type with given actor id.
|
reactor.core.publisher.Mono<Void> |
deactivate(String actorTypeName,
String actorId)
Deactivates an actor for an actor type with given actor id.
|
ActorRuntimeConfig |
getConfig()
Gets the Actor configuration for this runtime.
|
static ActorRuntime |
getInstance()
Returns an ActorRuntime object.
|
reactor.core.publisher.Mono<byte[]> |
invoke(String actorTypeName,
String actorId,
String actorMethodName,
byte[] payload)
Invokes the specified method for the actor, this is mainly used for cross
language invocation.
|
reactor.core.publisher.Mono<Void> |
invokeReminder(String actorTypeName,
String actorId,
String reminderName,
byte[] params)
Fires a reminder for the Actor.
|
reactor.core.publisher.Mono<Void> |
invokeTimer(String actorTypeName,
String actorId,
String timerName)
Fires a timer for the Actor.
|
<T extends AbstractActor> |
registerActor(Class<T> clazz)
Registers an actor with the runtime, using
DefaultObjectSerializer and DefaultActorFactory . |
<T extends AbstractActor> |
registerActor(Class<T> clazz,
ActorFactory<T> actorFactory)
Registers an actor with the runtime, using
DefaultObjectSerializer . |
<T extends AbstractActor> |
registerActor(Class<T> clazz,
ActorFactory<T> actorFactory,
DaprObjectSerializer objectSerializer,
DaprObjectSerializer stateSerializer)
Registers an actor with the runtime.
|
<T extends AbstractActor> |
registerActor(Class<T> clazz,
DaprObjectSerializer objectSerializer,
DaprObjectSerializer stateSerializer)
Registers an actor with the runtime.
|
byte[] |
serializeConfig()
Gets the Actor configuration for this runtime.
|
public static ActorRuntime getInstance()
public ActorRuntimeConfig getConfig()
public byte[] serializeConfig() throws IOException
IOException
- If cannot serialize config.public <T extends AbstractActor> void registerActor(Class<T> clazz)
DefaultObjectSerializer
and DefaultActorFactory
.
DefaultObjectSerializer
is not recommended for production scenarios.T
- Actor class type.clazz
- The type of actor.public <T extends AbstractActor> void registerActor(Class<T> clazz, ActorFactory<T> actorFactory)
DefaultObjectSerializer
.
DefaultObjectSerializer
is not recommended for production scenarios.T
- Actor class type.clazz
- The type of actor.actorFactory
- An optional factory to create actors. This can be used for dependency injection.public <T extends AbstractActor> void registerActor(Class<T> clazz, DaprObjectSerializer objectSerializer, DaprObjectSerializer stateSerializer)
T
- Actor class type.clazz
- The type of actor.objectSerializer
- Serializer for Actor's request and response objects.stateSerializer
- Serializer for Actor's state objects.public <T extends AbstractActor> void registerActor(Class<T> clazz, ActorFactory<T> actorFactory, DaprObjectSerializer objectSerializer, DaprObjectSerializer stateSerializer)
T
- Actor class type.clazz
- The type of actor.actorFactory
- An optional factory to create actors. This can be used for dependency injection.objectSerializer
- Serializer for Actor's request and response objects.stateSerializer
- Serializer for Actor's state objects.public reactor.core.publisher.Mono<Void> activate(String actorTypeName, String actorId)
actorTypeName
- Actor type name to activate the actor for.actorId
- Actor id for the actor to be activated.public reactor.core.publisher.Mono<Void> deactivate(String actorTypeName, String actorId)
actorTypeName
- Actor type name to deactivate the actor for.actorId
- Actor id for the actor to be deactivated.public reactor.core.publisher.Mono<byte[]> invoke(String actorTypeName, String actorId, String actorMethodName, byte[] payload)
actorTypeName
- Actor type name to invoke the method for.actorId
- Actor id for the actor for which method will be invoked.actorMethodName
- Method name on actor type which will be invoked.payload
- RAW payload for the actor method.public reactor.core.publisher.Mono<Void> invokeReminder(String actorTypeName, String actorId, String reminderName, byte[] params)
actorTypeName
- Actor type name to invoke the method for.actorId
- Actor id for the actor for which method will be invoked.reminderName
- The name of reminder provided during registration.params
- Params for the reminder.public reactor.core.publisher.Mono<Void> invokeTimer(String actorTypeName, String actorId, String timerName)
actorTypeName
- Actor type name to invoke the method for.actorId
- Actor id for the actor for which method will be invoked.timerName
- The name of timer provided during registration.Copyright © 2020. All rights reserved.