本文整理汇总了C#中EventStore.Core.Data.ResolvedEvent类的典型用法代码示例。如果您正苦于以下问题:C# ResolvedEvent类的具体用法?C# ResolvedEvent怎么用?C# ResolvedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResolvedEvent类属于EventStore.Core.Data命名空间,在下文中一共展示了ResolvedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OutstandingMessage
public OutstandingMessage(Guid eventId, PersistentSubscriptionClient handlingClient, ResolvedEvent resolvedEvent, int retryCount) : this()
{
EventId = eventId;
HandlingClient = handlingClient;
ResolvedEvent = resolvedEvent;
RetryCount = retryCount;
}
示例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;
}
示例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();
}
}
示例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);
}
示例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)));
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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));
}
示例13: RetrySingleMessage
public void RetrySingleMessage(ResolvedEvent @event)
{
_streamBuffer.AddRetry(new OutstandingMessage(@event.OriginalEvent.EventId, null, @event, 0));
}
示例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();
}
});
}
示例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);
}
}
}