Fixed small error in Akka Typed Getting Started Tutorial 5 (#28041)

This commit is contained in:
Thomas Braam 2019-10-25 19:57:01 +08:00 committed by Patrik Nordwall
parent 3c9097c7b0
commit ab3f63899c
3 changed files with 26 additions and 4 deletions

View file

@ -48,6 +48,7 @@ public class Device extends AbstractBehavior<Device.Command> {
}
}
// #respond-declare
public static final class RespondTemperature {
final long requestId;
final String deviceId;
@ -59,6 +60,7 @@ public class Device extends AbstractBehavior<Device.Command> {
this.value = value;
}
}
// #respond-declare
static enum Passivate implements Command {
INSTANCE
@ -98,10 +100,12 @@ public class Device extends AbstractBehavior<Device.Command> {
return this;
}
// #respond-reply
private Behavior<Command> onReadTemperature(ReadTemperature r) {
r.replyTo.tell(new RespondTemperature(r.requestId, deviceId, lastTemperatureReading));
return this;
}
// #respond-reply
private Behavior<Command> onPostStop() {
getContext().getLog().info("Device actor {}-{} stopped", groupId, deviceId);