Create a child Actor based on the received message ID
up vote
0
down vote
favorite
The parent actor creates a child actor based on the identity in the received message, and the same message ID will reuse the child actor. What should I do? I am using this way now.
override def receive: Receive = {
case location: DeviceLocationInfo =>
log.info(s"$location")
val settings = CacheBasicAlarmSettingInRedis(system)
.memoizeInRedisBasicAlarmSetting(location.deviceId)
settings foreach { setting =>
val actorRef = context.child(location.deviceId)
.getOrElse(context.actorOf(Props(new OverSpeedAlarm),location.deviceId))
actorRef ! location
}
case _ =>
}
akka
New contributor
add a comment |
up vote
0
down vote
favorite
The parent actor creates a child actor based on the identity in the received message, and the same message ID will reuse the child actor. What should I do? I am using this way now.
override def receive: Receive = {
case location: DeviceLocationInfo =>
log.info(s"$location")
val settings = CacheBasicAlarmSettingInRedis(system)
.memoizeInRedisBasicAlarmSetting(location.deviceId)
settings foreach { setting =>
val actorRef = context.child(location.deviceId)
.getOrElse(context.actorOf(Props(new OverSpeedAlarm),location.deviceId))
actorRef ! location
}
case _ =>
}
akka
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
The parent actor creates a child actor based on the identity in the received message, and the same message ID will reuse the child actor. What should I do? I am using this way now.
override def receive: Receive = {
case location: DeviceLocationInfo =>
log.info(s"$location")
val settings = CacheBasicAlarmSettingInRedis(system)
.memoizeInRedisBasicAlarmSetting(location.deviceId)
settings foreach { setting =>
val actorRef = context.child(location.deviceId)
.getOrElse(context.actorOf(Props(new OverSpeedAlarm),location.deviceId))
actorRef ! location
}
case _ =>
}
akka
New contributor
The parent actor creates a child actor based on the identity in the received message, and the same message ID will reuse the child actor. What should I do? I am using this way now.
override def receive: Receive = {
case location: DeviceLocationInfo =>
log.info(s"$location")
val settings = CacheBasicAlarmSettingInRedis(system)
.memoizeInRedisBasicAlarmSetting(location.deviceId)
settings foreach { setting =>
val actorRef = context.child(location.deviceId)
.getOrElse(context.actorOf(Props(new OverSpeedAlarm),location.deviceId))
actorRef ! location
}
case _ =>
}
akka
akka
New contributor
New contributor
edited 17 hours ago
Stijn
15.7k977126
15.7k977126
New contributor
asked 17 hours ago
lei zhang
11
11
New contributor
New contributor
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
lei zhang is a new contributor. Be nice, and check out our Code of Conduct.
draft saved
draft discarded
lei zhang is a new contributor. Be nice, and check out our Code of Conduct.
lei zhang is a new contributor. Be nice, and check out our Code of Conduct.
lei zhang is a new contributor. Be nice, and check out our Code of Conduct.
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237527%2fcreate-a-child-actor-based-on-the-received-message-id%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password