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

C# Processing.EmittedEventEnvelope类代码示例

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

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



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

示例1: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            emittedEvents = null;
            newState = null;
            var category = _streamCategoryExtractor.GetCategoryByStreamId(data.PositionStreamId);
            if (category == null)
                return true; // handled but not interesting

            string linkTarget;
            if (data.EventType == SystemEventTypes.LinkTo) 
                linkTarget = data.Data;
            else 
                linkTarget = data.EventSequenceNumber + "@" + data.EventStreamId;

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedLinkToWithRecategorization(
                        _categoryStreamPrefix + category, Guid.NewGuid(), linkTarget, eventPosition, expectedTag: null,
                        originalStreamId: data.PositionStreamId))
            };

            return true;
        }
开发者ID:msbahrul,项目名称:EventStore,代码行数:27,代码来源:CategorizeEventsByStreamPath.cs


示例2: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEventEnvelope[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.PositionStreamId.StartsWith("$"))
                return false;
            var lastSlashPos = data.PositionStreamId.LastIndexOf(_separator);
            if (lastSlashPos < 0)
                return true; // handled but not interesting to us

            var category = data.PositionStreamId.Substring(0, lastSlashPos);

            string linkTarget;
            if (data.EventType == SystemEventTypes.LinkTo) 
                linkTarget = data.Data;
            else 
                linkTarget = data.EventSequenceNumber + "@" + data.EventStreamId;

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedLinkToWithRecategorization(
                        _categoryStreamPrefix + category, Guid.NewGuid(), linkTarget, eventPosition, expectedTag: null,
                        originalStreamId: data.PositionStreamId))
            };

            return true;
        }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:30,代码来源:CategorizeEventsByStreamPath.cs


示例3: CreateResultUpdatedEvents

 private EmittedEventEnvelope[] CreateResultUpdatedEvents(string partition, string projectionResult, CheckpointTag at)
 {
     var streamId = _namesBuilder.MakePartitionResultStreamName(partition);
     var allResultsStreamId = _namesBuilder.GetResultStreamName();
     if (string.IsNullOrEmpty(partition))
     {
         var result =
             new EmittedEventEnvelope(
                 projectionResult == null
                     ? new EmittedDataEvent(
                         streamId, Guid.NewGuid(), "ResultRemoved", true, null, null, at, null)
                     : new EmittedDataEvent(
                         streamId, Guid.NewGuid(), "Result", true, projectionResult, null, at, null),
                 _resultStreamMetadata);
         
         return new[] {result};
     }
     else
     {
         var linkTo = new EmittedLinkTo(allResultsStreamId, Guid.NewGuid(), streamId, at, null);
         var linkToEnvelope = new EmittedEventEnvelope(linkTo, _resultStreamMetadata);
         var result =
             new EmittedEventEnvelope(
                 projectionResult == null
                     ? new EmittedDataEvent(
                         streamId, Guid.NewGuid(), "ResultRemoved", true, null, null, at, null,
                         linkTo.SetTargetEventNumber)
                     : new EmittedDataEvent(
                         streamId, Guid.NewGuid(), "Result", true, projectionResult, null, at, null,
                         linkTo.SetTargetEventNumber), _resultStreamMetadata);
         return new[] {result, linkToEnvelope};
     }
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:33,代码来源:ResultEventEmitter.cs


示例4: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category, ResolvedEvent data, out string newState,
            out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            if (!data.EventStreamId.StartsWith(UserStreamPrefix))
                throw new InvalidOperationException(
                    string.Format(
                        "Invalid stream name: '{0}' The IndexUsersProjectionHandler cannot handle events from other streams than named after the '$user-' pattern",
                        data.EventStreamId));

            var loginName = data.EventStreamId.Substring(UserStreamPrefix.Length);

            var userData = data.Data.ParseJson<UserData>();
            if (userData.LoginName != loginName)
                throw new InvalidOperationException(
                    string.Format(
                        "Invalid $UserCreated event found.  '{0}' login name expected, but '{1}' found", loginName,
                        userData.LoginName));

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        UsersStream, Guid.NewGuid(), UserEventType, false, loginName, null, eventPosition, null))
            };
            newState = "";
            return true;
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:29,代码来源:IndexUsersProjectionHandler.cs


