コード例 #1
0
        public async Task <string> GetBaseFolder()
        {
            try
            {
                var client   = new Communicator.CommunicatorClient(_channel);
                var response = await client.GetBaseFolderAsync(new BaseFolderRequest());

                return(response?.Path);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to retrieve BaseFolderPath");
                return(null);
            }
        }
コード例 #2
0
 public async Task PostRecipientsAdded(RecipientsAddedToFolderNotification recipientsAddedToFolderNotification)
 {
     try
     {
         var client = new Communicator.CommunicatorClient(_channel);
         await client.RecipientAddedToFolderAsync(new RecipientAddedRequest
         {
             FolderId   = recipientsAddedToFolderNotification.FolderId.ToString(),
             Recipients = { recipientsAddedToFolderNotification.Recipients.Select(x => x.ToString()) }
         });
     }
     catch (Exception ex)
     {
         Log.Error(ex, "Failed to notify worker");
     }
 }
コード例 #3
0
        public async Task <(string hostname, string exception)> ProbeRecipient(string address)
        {
            using var channel = GrpcChannel.ForAddress(address);
            try
            {
                var client = new Communicator.CommunicatorClient(channel);
                var result = await client.ProbeRecipientAsync(new ProbeRequest());

                return(result.MachineName, null);
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Failed to probe {address}");
                return(null, ex.Message);
            }
        }
コード例 #4
0
 public async Task PostFolderWebhookChanged(FolderWebhookChangedNotification folderWebhookChangeNotification)
 {
     try
     {
         var client = new Communicator.CommunicatorClient(_channel);
         await client.FolderWebhookChangedAsync(new FolderWebhookRequest
         {
             FolderId    = folderWebhookChangeNotification.FolderId.ToString(),
             WebHookType = folderWebhookChangeNotification.WebhookType,
             CallBackUrl = folderWebhookChangeNotification.CallbackUrl
         });
     }
     catch (Exception ex)
     {
         Log.Error(ex, "Failed to notify worker");
     }
 }