예제 #1
0
        private IRdTask <TRes> StartInternal(Lifetime requestLifetime, TReq request, [NotNull] IScheduler scheduler)
        {
            AssertBound();
            if (!Async)
            {
                AssertThreading();
            }
            AssertNullability(request);

            var taskId = Proto.Identities.Next(RdId.Nil);
            var task   = new WiredRdTask <TReq, TRes>(this, taskId, scheduler, false);

            //no need for cancellationLifetime on call site
            var _ = task.Subscribe(Lifetime.Intersect(requestLifetime, myBindLifetime));

            Wire.Send(RdId, (writer) =>
            {
                SendTrace?.Log($"{task} :: send request: {request.PrintToString()}");

                taskId.Write(writer);
                WriteRequestDelegate(SerializationContext, writer, request);
            });

            return(task);
        }
예제 #2
0
 public IRdTask <TRes> Start(Lifetime lifetime, TReq request, IScheduler responseScheduler = null)
 {
     return(myHandler(myBindLifetime.Intersect(lifetime), request));
 }