package com.example; import akka.actor.typed.Behavior; import akka.actor.typed.javadsl.AbstractBehavior; import akka.actor.typed.javadsl.ActorContext; import akka.actor.typed.javadsl.Behaviors; import akka.actor.typed.javadsl.Receive; public class GCDReceiver extends AbstractBehavior { public interface Message {}; public record GCDResult(int result) implements Message { } public static Behavior create() { return Behaviors.setup(GCDReceiver::new); } private GCDReceiver(ActorContext context) { super(context); } @Override public Receive createReceive() { return newReceiveBuilder() .onMessage(GCDResult.class, this::onResult) .build(); } private Behavior onResult(GCDResult msg) { getContext().getLog().info("GCD: {}", msg.result); return this; } }