当前位置: 首页>>代码示例>>C#>>正文


C# HttpEntityManager.ReadTextRequestAsync方法代码示例

本文整理汇总了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."));
        }
开发者ID:rikace,项目名称:EventStore,代码行数:63,代码来源:PersistentSubscriptionController.cs


注:本文中的EventStore.Transport.Http.EntityManagement.HttpEntityManager.ReadTextRequestAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。