public void ChekDomain() { var model = GetAll(); foreach (var item in model) { Uri url = new Uri(item.Url); string pingurl = string.Format("{0}", url.Host); string host = pingurl; Ping p = new Ping(); try { PingReply reply = p.Send(host, timeOut); if (reply.Status == IPStatus.Success) { string message = "host" + item.ServerName + " is available"; Console.WriteLine(message); //await _homeController.SendMessage(host, item.ServerName, "host is available"); _send.Send(host, item.ServerName, "host is available"); } else { Console.WriteLine("host is not available"); } } catch { } } }
private void timerTick(object state) { try { var message = _currentSendingMessage; // Get next message to send if (message == null) { _messages.TryDequeue(out message); // Store so we don't have to peek the queue and conditionally dequeue _currentSendingMessage = message; } if (message == null) { return; // Nothing to send } // Send Message _messageSender.Send(message); } finally { // Only start the timer again if we're done ticking. try { _sendTimer.Change(SendInterval, Timeout.Infinite); } catch (ObjectDisposedException) { } } }
public async Task Post([FromBody] object value) { if (string.IsNullOrEmpty(value.ToString())) { return; } await sender.Send(value.ToString()); }
public ActionResult Create(Account account) { account.Date = new Clock().Now(); account.Balance = _accountTransactions.GetAccountBalance(-account.Amount); if (ModelState.IsValid) { var transaction = account.ToStatementFormat(); _accountTransactions.SaveTransaction(transaction); _sendMessage.Send(account); return(RedirectToAction("Index", "AccountBalance")); } return(View(account)); }
public async Task Post([FromBody] ThirdPartyRate value) { var saveTask = command.SaveAsync(value); await sender.Send(value); }
public void Deposit(decimal amount) { Balance += amount; _logger.Log($"You deposit { amount } to account: { AccountNumber }. Now balance is { Balance }."); _sendMessage.Send(AccountHolder, $"You deposit { amount } to account: { AccountNumber }. Now balance is { Balance }."); }