本文整理汇总了C#中EventStore.Transport.Http.EntityManagement.HttpEntityManager.ReplyStatus方法的典型用法代码示例。如果您正苦于以下问题:C# HttpEntityManager.ReplyStatus方法的具体用法?C# HttpEntityManager.ReplyStatus怎么用?C# HttpEntityManager.ReplyStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventStore.Transport.Http.EntityManagement.HttpEntityManager
的用法示例。
在下文中一共展示了HttpEntityManager.ReplyStatus方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPostShutdown
private void OnPostShutdown(HttpEntityManager entity, UriTemplateMatch match)
{
if (entity.User != null && entity.User.IsInRole(SystemRoles.Admins))
{
Log.Info("Request shut down of node because shutdown command has been received.");
Publish(new ClientMessage.RequestShutdown(exitProcess: true));
entity.ReplyStatus(HttpStatusCode.OK, "OK", LogReplyError);
}
else
{
entity.ReplyStatus(HttpStatusCode.Unauthorized, "Unauthorized", LogReplyError);
}
}
示例2: OnPostScavenge
private void OnPostScavenge(HttpEntityManager entity, UriTemplateMatch match)
{
if (entity.User != null && entity.User.IsInRole(SystemRoles.Admins))
{
Log.Info("Request scavenging because /admin/scavenge request has been received.");
Publish(new ClientMessage.ScavengeDatabase(new NoopEnvelope(), Guid.Empty, entity.User));
entity.ReplyStatus(HttpStatusCode.OK, "OK", LogReplyError);
}
else
{
entity.ReplyStatus(HttpStatusCode.Unauthorized, "Unauthorized", LogReplyError);
}
}
示例3: SendOk
protected RequestParams SendOk(HttpEntityManager httpEntityManager)
{
httpEntityManager.ReplyStatus(HttpStatusCode.OK,
"OK",
e => Log.Debug("Error while closing http connection (ok): {0}.", e.Message));
return new RequestParams(done: true);
}
示例4: SendBadRequest
protected RequestParams SendBadRequest(HttpEntityManager httpEntityManager, string reason)
{
httpEntityManager.ReplyStatus(HttpStatusCode.BadRequest,
reason,
e => Log.Debug("Error while closing http connection (bad request): {0}.", e.Message));
return new RequestParams(done: true);
}
示例5: SendTooBig
protected RequestParams SendTooBig(HttpEntityManager httpEntityManager)
{
httpEntityManager.ReplyStatus(HttpStatusCode.RequestEntityTooLarge,
"Too large events received. Limit is 4mb",
e => Log.Debug("Too large events received over HTTP"));
return new RequestParams(done: true);
}
示例6: AckMessages
private void AckMessages(HttpEntityManager http, UriTemplateMatch match)
{
var envelope = new NoopEnvelope();
var groupname = match.BoundVariables["subscription"];
var stream = match.BoundVariables["stream"];
var messageIds = match.BoundVariables["messageIds"];
var ids = new List<Guid>();
foreach (var messageId in messageIds.Split(new[] { ',' }))
{
Guid id;
if (!Guid.TryParse(messageId, out id))
{
http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
return;
}
ids.Add(id);
}
var cmd = new ClientMessage.PersistentSubscriptionAckEvents(
Guid.NewGuid(),
Guid.NewGuid(),
envelope,
BuildSubscriptionGroupKey(stream, groupname),
ids.ToArray(),
http.User);
Publish(cmd);
http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
}
示例7: OnGetHistogram
private void OnGetHistogram(HttpEntityManager entity, UriTemplateMatch match)
{
var name = match.BoundVariables["name"];
var histogram = Histograms.HistogramService.GetHistogram(name);
if (histogram == null)
{
entity.ReplyStatus(HttpStatusCode.NotFound, "Not found", _ => { });
return;
}
var writer = new StringWriter();
lock (histogram)
{
histogram.outputPercentileDistribution(writer, outputValueUnitScalingRatio: 1000.0*1000.0);
}
var response = Encoding.ASCII.GetBytes(writer.ToString());
entity.Reply(response,
HttpStatusCode.OK,
"OK",
ContentType.PlainText,
Encoding.ASCII,
null,
_ => { });
}
示例8: SendOk
protected void SendOk(HttpEntityManager httpEntityManager)
{
httpEntityManager.ReplyStatus(HttpStatusCode.OK,
"OK",
e => Log.Debug("Error while closing http connection (ok): {0}.", e.Message));
}
示例9: NackMessage
private void NackMessage(HttpEntityManager http, UriTemplateMatch match)
{
var envelope = new NoopEnvelope();
var groupname = match.BoundVariables["subscription"];
var stream = match.BoundVariables["stream"];
var messageId = match.BoundVariables["messageId"];
var nakAction = GetNackAction(http, match);
var id = Guid.NewGuid();
if (!Guid.TryParse(messageId, out id))
{
http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
return;
}
var cmd = new ClientMessage.PersistentSubscriptionNackEvents(
Guid.NewGuid(),
Guid.NewGuid(),
envelope,
BuildSubscriptionGroupKey(stream, groupname),
"Nacked from HTTP",
nakAction,
new[] { id },
http.User);
Publish(cmd);
http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
}
示例10: OnPostScavenge
private void OnPostScavenge(HttpEntityManager entity, UriTemplateMatch match)
{
Log.Info("Request scavenging because /admin/scavenge request has been received.");
Publish(new SystemMessage.ScavengeDatabase());
entity.ReplyStatus(HttpStatusCode.OK, "OK", e => Log.ErrorException(e, "Error while closing http connection (admin controller)"));
}
示例11: OnPostShutdown
private void OnPostShutdown(HttpEntityManager entity, UriTemplateMatch match)
{
Log.Info("Request shut down of node because shutdown command has been received.");
Publish(new ClientMessage.RequestShutdown(exitProcess: true));
entity.ReplyStatus(HttpStatusCode.OK, "OK", e => Log.ErrorException(e, "Error while closing http connection (admin controller)"));
}