Make handling of message ids for ingest module ingest messages thread-safe