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


C# Processing.EmittedEventEnvelope类代码示例

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


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


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