Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ZNS 60 posts 198 karma points
    Jan 02, 2017 @ 15:28
    ZNS
    0

    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?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jan 03, 2017 @ 09:29
    Jeavon Leopold
    0

    No they will not be triggered, instead you will need to use Cache Events

    e.g.

    CacheRefresherBase<TInstanceType>.CacheUpdated
    
  • ZNS 60 posts 198 karma points
    Jan 03, 2017 @ 10:32
    ZNS
    0

    Ok. If I use ServerRegistrarResolver to set master server. Will the ContentService events trigger on that machine?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jan 03, 2017 @ 10:45
    Jeavon Leopold
    0

    No, ContentService events will occur only on the machine that served Umbraco.

    Master/Slave roles do not have any influence over events.

  • ZNS 60 posts 198 karma points
    Jan 03, 2017 @ 10:46
    ZNS
    0

    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?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jan 03, 2017 @ 12:39
    Jeavon Leopold
    102

    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...

    I have a sample custom cache refresher here

Please Sign in or register to post replies

Write your reply to:

Draft