public async Task RetryCashoutAsync(IHotWalletOperation hotWalletCashout) { HotWalletCashoutMessage message = new HotWalletCashoutMessage() { OperationId = hotWalletCashout.OperationId }; await _hotWalletCashoutRepository.SaveAsync(hotWalletCashout); await _hotWalletCashoutQueue.PutRawMessageAsync(Newtonsoft.Json.JsonConvert.SerializeObject(message)); }
public async Task Execute(HotWalletCashoutMessage cashoutMessage, QueueTriggeringContext context) { if (cashoutMessage == null || string.IsNullOrEmpty(cashoutMessage.OperationId)) { await _log.WriteWarningAsync(nameof(HotWalletCashoutJob), "Execute", "", "message is empty"); return; } try { await _hotWalletService.StartCashoutAsync(cashoutMessage.OperationId); } catch (Exception exc) { await _log.WriteErrorAsync(nameof(HotWalletCashoutJob), "Execute", $"{cashoutMessage.OperationId}", exc); cashoutMessage.LastError = exc.Message; cashoutMessage.DequeueCount++; context.MoveMessageToEnd(cashoutMessage.ToJson()); context.SetCountQueueBasedDelay(_settings.MaxQueueDelay, 200); } }