Event Handler on Target Server After Staging Sync

Andre Pfanz asked on September 26, 2017 16:40

I have a rather unusual situation. I have a staging server and a production server for this one site. We make all our updates on stage and then sync to production. The unusual part is after a page is updated we have a custom task that generates a PDF version of that page. When a page is updated on stage, the node ID of that page goes into a custom table as a queue. The custom task reads this custom table and generates a PDF for each page using the node ID. So far so good. The issue is when we sync to production using the staging app, I need some kind of event handler on the production server that runs after a sync. This event handler will populate the queue custom table on the production server so the PDF generator task will run there. Does anyone have any ideas on how this can be done?

Correct Answer

Rui Wang answered on September 26, 2017 16:46

You can use this ProcessTask event which occurs on the target server when processing incoming staging tasks.

The processing of the staging tasks then also triggers the corresponding DocumentEvents or ObjectEvents (Insert, Update, Delete, etc.).

https://docs.kentico.com/k10/custom-development/handling-global-events/reference-global-system-events#Reference-Globalsystemevents-StagingEvents

0 votesVote for this answer Unmark Correct answer

Recent Answers


Andre Pfanz answered on September 26, 2017 20:44 (last edited on September 26, 2017 20:55)

Thanks for the information.

I do include the following

DocumentEvents.Insert.After += ProcessPageInsertOrUpdate;
DocumentEvents.Update.After += ProcessPageInsertOrUpdate;

to handle any new or updated pages. When you say

The processing of the staging tasks then also triggers the corresponding DocumentEvents or ObjectEvents (Insert, Update, Delete, etc.).

Does this mean when the page is synced on production, the DocumentEvents.Insert and DocumentEvents.Update events are run on production?

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on September 26, 2017 21:10

Yes, when the page is synced to PROD successfully, the DocuemntEvents should fire automatically.

0 votesVote for this answer Mark as a Correct answer

Andre Pfanz answered on September 26, 2017 21:11

Thanks

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.