示例5: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            emittedEvents = null;
            newState = null;
            if (data.EventStreamId != data.PositionStreamId)
                return false;
            var indexedEventType = data.EventType;
            if (indexedEventType == "$>")
                return false;

            string positionStreamId;
            var isStreamDeletedEvent = StreamDeletedHelper.IsStreamDeletedEvent(
                data.PositionStreamId, data.EventType, data.Data, out positionStreamId);
            if (isStreamDeletedEvent)
                indexedEventType = "$deleted";

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        _indexStreamPrefix + indexedEventType, Guid.NewGuid(), "$>", false,
                        data.EventSequenceNumber + "@" + positionStreamId,
                        isStreamDeletedEvent
                            ? new ExtraMetaData(new Dictionary<string, JRaw> {{"$deleted", new JRaw(-1)}})
                            : null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:32,代码来源:IndexEventsByEventType.cs


示例6: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            emittedEvents = null;
            newState = null;

            if (data.PositionSequenceNumber != 0)
                return false; // not our event

            var category = _streamCategoryExtractor.GetCategoryByStreamId(data.PositionStreamId);
            if (category == null)
                return true; // handled but not interesting

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        "$category" + "-" + category, Guid.NewGuid(), SystemEventTypes.StreamReference, false,
                        data.PositionStreamId, null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:25,代码来源:CategorizeStreamByPath.cs


示例7: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEventEnvelope[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.PositionSequenceNumber != 0)
                return false; // not our event
            if (data.EventStreamId.StartsWith("$"))
                return false;
            var lastSlashPos = data.EventStreamId.LastIndexOf(_separator);
            if (lastSlashPos < 0)
                return true; // handled but not interesting to us

            var category = data.EventStreamId.Substring(0, lastSlashPos);

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        "$category" + _separator + category, Guid.NewGuid(), SystemEventTypes.StreamReference, false,
                        data.EventStreamId, null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:26,代码来源:CategorizeStreamByPath.cs


示例8: ProcessEvent

 public bool ProcessEvent(
     string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
     out string newState, out EmittedEventEnvelope[] emittedEvents)
 {
     emittedEvents = null;
     newState = null;
     return true;
 }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:8,代码来源:StubHandler.cs


示例9: UpdateLastPosition

 private void UpdateLastPosition(EmittedEventEnvelope[] events)
 {
     foreach (var emittedEvent in events)
     {
         if (emittedEvent.Event.CausedByTag > _last)
             _last = emittedEvent.Event.CausedByTag;
     }
 }
开发者ID:EventStore,项目名称:EventStore,代码行数:8,代码来源:ProjectionCheckpoint.cs


示例10: ProcessEvent

 public bool ProcessEvent(
     string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
     out string newState, out EmittedEventEnvelope[] emittedEvents)
 {
     if (data.EventType == "fail" || _query == "fail")
         throw new Exception("failed");
     _logger("ProcessEvent(" + "..." + ")");
     newState = "{\"data\": " + _state + data + "}";
     emittedEvents = null;
     return true;
 }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:11,代码来源:FakeForeachStreamProjection.cs


