本文整理汇总了C#中EventStore.Transport.Http.EntityManagement.HttpEntityManager.ReadTextRequestAsync方法的典型用法代码示例。如果您正苦于以下问题:C# HttpEntityManager.ReadTextRequestAsync方法的具体用法?C# HttpEntityManager.ReadTextRequestAsync怎么用?C# HttpEntityManager.ReadTextRequestAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventStore.Transport.Http.EntityManagement.HttpEntityManager
的用法示例。
在下文中一共展示了HttpEntityManager.ReadTextRequestAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PutSubscription
private void PutSubscription(HttpEntityManager http, UriTemplateMatch match)
{
if (_httpForwarder.ForwardRequest(http))
return;
var groupname = match.BoundVariables["subscription"];
var stream = match.BoundVariables["stream"];
var envelope = new SendToHttpEnvelope(
_networkSendQueue, http,
(args, message) => http.ResponseCodec.To(message),
(args,message) =>
{
int code;
var m = message as ClientMessage.CreatePersistentSubscriptionCompleted;
if(m==null) throw new Exception("unexpected message " + message);
switch (m.Result)
{
case ClientMessage.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult.Success:
code = HttpStatusCode.Created;
//TODO competing return uri to subscription
break;
case ClientMessage.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult.AlreadyExists:
code = HttpStatusCode.Conflict;
break;
case ClientMessage.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult.AccessDenied:
code = HttpStatusCode.Unauthorized;
break;
default:
code = HttpStatusCode.InternalServerError;
break;
}
return new ResponseConfiguration(code, http.ResponseCodec.ContentType,
http.ResponseCodec.Encoding, new KeyValuePair<string, string>("location", MakeUrl(http, "/subscriptions/" + stream + "/" + groupname)));
});
http.ReadTextRequestAsync(
(o, s) =>
{
var data = http.RequestCodec.From<SubscriptionConfigData>(s);
var config = GetConfig(data);
var message = new ClientMessage.CreatePersistentSubscription(Guid.NewGuid(),
Guid.NewGuid(),
envelope,
stream,
groupname,
config.ResolveLinktos,
config.StartFrom,
config.MessageTimeoutMilliseconds,
config.ExtraStatistics,
config.MaxRetryCount,
config.BufferSize,
config.LiveBufferSize,
config.ReadBatchSize,
config.CheckPointAfterMilliseconds,
config.MinCheckPointCount,
config.MaxCheckPointCount,
config.MaxSubscriberCount,
CalculateNamedConsumerStrategyForOldClients(data),
http.User,
"",
"");
Publish(message);
}, x => Log.DebugException(x, "Reply Text Content Failed."));
}