public async Task <IMessage <T> > ReceiveAsAsync()
        {
            var nextFile = GetAvailableMessages(_topicName).FirstOrDefault();

            if (nextFile == null)
            {
                await Task.Delay(5000);

                return(null);
            }

            return(await FileSystemMessage <T> .Lock(nextFile));
        }
        public async Task <IEnumerable <IMessage <T> > > ReceiveBatchAsAsync(int batchSize)
        {
            var availableMessageFiles = GetAvailableMessages(_topicName).Take(batchSize).ToArray();

            if (!availableMessageFiles.Any())
            {
                return(new IMessage <T> [0]);
            }

            var messages = new IMessage <T> [availableMessageFiles.Length];

            for (var i = 0; i < messages.Length; i++)
            {
                messages[i] = await FileSystemMessage <T> .Lock(availableMessageFiles[i]);
            }
            return(messages);
        }