public override async Task <bool> HandleAsync(object evt, StreamSequenceToken token)
    {
        if (evt is not TeamAdded obj)
        {
            return(true);
        }

        // We already know that the Team exists, as it was validated
        // on the AddTeam command and before publishing the TeamAdded event
        var teamGrain = GrainFactory.GetGrain <ITeamGrain>(obj.TeamId);

        var joinTournamentCmd = new JoinTournament(obj.TeamId, obj.TournamentId, obj.TraceId, obj.InvokerUserId);
        await teamGrain.JoinTournamentAsync(joinTournamentCmd);

        return(true);
    }
예제 #2
0
 // Saga command, already validated in the saga
 public async Task JoinTournamentAsync(JoinTournament cmd)
 => await PersistPublishAsync(new TournamentJoined(cmd.TeamId, cmd.TournamentId, cmd.TraceId, cmd.InvokerUserId));