Copied to clipboard

Flag this post as spam?

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


  • Jesper Weber 54 posts 170 karma points c-trib
    Nov 04, 2022 @ 12:17
    Jesper Weber
    0

    Umbraco Cloud deploy not triggering DictionaryItemSavedNotification

    Hi,

    I have a notification handler on DictionaryItemSavedNotification. The handler triggers fine whenever we create or update a dictionary item from the Umbraco backoffice.

    However when dictionary items are created or updated using Umbraco deploy the handler does not get triggered. This is the case both when we deploy changes to a new environment or if we trigger a deploy manually locally by running echo > deploy

    If we use uSync to sync dictionary items the handler also triggers as expected.

    I don't know how items are created/updated by Umbraco deploy, but it seems like an error?

    Any one else experiencing the same?

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Nov 30, 2022 @ 07:39
    Andy Butland
    1

    Hi Jesper

    What you've found is expected behaviour - Deploy historically and currently supresses events being fired on individual save and publish events when transferring items. This choice was before my time, but I believe the reason for this is to ensure performance. In the back-office, the usual case for a save of an item is one-at-a-time, but with a deployment, there could be hundreds of updates within an operation. For that reason as I understand these events aren't fired.

    Not all events are suppressed though - some that do fire after the deploy operation is completed are the cache refresher events. These are necessary to ensure that in load balanced environments, all instances get their cache updated in the case for example of a content item being saved. When they run, they fire off notifications.

    For example there's a DictionaryCacheRefresherNotification, that if you create a handler for, you should be able to inspect the MessageObject provided and run the appropriate code you need.

    If you provide a constructor parameter of IServerRoleAccessor, you can also ensure to run on only the appropriate servers (likely for your case Single or SchedulingPublisher, to avoid having the events running on the scaled out front-end servers when load balancing).

    I'd be interested to hear how you get on with this and if you still find anything you are unable to complete. We do have the option to look at adding further Deploy specific events if they prove necessary.

    Andy

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Nov 30, 2022 @ 08:53
    Andy Butland
    1

    P.S. I've referenced an illustrative example for this in this blog post.

    Hope that helps.

    Andy

Please Sign in or register to post replies

Write your reply to:

Draft