Added extensive debug logging.
Updated the Integration test to include record numbers in order to determine which records went missing.
Added an outgoing message "unit of work" which causes outgoing messages to be sent only after all other work is completed.