Guest User

Untitled

a guest
Jan 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. [FunctionName("FunctionOffice365VerificateDomain_and_AddService_and_GexMxRecord")]
  2. public async static Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
  3. [Queue("domain-verificate-Office365-add-services-get-mx-record", Connection = "StorageConnectionString")]CloudQueue listenQueue,
  4. [Queue("domain-add-mx-record-to-registrator", Connection = "StorageConnectionString")]CloudQueue outputQueue,
  5. ILogger log)
  6. {
  7. while (true)
  8. {
  9. // do "invisible" message for next 30 sec
  10. var message = await listenQueue.GetMessageAsync();
  11. if (message != null)
  12. {
  13. DomainForRegistration domainForRegistration = JsonConvert.DeserializeObject<DomainForRegistration>(message.AsString);
  14. try
  15. {
  16. await _office365DomainService.VerifyDomainAsync(domainForRegistration.DomainName);
  17. // remove message
  18. await listenQueue.DeleteMessageAsync(message);
  19.  
  20. await _office365DomainService.UpdateIndicateSupportedServicesDomainAsync(domainForRegistration.DomainName);
  21.  
  22. var mxRecord = await _office365DomainService.GetMxRecordForDomainAsync(domainForRegistration.DomainName);
  23. }
  24. catch (DomainVerificationRecordNotFoundException)
  25. {
  26. // thrown when VerifyDomainAsync failed
  27. }
  28. }
  29. else
  30. break;
  31. }
  32. }
Add Comment
Please, Sign In to add comment