We have a requirement where once the page is successfully published from Tridion on page post publish we need to make a httpwebrequest to our presentation/DD4T content delivery site to retrieve the complete html markup of the same page(which is published in the context) as webresponse . So that this markup contains all latest changes we made to content and we use this markup to store in custom DB along with other metadata of current page for search indexing purposes.
We tried using Event handler on page and subscribed to PublishEventArgs on TransactionCommitted phase but the code written in this functionality is executing before the publish transaction is completed/shown success in publish queue ( my expectation is the code in this event should trigger after page is successfully published to broker and transaction is committed but it’s not the case when implemented)
We also tried Deployer extension on post-transaction phase but even this part executes before transaction is committed i.e soon Tridion default deployment modules are executed.
So in both above approaches we are getting old content while we do httpwebrequest rather than latest published changes to broker DB. In case page is published for very first time we get obviously page not found error. Our goal is to get latest published content soon page is published and update search indexes. My thought of keeping our custom logic in Tridion modules is, so that I can get hold of current Page object which is being published and also use few page metadata info.
Just to be clear we are using DD4T on CD for our presentation site. So complete latest htmlmarkup of the page is available only after contents are committed to broker and after once we make a request to page. We are currently disabling DD4T cache on site.
Can anyone please suggest me in Tridion when exactly can I capture that the page is successfully published i.e. transaction is committed/CD server sends a success message back to CM server, so that I can invoke my custom code for querying delivery site for latest content? Any suggestions/help is highly appreciated.