本文整理汇总了C#中Request.Respond方法的典型用法代码示例。如果您正苦于以下问题:C# Request.Respond方法的具体用法?C# Request.Respond怎么用?C# Request.Respond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request.Respond方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleAsk
Consumer<Request<Ask>> HandleAsk(Request<Ask> x)
{
if (x.Body.AuctionId != Id)
return null;
return message =>
{
if (_ended)
{
x.Respond(new Ended
{
AuctionId = Id,
HighBid = _currentBid,
});
return;
}
Guid token = CombGuid.Generate();
x.Respond(new Status
{
CurrentBid = _currentBid,
AuctionId = Id,
Token = token,
});
_inbox.Receive<Request<Buy>>(buy =>
{
if (buy.Body.Token != token)
return null;
return buyMessage =>
{
buyMessage.Respond(new Purchased
{
AuctionId = Id,
Token = token,
Price = _currentBid,
Quantity = buy.Body.Quantity,
});
};
}, 1.Seconds(),
() =>
{
// nothing to do on timeout
});
};
}
示例2: HandleStop
public void HandleStop(Request<Stop> request)
{
IEnumerator<ActorRef> next = _inbox.LinkedActors.GetEnumerator();
if (next.MoveNext())
{
AnonymousActor.New(x => x.Loop(loop =>
{
next.Current.Request<Stop>(x)
.Receive<Response<Stop>>(response =>
{
if (next.MoveNext())
loop.Continue();
else
request.Respond();
});
}));
}
}
示例3: Cancel
public void Cancel(Request<Cancel> request)
{
request.Respond(new CancelledImpl());
}
示例4: SendQuoteRequest
public void SendQuoteRequest(Request<GetQuote> request)
{
Trace.WriteLine("Symbol: " + request.Body.Symbol);
Symbol = request.Body.Symbol;
request.Respond(new RequestSent());
}
示例5: MyRequestHandler
void MyRequestHandler(Request<MyRequest> message)
{
message.Respond(new MyResponse());
}
示例6: HandleBid
public void HandleBid(Request<Bid> request)
{
request.Respond(request.Body);
}
示例7: IssueRequest
private void IssueRequest(Request req)
{
var chan = Channels[req.Channel];
var bank = chan.Banks[req.Bank];
var state = ConflictState(req);
long reqDelay = 0;
chan.NextRequest = After(tCCD);
if (state != RequestConflictState.Hit)
{
if (state == RequestConflictState.Conflict)
{
reqDelay += tRP;
}
bank.NextConflict = After(reqDelay + tRAS);
reqDelay += tRCD;
bank.OpenRow = req.Row;
}
reqDelay += tCCD;
bank.NextRequest = After(reqDelay);
req.Respond(After(reqDelay + tCL));
}