Advertisement
Guest User

Functions.cs

a guest
May 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using AT.Domain.Repositories;
  8. using Microsoft.Azure.WebJobs;
  9.  
  10. namespace AT.WebJobs
  11. {
  12.     public class Functions
  13.     {
  14.         private readonly ICustomerRepository _customerRepository;
  15.  
  16.         public Functions(ICustomerRepository customerRepository)
  17.         {
  18.             _customerRepository = customerRepository;
  19.         }
  20.  
  21.         // This function will get triggered/executed when a new message is written
  22.         // on an Azure Queue called queue.
  23.         public void TimerJob([TimerTrigger("0 * * * * *", RunOnStartup = true)] TimerInfo timerInfo, TextWriter log)
  24.         {
  25.             log.WriteLine("Triggered at " + DateTime.Now);
  26.          
  27.             var customer = _customerRepository.FindByUser("99d0786a-ece0-4304-b836-9d1c0fd88629");
  28.  
  29.             log.WriteLine($"Customer {customer.FirstName} {customer.LastName}");
  30.            
  31.             log.WriteLine("Finished at " + DateTime.Now);
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement