Try our conversational search powered by Generative AI!

Event listener for expiring catalog contents in the future


The customer expires catalog categories under Commerce. We are able to capture the event when the expiry datetime is set to “now” but if the user set expiration to a future date and that date comes, will episerver fire an event? 

Edited, Jul 09, 2020 4:31

Hi, no event will be fired. I think you could listen to SavedContent/PublishedContent when expiry datetime is set to now, but there is no "expired" event (and I don't think that will ever be added, for obvious reasons) 

Jul 09, 2020 8:22

What are the obvious reasons for this? We're currently have a main menu cache that contains categories and should be invalidated when a category has expired, so a new cache is built up without the expired category.

Jul 23, 2020 9:27

If there is an "event" - like when you update/publish/delete a content, it would be easy to fire an event. For expiring you would need to have a service running 24/24 and notify when a content StopPublish time is passed. I would say it is a complex system and is (very) hard to implement.

Jul 23, 2020 9:54

Whenever you set the expired date that is in the future, you store the date in a table along with the content id. A scheduled job ran ever 1 second checks if any of those dates has been passed and will fire an event? :)

Jul 23, 2020 10:39

That is one way to do it - to be honest I think about the same thing as well. That can be used as a custom implementation, but as a framework level feature it will need a lot more considerations. 

Jul 23, 2020 10:51
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.