Example #1
0
        protected bool TrappedMoveNext(
            IEnumerator enumerator,
            out FutureProcess process)
        {
            try
            {
                process = FutureProcess.Unhandled;
                return(enumerator.MoveNext());
            }
            catch (Exception throwable)
            {
                FutureExceptionEventHandlerChain chain;

                lock (this)
                {
                    chain = this._onErrorHandlerChain;
                }
                if (chain == null)
                {
                    throw;
                }
                process = chain.Apply(this, throwable);
                switch (process)
                {
                case FutureProcess.Continue:
                    return(false);

                case FutureProcess.Terminate:
                    throw new HandledFutureException();

                default:
                    throw;
                }
            }
        }
        public async Task <T?> RequestAsync <T>(ClusterIdentity clusterIdentity, object message, ISenderContext context, CancellationToken ct)
        {
            var start = DateTime.UtcNow;

            Logger.LogDebug("Requesting {ClusterIdentity} Message {Message}", clusterIdentity, message);
            var i = 0;

            var future  = new FutureProcess(context.System);
            PID?lastPid = null;

            try
            {
                while (!ct.IsCancellationRequested)
                {
                    if (context.System.Shutdown.IsCancellationRequested)
                    {
                        return(default);