You should only have a single authoring server, here is some documentation which details the configuration : Episerver load balancing example - Configuring events over WCF with TCP/IP – Support Help Center (optimizely.com)
Mehmet, try instead to configure the event provider in appsettings.json
"EventProvider" : {
"Provider" : "EPiServer.Azure.Events.AzureEventProvider,EPiServer.Azure"
},
"AzureEventProvider" : {
"ConnectionString" : "The contention string",
"TopicName" : "The topic name "
}
Also remember the provide the connection string against "EPiServerAzureEvents".
@Minesh Shah (Netcel) Is there any updated version of this documentation? We're using Azure web apps with .Net 6, and applying these settings for the .net core applications is a bit complicated.
@Surjit Bharath Thanks for the tips. I'll use the way you suggets and keep you updated.
Hi @Surjit Bharath
Thanks again for a suggestion for an Azure event provider. It's working as you suggested, but I have one more issue for remote events. I'm getting remote events through CatalogEventBroadcaster and CatalogKeyEventBroadcaster.
Both of them are for product, variant, or package-level information. I need the remote events for CMS, like category content or other pages.
How can I get this kind of event?
Best,
Mehmet
@Surjit Bharath I'm already checking events coming from IContentEvents and ICatalogEvents, but these events are only triggered locally. I need remote events for these.
For example, PublishedContent event. We have some business logic in this event, but some of them need to run in other instances. I couldn't find how to trigger a remote event for this one.
I believe they are local only Mehmet. Only cache invalidation is raised remotely.
I'll double check this for you at some point today.
@Mehmet see Quan's last response in this thread: https://world.optimizely.com/forum/developer-forum/cms-12/thread-container/2023/12/events-from-icontentevents-not-being-raised-in-a-load-balanced-environment/
@Surjit Bharath I'm a bit confused. On the document page, it was mentioned that an AzureServiceBus provider needs to be added for remote events. I added it in the way you described. Through this, I am successfully receiving updates for price and stock information.
Now, do I need to add the EPiServer.Events.MassTransit package just for content updates? Or should I delete the AzureServiceBus package and only use the EPiServer.Events.MassTransit package?
AzureServiceBus provider is needed only on Azure environment (e.g. DXP). If you are running on premise, you will need a different provider
Forget the events packages. You've already setup the service bus on your azure instance.
I sent you the link to show you a second source about only cache invalidation events being remote.
Surjit is correct, the content events are local - they are raised on same instance when it happens. They are basically event - C# Reference - C# | Microsoft Learn
For an event to be remote, it has to be raised by Event.Raise. Only very few events in CMS use this mechanism. Cache invalidation is one (but not only)
@Quan Mai Our website is running on Azure.
@Surjit Bharath I'm not getting any event for cache invalidations. How can I subscribe for cache invalidation event?
Here is my current setup for events;
//Event registration for local only
contentEvents.SavingContent += epiServerEventsSubscriberService.SavingContent;
contentEvents.PublishingContent += epiServerEventsSubscriberService.PublishingContent;
contentEvents.PublishedContent += epiServerEventsSubscriberService.PublishedContent;
catalogEvents.RelationUpdated += epiServerEventsSubscriberService.RelationUpdated;
contentEvents.CreatedContent += epiServerEventsSubscriberService.CreatedContent;
catalogKeyEventBroadcaster.PriceUpdated += epiServerEventsSubscriberService.PriceUpdated;
catalogKeyEventBroadcaster.InventoryUpdated += epiServerEventsSubscriberService.InventoryUpdated;
//Remote event registration
Event.Get(CatalogEventBroadcaster.CommerceProductUpdated).Raised += epiServerEventsSubscriberService.CommerceProductUpdated;
Event.Get(CatalogKeyEventBroadcaster.CatalogKeyEventGuid).Raised += epiServerEventsSubscriberService.CatalogKeyEventUpdated;
I'm getting price and stock updates from CatalogKeyEventUpdated. Product and variant-level events from CommerceProductUpdated.
Why do you need to listen to cache invalidation? it's meant to be fully transparent. The framework listens to those event themselves and do the cache invalidation, i.e. you don't need to do anything about it.
@Quan Mai When we update the price of the product, it is not updated on other servers. I thought this is related to cache invalidation. If the framework does this automatically, then the problem we are facing is due to another reason. I will investigate this a bit more and let you know.
Does that happen only to price? If you update a page does it get updated on other instances?
If it is only to price, how do you update it?
Hi,
We're trying to use EPi events with multiple servers. For that, we implemented the Azure event provider to the .NET Core application. With this implementation, we can see some events going through the Azure service bus topic. However, if we try to change some data with one content type, it does not sync on other servers.
I couldn't find proper documentation on how EPi handled these events. So, my question is, how can we trigger new events that need to run on all the servers on our server farms? Also, How can we trigger some events that need to be run locally on the server?
Best,
Mehmet