public final class PersistentActor<K> extends Object implements ActorContext, ProcessorContext
| Constructor and Description |
|---|
PersistentActor(K key,
InternalActorSystem actorSystem,
String previousActorStateVersion,
ActorRef ref,
Class<? extends ElasticActor> actorClass,
ActorState actorState)
This Constructor should be used when creating a new PersistentActor in memory
|
PersistentActor(K key,
InternalActorSystem actorSystem,
String previousActorStateVersion,
ActorRef ref,
String affinityKey,
Class<? extends ElasticActor> actorClass,
ActorState actorState) |
PersistentActor(K key,
InternalActorSystem actorSystem,
String currentActorStateVersion,
String previousActorSystemVersion,
ActorRef ref,
Class<? extends ElasticActor> actorClass,
byte[] serializedState,
com.google.common.collect.HashMultimap<String,MessageSubscriber> messageSubscribers,
List<InternalPersistentSubscription> persistentSubscriptions)
This Constructor should be used when the PersistentActor is deserialized
|
PersistentActor(K key,
InternalActorSystem actorSystem,
String currentActorStateVersion,
String previousActorSystemVersion,
ActorRef ref,
Class<? extends ElasticActor> actorClass,
byte[] serializedState,
String affinityKey,
com.google.common.collect.HashMultimap<String,MessageSubscriber> messageSubscribers,
List<InternalPersistentSubscription> persistentSubscriptions) |
public PersistentActor(K key, InternalActorSystem actorSystem, String previousActorStateVersion, ActorRef ref, Class<? extends ElasticActor> actorClass, ActorState actorState)
key - actorSystem - previousActorStateVersion - ref - actorClass - actorState - public PersistentActor(K key, InternalActorSystem actorSystem, String previousActorStateVersion, ActorRef ref, String affinityKey, Class<? extends ElasticActor> actorClass, ActorState actorState)
public PersistentActor(K key, InternalActorSystem actorSystem, String currentActorStateVersion, String previousActorSystemVersion, ActorRef ref, Class<? extends ElasticActor> actorClass, byte[] serializedState, com.google.common.collect.HashMultimap<String,MessageSubscriber> messageSubscribers, List<InternalPersistentSubscription> persistentSubscriptions)
key - actorSystem - currentActorStateVersion - previousActorSystemVersion - ref - actorClass - serializedState - public PersistentActor(K key, InternalActorSystem actorSystem, String currentActorStateVersion, String previousActorSystemVersion, ActorRef ref, Class<? extends ElasticActor> actorClass, byte[] serializedState, String affinityKey, com.google.common.collect.HashMultimap<String,MessageSubscriber> messageSubscribers, List<InternalPersistentSubscription> persistentSubscriptions)
public K getKey()
public String getCurrentActorStateVersion()
public String getPreviousActorStateVersion()
public Class<? extends ElasticActor> getActorClass()
public ActorRef getSelf()
getSelf in interface ActorContext@Nullable public Class<?> getSelfType()
getSelfType in interface ActorContextpublic <T extends ActorState> T getState(Class<T> stateClass)
getState in interface ActorContextpublic ActorState getState()
public byte[] getSerializedState()
public void setSerializedState(byte[] serializedState)
public void setState(ActorState state)
setState in interface ActorContextpublic ActorSystem getActorSystem()
getActorSystem in interface ActorContextpublic Collection<PersistentSubscription> getSubscriptions()
getSubscriptions in interface ActorContextpublic Map<String,Set<ActorRef>> getSubscribers()
getSubscribers in interface ActorContextpublic void addSubscription(InternalPersistentSubscription persistentSubscription)
addSubscription in interface ProcessorContextpublic Optional<InternalPersistentSubscription> getSubscription(String messageName, ActorRef publisherRef)
public void cancelAllSubscriptions()
public List<InternalPersistentSubscription> getPersistentSubscriptions()
public void addSubscriber(String messageName, MessageSubscriber messageSubscriber)
public boolean removeSubscriber(String messageName, MessageSubscriber messageSubscriber)
public com.google.common.collect.HashMultimap<String,MessageSubscriber> getMessageSubscribers()
public void serializeState()
throws IOException
IOExceptionCopyright © 2021. All rights reserved.