November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi Magnus, I think the best way to go for the solution to this to ask Episerver support about it. They will definitely help you with this.
Hey,
We are attempting to broadcasting an event using the IEventRegistry. From what i can see in our logs, there are alot of events being "Missed". Is there any way to see the reason for them being missed?
We are hosting in DXC, so i guess the event registry is broadcasting via the service bus, and that the missed event is some kind of deadletter management. Anyone has any insight as to how the Missed event works for the EventRegistry when hosting in Azure?
The background is that, we have a donutcache implementation and we would like to output cache content for a long time, but if the broadcasted events are regularly failing, it's seems very shaky to rely on content events to invalidate the cache. Or could the missed events be some kind of false positives thats could be disregarded?
The failures are not evenly distributed over all instance, but almost difference about +- 100 failures in about 1000 events. The successful messages are evenly distributed over all instances.
We are using Episerver.Framework version 11.13.1
This is the code:
using EPiServer.Core;
using EPiServer.Events.Clients;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using MediatR;
using System;
using System.Threading;
[InitializableModule]
public class ContentEventsInitialization : IInitializableModule
{
private static readonly Guid _contentEventId = new Guid("F7DD50E3-B504-4384-90DD-B23474E7EB51");
private static readonly Guid _raiserId = new Guid("B33B5CE0-8A83-434C-902B-AFBCE0FB0557");
private static bool _hasInitialized;
private Injected<IContentEvents> ContentEvents { get; set; }
private Injected<IEventRegistry> EventRegistry { get; set; }
private Injected<ILogger> Logger { get; set; }
public void Initialize(InitializationEngine context)
{
if (_hasInitialized)
{
return;
}
ContentEvents.Service.PublishedContent += ContentEvents_PublishedContent;
var customContentEvent = EventRegistry.Service.Get(_contentEventId);
customContentEvent.Raised += CustomContentEvent_Raised;
customContentEvent.Missed += CustomContentEvent_Missed;
_hasInitialized = true;
}
private void CustomContentEvent_Raised(object sender, Events.EventNotificationEventArgs e)
{
try
{
if (!ContentReference.TryParse((string)e.Param, out ContentReference contentReference))
{
Logger.Service.Fatal($"CustomContentEvent_Raised: failed to parse content reference", state: e.Param);
}
Logger.Service.Info($"CustomContentEvent_Raised: success");
}
catch (Exception ex)
{
Logger.Service.Fatal($"CustomContentEvent_Raised: Failed to execute event handler", ex);
}
}
private void CustomContentEvent_Missed(object sender, EventArgs e)
{
Logger.Service.Error($"CustomContentEvent_Missed: Content event propagation failed, trigger FailedContentNotification");
}
public void Uninitialize(InitializationEngine context)
{
ContentEvents.Service.PublishedContent -= ContentEvents_PublishedContent;
var customContentEvent = EventRegistry.Service.Get(_contentEventId);
customContentEvent.Raised -= CustomContentEvent_Raised;
customContentEvent.Missed -= CustomContentEvent_Missed;
}
private void ContentEvents_PublishedContent(object sender, ContentEventArgs e)
{
try
{
EventRegistry.Service
.Get(_contentEventId)
.Raise(_raiserId, e.ContentLink.ToString(), EventRaiseOption.RaiseBroadcast);
}
catch (Exception ex)
{
Logger.Service.Error($"Failed to raise publishedcontent event for ContentLinkID: {e.ContentLink.ID}", ex);
}
}
}
Failed event distribution over 24h period on 1 instance:
Successful event distribution over 24h period on same instance as fails above:
Anyone have any insights to this issue? The missed rate seems to be very high doesn't it?