本文整理汇总了C#中EventStore.Core.Data.ResolvedEvent类的典型用法代码示例。如果您正苦于以下问题:C# ResolvedEvent类的具体用法?C# ResolvedEvent怎么用?C# ResolvedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResolvedEvent类属于EventStore.Core.Data命名空间,在下文中一共展示了ResolvedEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OutstandingMessage
public OutstandingMessage(Guid eventId, PersistentSubscriptionClient handlingClient, ResolvedEvent resolvedEvent, int retryCount) : this()
{
EventId = eventId;
HandlingClient = handlingClient;
ResolvedEvent = resolvedEvent;
RetryCount = retryCount;
}
开发者ID:danieldeb,项目名称:EventStore,代码行数:7,代码来源:OutstandingMessage.cs
示例2: PushMessageToClient
public ConsumerPushResult PushMessageToClient(ResolvedEvent ev)
{
if (_state == null)
{
return ConsumerPushResult.NoMoreCapacity;
}
if (_state.AvailableCapacity == 0)
{
return ConsumerPushResult.NoMoreCapacity;
}
uint bucket = GetAssignmentId(ev);
if (_state.Assignments[bucket].State != BucketAssignment.BucketState.Assigned)
{
_state.AssignBucket(bucket);
}
if (!_state.Assignments[bucket].Node.Client.Push(ev))
{
return ConsumerPushResult.Skipped;
}
_state.RecordEventSent(bucket);
return ConsumerPushResult.Sent;
}
开发者ID:czcz1024,项目名称:EventStore,代码行数:28,代码来源:PinnedPersistentSubscriptionConsumerStrategy.cs
示例3: SmartFormat
public static string SmartFormat(ResolvedEvent evnt, ICodec targetCodec)
{
var dto = CreateDataDto(evnt);
switch (targetCodec.ContentType)
{
case ContentType.Xml:
case ContentType.ApplicationXml:
{
var serializeObject = JsonConvert.SerializeObject(dto.data);
var deserializeXmlNode = JsonConvert.DeserializeXmlNode(serializeObject, "data");
return deserializeXmlNode.InnerXml;
}
case ContentType.Json:
return targetCodec.To(dto.data);
case ContentType.Atom:
case ContentType.EventXml:
{
var serializeObject = JsonConvert.SerializeObject(dto);
var deserializeXmlNode = JsonConvert.DeserializeXmlNode(serializeObject, "event");
return deserializeXmlNode.InnerXml;
}
case ContentType.EventJson:
return targetCodec.To(dto);
default:
throw new NotSupportedException();
}
}
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:33,代码来源:AutoEventConverter.cs
示例4: GetLinkToFor
private string GetLinkToFor(ResolvedEvent ev)
{
if (ev.Event == null) // Unresolved link so just use the bad/deleted link data.
{
return Encoding.UTF8.GetString(ev.Link.Data);
}
return string.Format("{0}@{1}", ev.Event.EventNumber, ev.Event.EventStreamId);
}
开发者ID:czcz1024,项目名称:EventStore,代码行数:9,代码来源:PersistentSubscriptionMessageParker.cs
示例5: GetJsonEventReadResult
public static string GetJsonEventReadResult(ResolvedEvent evnt, bool dataJson = true, bool metadataJson = true)
{
return string.Format(JsonEventReadFormat,
WrapIntoQuotes(evnt.Event.EventStreamId),
evnt.Event.EventNumber,
WrapIntoQuotes(evnt.Event.EventType),
dataJson ? JsonData : WrapIntoQuotes(AsString(evnt.Event.Data)),
metadataJson ? JsonMetadata : WrapIntoQuotes(AsString(evnt.Event.Metadata)));
}
开发者ID:nishanperera,项目名称:EventStore,代码行数:9,代码来源:auto_convertion.cs
示例6: BeginParkMessage
public void BeginParkMessage(ResolvedEvent ev,string reason, Action<ResolvedEvent, OperationResult> completed)
{
var metadata = new ParkedMessageMetadata {Added = DateTime.Now, Reason = reason, SubscriptionEventNumber = ev.OriginalEventNumber};
string data = GetLinkToFor(ev);
var parkedEvent = new Event(Guid.NewGuid(), SystemEventTypes.LinkTo, false, data, metadata.ToJson());
_ioDispatcher.WriteEvent(_parkedStreamId, ExpectedVersion.Any, parkedEvent, SystemAccount.Principal, x => WriteStateCompleted(completed, ev, x));
}
开发者ID:czcz1024,项目名称:EventStore,代码行数:10,代码来源:PersistentSubscriptionMessageParker.cs
示例7: ReadAllResult
public ReadAllResult(ResolvedEvent[] events, int maxCount, TFPos currentPos, TFPos nextPos, TFPos prevPos, long tfEofPosition)
{
Ensure.NotNull(events, "events");
Events = events;
MaxCount = maxCount;
CurrentPos = currentPos;
NextPos = nextPos;
PrevPos = prevPos;
TfEofPosition = tfEofPosition;
}
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:11,代码来源:ReadAllResult.cs
示例8: PushMessageToClient
public override ConsumerPushResult PushMessageToClient(ResolvedEvent ev)
{
for (int i = 0; i < Clients.Count; i++)
{
if (Clients.Peek().Push(ev))
{
return ConsumerPushResult.Sent;
}
var c = Clients.Dequeue();
Clients.Enqueue(c);
}
return ConsumerPushResult.NoMoreCapacity;
}
开发者ID:czcz1024,项目名称:EventStore,代码行数:14,代码来源:DispatchToSinglePersistentSubscriptionConsumerStrategy.cs
示例9: PushMessageToClient
public virtual ConsumerPushResult PushMessageToClient(ResolvedEvent ev)
{
for (int i = 0; i < Clients.Count; i++)
{
var c = Clients.Dequeue();
var pushed = c.Push(ev);
Clients.Enqueue(c);
if (pushed)
{
return ConsumerPushResult.Sent;
}
}
return ConsumerPushResult.NoMoreCapacity;
}
开发者ID:rbanks54,项目名称:EventStore,代码行数:14,代码来源:IPersistentSubscriptionConsumerStrategy.cs
示例10: CreateDataDto
public static HttpClientMessageDto.ReadEventCompletedText CreateDataDto(ResolvedEvent evnt)
{
var dto = new HttpClientMessageDto.ReadEventCompletedText(evnt);
if (evnt.Event.Flags.HasFlag(PrepareFlags.IsJson))
{
var deserializedData = Codec.Json.From<object>((string) dto.data);
var deserializedMetadata = Codec.Json.From<object>((string) dto.metadata);
if (deserializedData != null)
dto.data = deserializedData;
if (deserializedMetadata != null)
dto.metadata = deserializedMetadata;
}
return dto;
}
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:15,代码来源:AutoEventConverter.cs
示例11: ReadEventCompletedText
public ReadEventCompletedText(ResolvedEvent evnt)
{
if (evnt.Event != null)
{
eventStreamId = evnt.Event.EventStreamId;
eventNumber = evnt.Event.EventNumber;
eventType = evnt.Event.EventType;
data = Helper.UTF8NoBom.GetString(evnt.Event.Data ?? Empty.ByteArray);
metadata = Helper.UTF8NoBom.GetString(evnt.Event.Metadata ?? Empty.ByteArray);
}
else
{
eventStreamId = null;
eventNumber = EventNumber.Invalid;
eventType = null;
data = null;
metadata = null;
}
}
开发者ID:adbrowne,项目名称:EventStore,代码行数:20,代码来源:HttpClientMessageDto.cs
示例12: RetryMessage
private void RetryMessage(ResolvedEvent @event, int count)
{
Log.Debug("Retrying message {0} {1}/{2}", SubscriptionId, @event.OriginalStreamId, @event.OriginalPosition);
_outstandingMessages.Remove(@event.OriginalEvent.EventId);
_pushClients.RemoveProcessingMessage(@event.OriginalEvent.EventId);
_streamBuffer.AddRetry(new OutstandingMessage(@event.OriginalEvent.EventId, null, @event, count + 1));
}
开发者ID:rikace,项目名称:EventStore,代码行数:7,代码来源:PersistentSubscription.cs
示例13: RetrySingleMessage
public void RetrySingleMessage(ResolvedEvent @event)
{
_streamBuffer.AddRetry(new OutstandingMessage(@event.OriginalEvent.EventId, null, @event, 0));
}
开发者ID:rikace,项目名称:EventStore,代码行数:4,代码来源:PersistentSubscription.cs
示例14: ParkMessage
private void ParkMessage(ResolvedEvent resolvedEvent, string reason, int count)
{
_settings.MessageParker.BeginParkMessage(resolvedEvent, reason, (e, result) =>
{
if (result != OperationResult.Success)
{
if (count < 5)
{
Log.Info("Unable to park message {0}/{1} operation failed {2} retrying.", e.OriginalStreamId,
e.OriginalEventNumber, result);
ParkMessage(e, reason, count + 1);
return;
}
Log.Error("Unable to park message {0}/{1} operation failed {2} after retries. Possible message loss.", e.OriginalStreamId,
e.OriginalEventNumber, result);
}
lock (_lock)
{
_outstandingMessages.Remove(e.OriginalEvent.EventId);
_pushClients.RemoveProcessingMessage(e.OriginalEvent.EventId);
TryPushingMessagesToClients();
}
});
}
开发者ID:rikace,项目名称:EventStore,代码行数:24,代码来源:PersistentSubscription.cs
示例15: HandleParkedReadCompleted
public void HandleParkedReadCompleted(ResolvedEvent[] events, int newposition, bool isEndofStrem, int stopAt)
{
lock (_lock)
{
if ((_state & PersistentSubscriptionState.ReplayingParkedMessages) == 0) return;
foreach (var ev in events)
{
if (ev.OriginalEventNumber == stopAt)
{
break;
}
Log.Debug("Retrying event {0} on subscription {1}", ev.OriginalEvent.EventId, _settings.SubscriptionId);
_streamBuffer.AddRetry(new OutstandingMessage(ev.OriginalEvent.EventId, null, ev, 0));
}
TryPushingMessagesToClients();
if (isEndofStrem || stopAt <= newposition)
{
var replayedEnd = newposition == -1 ? stopAt : Math.Min(stopAt, newposition);
_settings.MessageParker.BeginMarkParkedMessagesReprocessed(replayedEnd);
_state ^= PersistentSubscriptionState.ReplayingParkedMessages;
}
else
{
TryReadingParkedMessagesFrom(newposition, stopAt);
}
}
}
开发者ID:rikace,项目名称:EventStore,代码行数:31,代码来源:PersistentSubscription.cs
示例16: BeginParkMessage
public void BeginParkMessage(ResolvedEvent @event, string reason, Action<ResolvedEvent, OperationResult> completed)
{
ParkedEvents.Add(@event);
_parkMessageCompleted = completed;
}
开发者ID:rbanks54,项目名称:EventStore,代码行数:5,代码来源:PersistentSubscriptionTests.cs
示例17: AddMessageAsProcessing
public void AddMessageAsProcessing(ResolvedEvent ev, PersistentSubscriptionClient client)
{
lock (_lock)
{
_outstandingMessages.StartMessage(new OutstandingMessage(ev.OriginalEvent.EventId, client, ev, 0),
DateTime.Now + _settings.MessageTimeout);
}
}
开发者ID:rikace,项目名称:EventStore,代码行数:8,代码来源:PersistentSubscription.cs
示例18: ToEntry
public static EntryElement ToEntry(ResolvedEvent eventLinkPair, Uri requestedUrl, EmbedLevel embedContent, bool singleEntry = false)
{
if (requestedUrl == null)
return null;
var evnt = eventLinkPair.Event;
var link = eventLinkPair.Link;
EntryElement entry;
if (embedContent > EmbedLevel.Content && evnt != null)
{
var richEntry = new RichEntryElement();
entry = richEntry;
richEntry.EventId = evnt.EventId;
richEntry.EventType = evnt.EventType;
richEntry.EventNumber = evnt.EventNumber;
richEntry.StreamId = evnt.EventStreamId;
richEntry.PositionEventNumber = eventLinkPair.OriginalEvent.EventNumber;
richEntry.PositionStreamId = eventLinkPair.OriginalEvent.EventStreamId;
richEntry.IsJson = (evnt.Flags & PrepareFlags.IsJson) != 0;
if (embedContent >= EmbedLevel.Body && eventLinkPair.Event != null)
{
if (richEntry.IsJson)
{
if (embedContent >= EmbedLevel.PrettyBody)
{
try
{
richEntry.Data = Helper.UTF8NoBom.GetString(evnt.Data);
// next step may fail, so we have already assigned body
richEntry.Data = FormatJson(Helper.UTF8NoBom.GetString(evnt.Data));
}
catch
{
// ignore - we tried
}
}
else
richEntry.Data = Helper.UTF8NoBom.GetString(evnt.Data);
}
else if (embedContent >= EmbedLevel.TryHarder)
{
try
{
richEntry.Data = Helper.UTF8NoBom.GetString(evnt.Data);
// next step may fail, so we have already assigned body
richEntry.Data = FormatJson(richEntry.Data);
// it is json if successed
richEntry.IsJson = true;
}
catch
{
// ignore - we tried
}
}
// metadata
if (embedContent >= EmbedLevel.Body)
{
try
{
richEntry.MetaData = Helper.UTF8NoBom.GetString(evnt.Metadata);
richEntry.IsMetaData = richEntry.MetaData.IsNotEmptyString();
// next step may fail, so we have already assigned body
if (embedContent >= EmbedLevel.PrettyBody)
{
richEntry.MetaData = FormatJson(richEntry.MetaData);
}
if (string.IsNullOrEmpty(richEntry.MetaData))
{
richEntry.MetaData = null;
}
}
catch
{
// ignore - we tried
}
var lnk = eventLinkPair.Link;
if (lnk != null)
{
try
{
richEntry.LinkMetaData = Helper.UTF8NoBom.GetString(lnk.Metadata);
richEntry.IsLinkMetaData = richEntry.LinkMetaData.IsNotEmptyString();
// next step may fail, so we have already assigned body
if (embedContent >= EmbedLevel.PrettyBody)
{
richEntry.LinkMetaData = FormatJson(richEntry.LinkMetaData);
}
}
catch
{
// ignore - we tried
}
}
}
}
}
else
{
entry = new EntryElement();
//.........这里部分代码省略.........
开发者ID:EventStore,项目名称:EventStore,代码行数:101,代码来源:Convert.cs
示例19: ReadAllEventsBackwardCompleted
public ReadAllEventsBackwardCompleted(Guid correlationId, ReadAllResult result, string error, ResolvedEvent[] events,
StreamMetadata streamMetadata, bool isCachePublic, int maxCount,
TFPos currentPos, TFPos nextPos, TFPos prevPos, long tfLastCommitPosition)
{
Ensure.NotNull(events, "events");
CorrelationId = correlationId;
Result = result;
Error = error;
Events = events;
StreamMetadata = streamMetadata;
IsCachePublic = isCachePublic;
MaxCount = maxCount;
CurrentPos = currentPos;
NextPos = nextPos;
PrevPos = prevPos;
TfLastCommitPosition = tfLastCommitPosition;
}
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:18,代码来源:ClientMessage.cs
示例20: PublishCommand
private void PublishCommand(ResolvedEvent resolvedEvent)
{
var command = resolvedEvent.Event.EventType;
Log.Debug("Response received: {0}", command);
switch (command)
{
case "$measured":
{
var body = resolvedEvent.Event.Data.ParseJson<PartitionMeasuredResponse>();
_publisher.Publish(
new PartitionMeasured(
_workerId,
_masterProjectionId,
Guid.ParseExact(body.SubscriptionId, "N"),
body.Partition,
body.Size));
break;
}
case "$progress":
{
var body = resolvedEvent.Event.Data.ParseJson<PartitionProcessingProgressResponse>();
_publisher.Publish(
new PartitionProcessingProgress(
_workerId,
_masterProjectionId,
Guid.ParseExact(body.SubscriptionId, "N"),
body.Progress));
break;
}
case "$result":
{
var body = resolvedEvent.Event.Data.ParseJson<PartitionProcessingResultResponse>();
_publisher.Publish(
new PartitionProcessingResult(
_workerId,
_masterProjectionId,
Guid.ParseExact(body.SubscriptionId, "N"),
body.Partition,
Guid.ParseExact(body.CausedBy, "N"),
body.Position,
body.Result));
break;
}
default:
throw new Exception("Unknown response: " + command);
}
}
开发者ID:EventStore,项目名称:EventStore,代码行数:47,代码来源:MasterCoreProjectionResponseReader.cs
注:本文中的EventStore.Core.Data.ResolvedEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论