just monitor the dynamic_global_properties (object 1.2.0) for last_irreversible_block_num and then verify that any operations you process have a block number that is less than that. If you do that you should be good.
Just beware that if you shutdown the last irreversible block number may move back a few places, so don't use last irreversible block number as the placeholder for the blocks you have already processed.