Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [FunctionName("FunctionOffice365VerificateDomain_and_AddService_and_GexMxRecord")]
- public async static Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
- [Queue("domain-verificate-Office365-add-services-get-mx-record", Connection = "StorageConnectionString")]CloudQueue listenQueue,
- [Queue("domain-add-mx-record-to-registrator", Connection = "StorageConnectionString")]CloudQueue outputQueue,
- ILogger log)
- {
- while (true)
- {
- // do "invisible" message for next 30 sec
- var message = await listenQueue.GetMessageAsync();
- if (message != null)
- {
- DomainForRegistration domainForRegistration = JsonConvert.DeserializeObject<DomainForRegistration>(message.AsString);
- try
- {
- await _office365DomainService.VerifyDomainAsync(domainForRegistration.DomainName);
- // remove message
- await listenQueue.DeleteMessageAsync(message);
- await _office365DomainService.UpdateIndicateSupportedServicesDomainAsync(domainForRegistration.DomainName);
- var mxRecord = await _office365DomainService.GetMxRecordForDomainAsync(domainForRegistration.DomainName);
- }
- catch (DomainVerificationRecordNotFoundException)
- {
- // thrown when VerifyDomainAsync failed
- }
- }
- else
- break;
- }
- }
Add Comment
Please, Sign In to add comment