Beispiel #1
0
        /// <summary>
        /// process response
        /// </summary>
        private async Task UploadResponseFilesToBlobStoreAsync(string [] fileNames)
        {
            foreach (string fileName in fileNames)
            {
                MemoryStream stream = new MemoryStream();
                await SftpResponseFileClient.DownloadFileAsync(fileName, stream, "outbox").ConfigureAwait(false);

                stream.Position = 0;
                await ResponseFileBlobClient.UploadAsync(stream, fileName).ConfigureAwait(false);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Handle the submission of response file
 /// </summary>
 /// <param name="submissionSuccessful">
 /// Submission status
 /// </param>
 /// <param name="fileName">
 /// Name of the file
 /// </param>
 internal async Task HandleResponse(bool submissionSuccessful, string fileName)
 {
     if (submissionSuccessful)
     {
         await ResponseFileBlobClient.MarkAsProcessedAsync(fileName).ConfigureAwait(false);
     }
     else
     {
         // decrease sequence number to we can submit same number again
         DecrementSequence();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Process the response file
        /// </summary>
        /// <returns>
        /// Task wrapper
        /// </returns>
        private async Task ProcessResponseFilesAsync()
        {
            // Now try to run all the pending files in the blob
            ICollection <string> listOfFiles = ResponseFileBlobClient.RetrieveFilesToProcess();

            if (listOfFiles != null)
            {
                foreach (string fileName in listOfFiles)
                {
                    MemoryStream memStream = new MemoryStream();
                    memStream.Position = 0;
                    await ResponseFileBlobClient.DownloadAsync(memStream, fileName);

                    memStream.Position = 0;
                    RegistrationResponseFileProcessor processor = ResponseFileProcessor(fileName, memStream);
                    bool fileSubmissionSuccess = await processor.ProcessAsync().ConfigureAwait(false);
                    await HandleResponse(fileSubmissionSuccess, fileName).ConfigureAwait(false);
                }
            }
        }