示例11: ValidateOrderAndEmitEvents

        public void ValidateOrderAndEmitEvents(EmittedEventEnvelope[] events)
        {
            UpdateLastPosition(events);
            EnsureCheckpointNotRequested();

            var groupedEvents = events.GroupBy(v => v.Event.StreamId);
            foreach (var eventGroup in groupedEvents)
            {
                EmitEventsToStream(eventGroup.Key, eventGroup.ToArray());
            }
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:11,代码来源:ProjectionCheckpoint.cs


示例12: ProcessEvent

 public static bool ProcessEvent(
     this IProjectionStateHandler self, string partition, CheckpointTag eventPosition, string streamId,
     string eventType, string category, Guid eventId, int eventSequenceNumber, string metadata, string data,
     out string state, out EmittedEventEnvelope[] emittedEvents, bool isJson = true)
 {
     return self.ProcessEvent(
         partition, eventPosition, category,
         new ResolvedEvent(
             streamId, eventSequenceNumber, streamId, eventSequenceNumber, false, new TFPos(0, -1),
             eventId, eventType, isJson, data, metadata), out state, out emittedEvents);
 }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:11,代码来源:IProjectionStateHandler.cs


示例13: EventProcessedResult

 public EventProcessedResult(
     string partition, CheckpointTag checkpointTag, PartitionState oldState, PartitionState newState,
     EmittedEventEnvelope[] emittedEvents, Guid causedBy, string correlationId)
 {
     if (partition == null) throw new ArgumentNullException("partition");
     if (checkpointTag == null) throw new ArgumentNullException("checkpointTag");
     _emittedEvents = emittedEvents;
     _causedBy = causedBy;
     _correlationId = correlationId;
     _oldState = oldState;
     _newState = newState;
     _partition = partition;
     _checkpointTag = checkpointTag;
 }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:14,代码来源:EventProcessedResult.cs


示例14: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEventEnvelope[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.EventSequenceNumber != 0 || data.ResolvedLinkTo)
                return false; // not our event

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        SystemStreams.StreamsStream, Guid.NewGuid(), SystemEventTypes.LinkTo, false,
                        data.EventSequenceNumber + "@" + data.EventStreamId, null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:19,代码来源:IndexStreams.cs


示例15: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEventEnvelope[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.EventStreamId != data.PositionStreamId)
                return false;
            if (data.EventType == "$>")
                return false;

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        _indexStreamPrefix + data.EventType, Guid.NewGuid(), "$>", false,
                        data.EventSequenceNumber + "@" + data.EventStreamId, null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:21,代码来源:IndexEventsByEventType.cs


示例16: EventsEmitted

 public void EventsEmitted(
     EmittedEventEnvelope[] scheduledWrites, Guid causedBy, string correlationId)
 {
     _coreProjectionCheckpointManager.EventsEmitted(
         scheduledWrites, causedBy, correlationId);
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:6,代码来源:ResultWriter.cs


示例17: ProcessPartitionCreated

 public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
 {
     emittedEvents = null;
     return false;
 }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:5,代码来源:CategorizeStreamByPath.cs


示例18: ProcessNewCheckpoint

 public void ProcessNewCheckpoint(CheckpointTag checkpointPosition, out EmittedEventEnvelope[] emittedEvents)
 {
     emittedEvents = new[]
     {
         new EmittedEventEnvelope(
             new EmittedDataEvent(
                 _indexCheckpointStream, Guid.NewGuid(), ProjectionNamesBuilder.EventType_PartitionCheckpoint,
                 true, checkpointPosition.ToJsonString(), null, checkpointPosition, expectedTag: null))
     };
 }
开发者ID:msbahrul,项目名称:EventStore,代码行数:10,代码来源:IndexEventsByEventType.cs


示例19: EventsEmitted

 public void EventsEmitted(EmittedEventEnvelope[] scheduledWrites, Guid causedBy, string correlationId)
 {
     if (_stopped)
         return;
     EnsureStarted();
     if (_stopping)
         throw new InvalidOperationException("Stopping");
     if (scheduledWrites != null)
     {
         foreach (var @event in scheduledWrites)
         {
             var emittedEvent = @event.Event;
             emittedEvent.SetCausedBy(causedBy);
             emittedEvent.SetCorrelationId(correlationId);
         }
         _currentCheckpoint.ValidateOrderAndEmitEvents(scheduledWrites);
     }
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:18,代码来源:CoreProjectionCheckpointManager.cs


示例20: EventsEmitted

 public void EventsEmitted(
     EmittedEventEnvelope[] scheduledWrites, Guid causedBy, string correlationId)
 {
     throw new NotSupportedException();
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:5,代码来源:SlaveResultWriter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Processing.ProjectionNamesBuilder类代码示例发布时间:2022-05-24
下一篇:
C# Chunks.TFChunkDbConfig类代码示例发布时间: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