本文整理汇总了C#中EventStore.Projections.Core.Services.Processing.ResolvedEvent类的典型用法代码示例。如果您正苦于以下问题:C# ResolvedEvent类的具体用法?C# ResolvedEvent怎么用?C# ResolvedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResolvedEvent类属于EventStore.Projections.Core.Services.Processing命名空间,在下文中一共展示了ResolvedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例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.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;
}
示例6: 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;
}
示例7: ProcessEvent
public bool ProcessEvent(
string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
out string newState, out EmittedEventEnvelope[] emittedEvents)
{
emittedEvents = null;
newState = null;
return true;
}
示例8: ProcessEvent
public bool ProcessEvent(
string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
out string newState, out EmittedEvent[] emittedEvents)
{
if (data.EventType == "fail" || _query == "fail")
throw new Exception("failed");
_logger("ProcessEvent(" + "..." + ")");
newState = "{\"data\": " + _state + data + "}";
emittedEvents = null;
return true;
}
示例9: ProcessEvent
public bool ProcessEvent(
string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
{
newSharedState = null;
if (data.EventType == "fail" || _query == "fail")
throw new Exception("failed");
Log("ProcessEvent(" + "..." + ")");
newState = "{\"data\": 1}";
emittedEvents = null;
return true;
}
示例10: returns_emitted_events
public void returns_emitted_events()
{
var e = new ResolvedEvent(
"stream", 0, "stream", 0, false, new TFPos(1000, 900), Guid.NewGuid(), "event", true, "{}", "{\"m\":1}");
EmittedEventEnvelope[] emittedEvents;
_stateHandler.ProcessPartitionCreated(
"partition", CheckpointTag.FromPosition(0, 10, 5), e, out emittedEvents);
Assert.IsNotNull(emittedEvents);
Assert.AreEqual(1, emittedEvents.Length);
Assert.AreEqual("stream1", emittedEvents[0].Event.StreamId);
Assert.AreEqual("event1", emittedEvents[0].Event.EventType);
Assert.AreEqual("{\"a\":1}", emittedEvents[0].Event.Data);
}
示例11: Given
protected override void Given()
{
base.Given();
_streams = new[] {"pa", "pb"};
ExistingEvent("a", "test1", "{}", "{}");
ExistingEvent("b", "test1", "{}", "{}");
ExistingEvent("pa", "$>", "[email protected]", "{$o:\"oa\"}");
ExistingEvent("pb", "$>", "[email protected]", "{$o:\"ob\"}");
_event1 = new ResolvedEvent("pa", 1, "a", 1, true, new TFPos(200, 150), Guid.NewGuid(), "test1", true, "{}", "{}", "{$o:\"oa\"");
_event2 = new ResolvedEvent("pb", 1, "b", 1, true, new TFPos(300, 250), Guid.NewGuid(), "test1", true, "{}", "{}", "{$o:\"ob\"");
NoOtherStreams();
AllWritesSucceed();
}
示例12: invokes_created_handler
public void invokes_created_handler()
{
var e = new ResolvedEvent(
"stream", 0, "stream", 0, false, new TFPos(1000, 900), Guid.NewGuid(), "event", true, "{}", "{\"m\":1}");
EmittedEventEnvelope[] emittedEvents;
_stateHandler.ProcessPartitionCreated(
"partition", CheckpointTag.FromPosition(0, 10, 5), e, out emittedEvents);
Assert.AreEqual(5, _logged.Count);
Assert.AreEqual(@"handler-invoked", _logged[0]);
Assert.AreEqual(@"stream", _logged[1]);
Assert.AreEqual(@"event", _logged[2]);
Assert.AreEqual(@"{}", _logged[3]);
Assert.AreEqual(@"{""m"":1}", _logged[4]);
}
示例13: ProcessEvent
public bool ProcessEvent(
string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
out string newState, out EmittedEvent[] emittedEvents)
{
emittedEvents = null;
newState = null;
if (data.EventSequenceNumber != 0)
return false; // not our event
emittedEvents = new[]
{
new EmittedDataEvent(
SystemStreams.StreamsStream, Guid.NewGuid(), SystemEventTypes.LinkTo,
data.EventSequenceNumber + "@" + data.EventStreamId, null, eventPosition, expectedTag: null)
};
return true;
}
示例14: GetStatePartition
public string GetStatePartition(
CheckpointTag eventPosition, string category, ResolvedEvent @event)
{
CheckDisposed();
if (@event == null) throw new ArgumentNullException("event");
var partition = _query.GetPartition(
@event.Data.Trim(), // trimming data passed to a JS
new string[]
{
@event.EventStreamId, @event.IsJson ? "1" : "", @event.EventType, category ?? "",
@event.EventSequenceNumber.ToString(CultureInfo.InvariantCulture), @event.Metadata ?? "",
@event.PositionMetadata ?? ""
});
if (partition == "")
return null;
else
return partition;
}
示例15: ProcessEvent
public bool ProcessEvent(
string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
out string newState, out EmittedEvent[] emittedEvents)
{
emittedEvents = null;
newState = null;
if (data.EventStreamId != data.PositionStreamId)
return false;
if (data.EventType == "$>")
return false;
emittedEvents = new[]
{
new EmittedDataEvent(
_indexStreamPrefix + data.EventType, Guid.NewGuid(), "$>",
data.EventSequenceNumber + "@" + data.EventStreamId, null, eventPosition, expectedTag: null)
};
return true;
}