We do this sort of thing all of the time.
First, use the built in counter commands to maintain the counter.
Then for the one to many, just make sure you do not dispose of the IB message until all messages are built. Maintain the new messages in a global buffer and when all are built, forward them on and, at that time, dispose of the original.
This way, if the thread stops before you finish, upon startup, it will be delivered to the same proc again and start all over.
I hope this makes sense