actor

Initializing actor with Props

一世执手 提交于 2019-12-11 18:25:25
问题 I have the following FSM public class ActorOnFsm { public static enum State { FirstState, SecondState, ThirdState, FourthState } public static final class ServiceData { } public class ActorFSM extends AbstractFSM<State, ServiceData> { { startWith(FirstState, new ServiceData()); when(FirstState, matchEvent(SomeMessage.class, ServiceData.class, (powerOn, noData) -> goTo(SecondState) .replying(SecondState)) ); when(SecondState, matchEvent(SomeOtherMessage.class, ServiceData.class, (powerOn,

Start a thread inside an Azure Service Fabric actor?

无人久伴 提交于 2019-12-11 17:47:26
问题 I know that actors inside Service Fabric are single-threaded. But suppose I start a new thread inside an actor method, what will happen then? Will an actor be deactivated even though the spawned thread is still executing? According to the documentation, an actor is deactivated when it has not been 'used' for some time. 'Used' in this context means either: receiving a call IRemindable.ReceiveReminderAsync being invoked So it seems that the new thread I started is not taken into account. But

What is different between the actor model and seda model?

旧时模样 提交于 2019-12-11 17:06:11
问题 Talk about your understanding, what is different between the actor model and this seda stage model . The actor model have the mailbox ,and the seda stage have a job list. Then the seda stage have an single threadpool, but all stage can share an single threadpool. The actor model all actors share an single threadPool . I think them essential equivalent. 来源: https://stackoverflow.com/questions/54803866/what-is-different-between-the-actor-model-and-seda-model

Does akka copy MDC from source actor to other actors and futures?

丶灬走出姿态 提交于 2019-12-11 13:45:13
问题 As I read in akka specification it supports mdc in actors. E.g. I can put unic infomation in mdc and then use it in actor. But what about futures? Does akka provide any guaranties that a future which is initiated in actor will have the same mdc? Also what about message that send to other actors - is MDC copied by default? Note For me it looks very strange, that I can use MDC only inside one actor code. 回答1: They could but they actually don't. When you call members of LoggingAdapter you

Ensure message order in test when mixing futures with actor messages

落爺英雄遲暮 提交于 2019-12-11 08:50:04
问题 I'm testing an actor that uses an asnychronous future-based API. The actor uses the pipe pattern to send a message to itself when a future completes: import akka.pattern.pipe // ... // somewhere in the actor's receive method futureBasedApi.doSomething().pipeTo(self) In my test I mock the API so I control future completion via promises. However, this is interleaved with other messages sent directly to the actor: myActor ! Message("A") promiseFromApiCall.success(Message("B")) myActor ! Message(

How extend behaviour of super actor in akka

我是研究僧i 提交于 2019-12-11 07:17:00
问题 I want to implement CRUD operation using akka actor. I am a new in akka so dont know the designing fundamentals of akka actors. I want to share the behaviours of akka actors in multiple sub actors. Fir example i want to save and delete student , teacher and other entity. I have created actor for StudentDao.scala class StudentDao extends Actor with ActorLogging{ override def Receive = { case Add(student) => // Add to database case Delete => //Delete from database // Some other cases related to

stop(getSelf()) vs stop(this.getSelf()) [duplicate]

不羁岁月 提交于 2019-12-11 04:18:21
问题 This question already has answers here : In Java, what is the difference between this.method() and method()? (9 answers) Closed last year . I have been studying Akka Actors. I know the meaning of stop(ActorRef) which kills the running actor. But what is the difference between getSelf() and this.getSelf() while killing an actor? Thank You in advance!. 回答1: There's no difference between them, it's just that some people believe it enhances readability. Readability is an important thing in

Azure Service Fabric client call to an Actor service from a remote machine returns unkown address error

你。 提交于 2019-12-11 03:42:45
问题 When trying to connect to a remote dev cluster using the following sample code: var proxy = ActorProxy.Create<IActor1_NoS>(ActorId.NewId(), "fabric:/applicationname"); I get the following error: System.Fabric.FabricException : The supplied address was invalid Note that this code works fine when ran locally from the dev cluster machine. The Dev cluster manifest file has been modified to listen on the machine IP address. The remote machine is a Windows 7. All Service Fabric assemblies were

Can wrapping akka actors in a class cause memory leaks?

核能气质少年 提交于 2019-12-11 02:59:33
问题 I have a fairly basic wrapper class around a scala akka actorRef. Basically the class has a field which is an actorRef and exposes a number of methods that "tell" specific messages to the actorRef. In this fashion I can adhere to a specify API and avoid exposing tells or message classes. I've experienced a memory leak in my program and I'm wondering if my wrapper around akka actors is causing the problem. I wrote this simulation below to test my theory. import akka.actor.{ActorSystem,

Any way of appending to the act method in scala?

送分小仙女□ 提交于 2019-12-11 02:33:39
问题 First off, I am new to Scala: I am writing a logging facility in Scala that will simply be a class that extends the Actor class. This way a user can just extend this class and the logging features will be available. Basically, I want to write to a log file every time an actor that extends this class sends or receives a message. For clarification every actor will have its own log file which can be collated later. I am taking a Lamport clocks style approach to ordering the events by having each