Fixed small error in Akka Typed Getting Started Tutorial 5 (#28041)
This commit is contained in:
parent
3c9097c7b0
commit
ab3f63899c
3 changed files with 26 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue