When using flexible load balancing are the Published and Unpublishing events on the ContentService triggered on all load balanced machines? If not is there any way to hook into the load balancing instructions?
Ok. Good to know. Also, I'm hooking up to the Unpublishing event to clear a cache. I need to be able to fetch the URL for the unpublished node, is that possible using the cacherefresherbase?
Well you can hook into a page cache event and as unpublish will trigger this
e.g. CacheRefresherBase<PageCacheRefresher>.CacheUpdated += this.CachePageEvents_CacheUpdated;
Then you will need to check e.MessageType for either MessageType.RemoveByInstance or MessageType.RemoveById as an unpublish event is the same as a deletion (I don't think you can tell the difference)
But as the item will already be unpublished I don't think you will be able to fetch the Url.
I would suggest a creating a custom cache refresher which includes the URL of the item as the payload...
Publish events on load balanced environments
Hi,
When using flexible load balancing are the Published and Unpublishing events on the ContentService triggered on all load balanced machines? If not is there any way to hook into the load balancing instructions?
No they will not be triggered, instead you will need to use Cache Events
e.g.
Ok. If I use ServerRegistrarResolver to set master server. Will the ContentService events trigger on that machine?
No, ContentService events will occur only on the machine that served Umbraco.
Master/Slave roles do not have any influence over events.
Ok. Good to know. Also, I'm hooking up to the Unpublishing event to clear a cache. I need to be able to fetch the URL for the unpublished node, is that possible using the cacherefresherbase?
Well you can hook into a page cache event and as unpublish will trigger this
e.g.
CacheRefresherBase<PageCacheRefresher>.CacheUpdated += this.CachePageEvents_CacheUpdated;
Then you will need to check
e.MessageType
for eitherMessageType.RemoveByInstance
orMessageType.RemoveById
as an unpublish event is the same as a deletion (I don't think you can tell the difference)But as the item will already be unpublished I don't think you will be able to fetch the Url.
I would suggest a creating a custom cache refresher which includes the URL of the item as the payload...
I have a sample custom cache refresher here
is working on a reply...