I have the following scenario/dilemma:
Currently I have two custom modules(for deploy and undeploy) in the default deployer processors. Their purpose is to add or update some data(publication-, item id, url, published status, etc.) of the page being (un)published to a custom database. This database is later used for creating sitemaps, so the published states of all the pages must be 100% precise. The custom modules are added after the default page (un)deploy modules, so if an error occurs, they wont be executed.
This setup is working fine under normal circumstances, however on the production environment I have two destinations in the live publication target. They need to be exactly the same, so each publishing is done using the "Abort publishing/unpublish on all servers in case of error" option checked. This in theory ensures that my published content is the same, however I can end up with the sitemap databases not being up to date if a rollback occurs after the custom modules have already done their work. The documentation does not state how rollback is applied to(if at all, to) custom modules/processors. Even if the rollback means "do the opposite action", this is not good for me because my custom deploy and undeploy are not symmetric, also what about custom modules which don't have a counterpart...
To address this I thought of adding the custom modules to processors with the 'phase' attribute set to 'post-transaction', but I'm unsure if this is the right approach. The documentation states that the rollback can be triggered "all the way up to and including the pre-transaction phase", so I'm guessing it's the proper point in time to update the sitemap DBs. Can someone verify if this is the right approach, or suggest a different one? Also, I'm unsure on how to test this scenario, that is how to manually cause one destination to fail in order to cause a rollback.