In the replication agent settings, the Transport tab has the URI property -- set this to the URI of your servlet. There is an example in the docs of doing so for a flush agent: http://dev.day.com/docs/en/cq/current/deploying/dispatcher/page_invalidate.html#Manually Invalidating the Dispatcher Cache
your approach isn't that easy, if you have more than 1 publish (usually you have at least 2 of them), because then you need to calculate a global state of the replication. That's hard.
I don't have a solution for this, but I can outline a possible solution for this:
* Monitor all replication events on authoring
* Whenever you receive a "I have finished the replication" event for a specific replication agent, check with the ReplicationStatus interface, if that page is already replicated.
* When this returns "Page fully replicated" you can be sure, that all publishs have received the replication.
Maybe I will try to implement this in the next weeks for demo purposes.
Thank you very much Jorg and Scott.
Jorg: how do I write code or configuration to automatically monitor replication events? The only thing I see for this is the cq console's replication agent webpage (i.e. manual, non-automated visual inspection of this webpage). If the solution is automated I'll be very interested to see your demo.