internal override void ReceiveEvent(DurableEvent e) { base.ReceiveEvent(e); if (!(e.DeliveryId is null) && e.EmitterId == this.Id) { Confirm(e.DeliveryId); } }
public override bool Invoke(DurableEvent durableEvent) { if (durableEvent.Payload is BinaryPayload payload) { return(Regex.IsMatch(payload.Manifest)); } return(false); }
/// <summary> /// Evaluates to `true` if all `filters` evaluate to `true`, `false` otherwise. /// </summary> public override bool Invoke(DurableEvent durableEvent) { foreach (var filter in Filters) { if (!filter.Invoke(durableEvent)) { return(false); } } return(true); }
internal override bool ReceiveEventInternal(DurableEvent e, Receive behavior) { var previousVersion = this.CurrentVersion; this.UpdateVersion(e); var handled = base.ReceiveEventInternal(e, behavior); if (!handled) { this.CurrentVersion = previousVersion; } return(handled); }
internal override void ReceiveEvent(DurableEvent e) { base.ReceiveEvent(e); if (e.EmitterId == Id && TryFindPersistOnEventRequest(e, out var request)) { ConfirmRequest(request); } if (invocations.Count != 0) { DeliverRequest(new PersistOnEventRequest(LastSequenceNr, LastHandledEvent.Id, invocations.ToImmutableArray(), InstanceId)); invocations.Clear(); } }
private bool TryFindPersistOnEventRequest(DurableEvent e, out PersistOnEventRequest request) { if (e.PersistOnEventId.HasValue && this.requestsByEventId.TryGetValue(e.PersistOnEventId.Value, out request)) { return(true); } if (e.PersistOnEventSequenceNr.HasValue && this.requestsBySequenceNr.TryGetValue(e.PersistOnEventSequenceNr.Value, out request)) { return(true); } request = default; return(false); }
public Snapshot( object payload, string emitterId, DurableEvent lastEvent, VectorTime currentTime, long sequenceNr, ImmutableHashSet <DeliveryAttempt> deliveryAttempts = null, ImmutableHashSet <PersistOnEventRequest> persistOnEventRequests = null) { Payload = payload; EmitterId = emitterId; LastEvent = lastEvent; CurrentTime = currentTime; SequenceNr = sequenceNr; DeliveryAttempts = deliveryAttempts ?? ImmutableHashSet <DeliveryAttempt> .Empty; PersistOnEventRequests = persistOnEventRequests ?? ImmutableHashSet <PersistOnEventRequest> .Empty; }
/// <summary> /// Updates the current version from the given <paramref name="event"/>. /// </summary> public static void UpdateVersion <T>(this T actor, DurableEvent @event) where T : EventsourcedView, IEventsourcedVersion { actor.CurrentVersion = actor.CurrentVersion.Merge(@event.VectorTimestamp); }
internal void PersistDurableEvent(DurableEvent durableEvent, Action <Try <object> > handler) { writeRequests.Add(durableEvent); writeHandlers.AddLast(handler); }
/// <summary> /// Override to allow post-processing of DurableEvent instances wrapping events generated by <see cref="ProcessEvent(object)"/>. /// /// Amongst other things, this can e.g. be used to set different or additional aggregate IDs for custom routing /// destinations (which by default take the same routing destinations as the original event that was processed). /// </summary> protected virtual DurableEvent PostProcessDurableEvent(DurableEvent e) => e;
/// <summary> /// Evaluates this filter on the given <paramref name="durableEvent"/>. /// </summary> public abstract bool Invoke(DurableEvent durableEvent);
public override bool Invoke(DurableEvent durableEvent) => true;