public async Task <ActionResult> StartFlushingQueues([FromBody] UserQueues userQueues) { try { await Task.Factory.StartNew(() => Observable.Interval(TimeSpan.FromMinutes(_queueFlushingIntervalInMinutes)) .Subscribe(async x => await _snsService.SendNotificationToFlushAsync(userQueues))); return(Ok(JsonConvert.SerializeObject($"Started flushing queues successfully: {String.Join(",", userQueues.Queues)}"))); } catch (AmazonSimpleNotificationServiceException ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public async Task SendNotificationToFlushAsync(UserQueues queues) { try { await _snsClient.PublishAsync(new PublishRequest { Message = JsonConvert.SerializeObject(queues), TopicArn = _notificationTopicArn }); } catch (AmazonSimpleNotificationServiceException) { throw; } }