actor method
Implementation
Future<void> actor(ActorContext ctx, Object? msg) async {
final correlationId = ctx.correlationId;
final protocol = _pendingProtocols[correlationId];
if (protocol == null) {
return;
}
final onMessage = protocol._onMessage[msg.runtimeType];
if (onMessage == null) {
throw StateError('Unexpected message: correlationId=$correlationId, type=${msg.runtimeType}');
}
final result = await onMessage(ctx, msg);
if (result == true) {
await protocol._done?.call(ctx);
_pendingProtocols.remove(correlationId);
}
}