• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Messaging.Message类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EventStore.Core.Messaging.Message的典型用法代码示例。如果您正苦于以下问题:C# Message类的具体用法?C# Message怎么用?C# Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Message类属于EventStore.Core.Messaging命名空间,在下文中一共展示了Message类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateStreamCompleted

        public static ResponseConfiguration CreateStreamCompleted(HttpEntity entity, Message message)
        {
            Debug.Assert(message.GetType() == typeof(ClientMessage.CreateStreamCompleted));

            var completed = message as ClientMessage.CreateStreamCompleted;
            if (completed == null)
                return InternalServerEror(entity, message);

            switch (completed.ErrorCode)
            {
                case OperationErrorCode.Success:
                    return new ResponseConfiguration(HttpStatusCode.Created,
                                                     "Stream created",
                                                     null,
                                                     new KeyValuePair<string, string>("Location",
                                                                                      HostName.Combine(entity.UserHostName,
                                                                                                  "/streams/{0}",
                                                                                                  completed.EventStreamId)));
                case OperationErrorCode.PrepareTimeout:
                case OperationErrorCode.CommitTimeout:
                case OperationErrorCode.ForwardTimeout:
                    return new ResponseConfiguration(HttpStatusCode.InternalServerError, "Create timeout", null);
                case OperationErrorCode.WrongExpectedVersion:
                case OperationErrorCode.StreamDeleted:
                case OperationErrorCode.InvalidTransaction:
                    return new ResponseConfiguration(HttpStatusCode.BadRequest,
                                                     string.Format("Error code : {0}. Reason : {1}", completed.ErrorCode, completed.Error),
                                                     null);
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
开发者ID:slavah,项目名称:EventStore,代码行数:32,代码来源:Configure.cs


示例2: TextMessage

        public static string TextMessage(HttpEntity entity, Message message)
        {
            Debug.Assert(message.GetType() == typeof(HttpMessage.TextMessage));

            var textMessage = message as HttpMessage.TextMessage;
            return textMessage != null ? entity.ResponseCodec.To(textMessage) : string.Empty;
        }
开发者ID:alistair,项目名称:EventStore,代码行数:7,代码来源:Format.cs


示例3: ReadEventsBackwardsCompletedFeed

            public static string ReadEventsBackwardsCompletedFeed(HttpEntity entity, Message message, int start, int count)
            {
                Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventsBackwardsCompleted));

                var completed = message as ClientMessage.ReadEventsBackwardsCompleted;
                if (completed != null)
                {
                    switch (completed.Result)
                    {
                        case RangeReadResult.Success:
                            var updateTime = completed.Events.Length != 0
                                                 ? completed.Events[0].TimeStamp
                                                 : DateTime.MinValue.ToUniversalTime();
                            return entity.ResponseCodec.To(Convert.ToFeed(completed.EventStreamId,
                                                                          start,
                                                                          count,
                                                                          updateTime,
                                                                          completed.Events,
                                                                          Convert.ToEntry,
                                                                          entity.ServerHttpEndPoint));
                        case RangeReadResult.NoStream:
                        case RangeReadResult.StreamDeleted:
                            return string.Empty;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                }
                return string.Empty;
            }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:29,代码来源:Format.cs


示例4: ReadEventCompleted

        public static ResponseConfiguration ReadEventCompleted(HttpEntity entity, Message message)
        {
            Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventCompleted));

            var completed = message as ClientMessage.ReadEventCompleted;
            if (completed == null)
                return InternalServerEror(entity, message);

            switch (completed.Result)
            {
                case SingleReadResult.Success:
                    return new ResponseConfiguration(HttpStatusCode.OK, 
                                                     "OK",
                                                     entity.ResponseCodec.ContentType,
                                                     new KeyValuePair<string, string>(
                                                         "Cache-Control",
                                                         string.Format("max-age={0}", MaxPossibleAge)));
                case SingleReadResult.NotFound:
                case SingleReadResult.NoStream:
                    return NotFound(entity, completed);
                case SingleReadResult.StreamDeleted:
                    return Gone(entity, completed);
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:26,代码来源:Configure.cs


示例5: RandTestQueueItem

 public RandTestQueueItem(int logicalTime, int globalId, IPEndPoint endPoint, Message message, IPublisher bus)
 {
     LogicalTime = logicalTime;
     GlobalId = globalId;
     EndPoint = endPoint;
     Message = message;
     Bus = bus;
 }
开发者ID:jpierson,项目名称:EventStore,代码行数:8,代码来源:RandTestQueueItem.cs


示例6: HttpSend

 public HttpSend(
     HttpEntityManager httpEntityManager, ResponseConfiguration configuration, string data, Message message)
     : base(Guid.Empty, null, httpEntityManager)
 {
     Data = data;
     Configuration = configuration;
     Message = message;
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:HttpMessage.cs


示例7: GetFreshStatsCompleted

        public static string GetFreshStatsCompleted(HttpResponseFormatterArgs entity, Message message)
        {
            var completed = message as MonitoringMessage.GetFreshStatsCompleted;
            if (completed == null || !completed.Success)
                return String.Empty;

            return entity.ResponseCodec.To(completed.Stats);
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:Format.cs


示例8: PollStream

 public PollStream(string streamId, long lastCommitPosition, int? lastEventNumber, DateTime expireAt, Message originalRequest)
 {
     StreamId = streamId;
     LastCommitPosition = lastCommitPosition;
     LastEventNumber = lastEventNumber;
     ExpireAt = expireAt;
     OriginalRequest = originalRequest;
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:8,代码来源:SubscriptionMessage.cs


示例9: ReadAllEventsForwardCompleted

        public static string ReadAllEventsForwardCompleted(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed)
        {
            var msg = message as ClientMessage.ReadAllEventsForwardCompleted;
            if (msg == null || msg.Result != ReadAllResult.Success)
                return String.Empty;

            return entity.ResponseCodec.To(Convert.ToAllEventsForwardFeed(msg, entity.RequestedUrl, embed)); 
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:Format.cs


示例10: GetStreamEventsBackward

        public static string GetStreamEventsBackward(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed, bool headOfStream)
        {
            var msg = message as ClientMessage.ReadStreamEventsBackwardCompleted;
            if (msg == null || msg.Result != ReadStreamResult.Success)
                return String.Empty;

            return entity.ResponseCodec.To(Convert.ToStreamEventBackwardFeed(msg, entity.RequestedUrl, embed, headOfStream));
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:Format.cs


示例11: SubscribeAwake

 public SubscribeAwake(
     IEnvelope envelope, Guid correlationId, string streamId, TFPos @from, Message replyWithMessage)
 {
     StreamId = streamId;
     From = @from;
     ReplyWithMessage = replyWithMessage;
     Envelope = envelope;
     CorrelationId = correlationId;
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:9,代码来源:AwakeReaderServiceMessage.cs


示例12: GetFreshStatsCompleted

        public static string GetFreshStatsCompleted(HttpEntity entity, Message message)
        {
            Debug.Assert(message.GetType() == typeof(MonitoringMessage.GetFreshStatsCompleted));

            var completed = message as MonitoringMessage.GetFreshStatsCompleted;
            if (completed == null || !completed.Success)
                return string.Empty;

            return entity.ResponseCodec.To(completed.Stats);
        }
开发者ID:alistair,项目名称:EventStore,代码行数:10,代码来源:Format.cs


示例13: ListStreamsCompletedServiceDoc

            public static string ListStreamsCompletedServiceDoc(HttpEntity entity, Message message)
            {
                Debug.Assert(message.GetType() == typeof(ClientMessage.ListStreamsCompleted));

                var streams = message as ClientMessage.ListStreamsCompleted;
                return streams != null
                           ? entity.ResponseCodec.To(Convert.ToServiceDocument(streams.Streams,
                                                                               new string[0],
                                                                               entity.ServerHttpEndPoint))
                           : string.Empty;
            }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:11,代码来源:Format.cs


示例14: EventEntry

        public static string EventEntry(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed)
        {
            var msg = message as ClientMessage.ReadEventCompleted;
            if (msg == null || msg.Result != ReadEventResult.Success || msg.Record.Event == null)
                return entity.ResponseCodec.To(new {});

            switch (entity.ResponseCodec.ContentType)
            {
                case ContentType.Atom:
                case ContentType.AtomJson:
                case ContentType.Html:
                    return entity.ResponseCodec.To(Convert.ToEntry(msg.Record, entity.RequestedUrl, embed, singleEntry: true));
                default:
                    return AutoEventConverter.SmartFormat(msg.Record, entity.ResponseCodec);
            }
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:16,代码来源:Format.cs


示例15: ReadEventCompletedEntry

            public static string ReadEventCompletedEntry(HttpEntity entity, Message message)
            {
                Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventCompleted));

                var completed = message as ClientMessage.ReadEventCompleted;
                if (completed != null)
                {
                    switch (completed.Result)
                    {
                        case SingleReadResult.Success:
                            return entity.ResponseCodec.To(Convert.ToEntry(completed.Record, entity.ServerHttpEndPoint));
                        case SingleReadResult.NotFound:
                        case SingleReadResult.NoStream:
                        case SingleReadResult.StreamDeleted:
                            return string.Empty;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                }
                return string.Empty;
            }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:21,代码来源:Format.cs


示例16: ReadEventCompletedEntry

            public static string ReadEventCompletedEntry(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed)
            {
                Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventCompleted));

                var completed = message as ClientMessage.ReadEventCompleted;
                if (completed != null)
                {
                    switch (completed.Result)
                    {
                        case ReadEventResult.Success:
                            return entity.ResponseCodec.To(Convert.ToEntry(completed.Record, entity.UserHostName, embed));
                        case ReadEventResult.NotFound:
                        case ReadEventResult.NoStream:
                        case ReadEventResult.StreamDeleted:
                            return string.Empty;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                }
                return string.Empty;
            }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:21,代码来源:Format.cs


示例17: ReadStreamEventsBackwardCompletedFeed

            public static string ReadStreamEventsBackwardCompletedFeed(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed, bool headOfStream)
            {
                Debug.Assert(message.GetType() == typeof(ClientMessage.ReadStreamEventsBackwardCompleted));

                var completed = message as ClientMessage.ReadStreamEventsBackwardCompleted;
                if (completed != null)
                {
                    switch (completed.Result)
                    {
                        case ReadStreamResult.Success:
                            return entity.ResponseCodec.To(Convert.ToReadStreamFeed(completed, entity.UserHostName, embed, headOfStream));
                        case ReadStreamResult.NoStream:
                        case ReadStreamResult.StreamDeleted:
                        case ReadStreamResult.NotModified:
                        case ReadStreamResult.Error:
                            return string.Empty;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                }
                return string.Empty;
            }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:22,代码来源:Format.cs


示例18: Handle

 public void Handle(Message message)
 {
     Publish(message);
 }
开发者ID:msbahrul,项目名称:EventStore,代码行数:4,代码来源:QueuedHandlerThreadPool.cs


示例19: WriteEventsCompleted

 public static string WriteEventsCompleted(HttpEntity entity, Message message)
 {
     Debug.Assert(message.GetType() == typeof(ClientMessage.WriteEventsCompleted));
     return string.Empty;
 }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:5,代码来源:Format.cs


示例20: WriteEvents

        public static string WriteEvents(ICodec codec, Message message)
        {
            Debug.Assert(message.GetType() == typeof (ClientMessage.WriteEvents));

            var writeEvents = message as ClientMessage.WriteEvents;
            if (writeEvents == null)
                return string.Empty;

            return codec.To(new ClientMessageDto.WriteEventText(writeEvents.CorrelationId,
                                                                writeEvents.ExpectedVersion,
                                                                writeEvents.Events.Select(e => new ClientMessageDto.EventText(e.EventId, 
                                                                                                                              e.EventType,
                                                                                                                              e.Data, 
                                                                                                                              e.Metadata)).ToArray()));
        }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:15,代码来源:Format.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Tcp.TcpPackage类代码示例发布时间:2022-05-24
下一篇:
C# Data.ResolvedEvent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap