public async Task <HttpMonitorCheck> ExecuteAsync(HttpMonitorId httpMonitorId)
        {
            var httpMonitor = await _repository.GetByIdAsync(httpMonitorId);

            if (httpMonitor == null)
            {
                throw new EntityNotFoundException(httpMonitorId);
            }

            var cmd = httpMonitor.CreateCheckHttpEndpoint(HttpMonitorCheckId.Create());

            return(await _executor.CheckHttpEndpointAsync(cmd));
        }
Exemple #2
0
        public static async Task HandleCheckHttpEndpointAsync(
            [QueueTrigger("commands")] string json,
            TraceWriter log,
            [Inject] IHttpMonitorExecutor executor,
            [Inject] IHttpMonitorCheckRepository repository,
            [Inject] IHttpMonitorCheckedPublisher publisher)
        {
            var check = JsonConvert.DeserializeObject <CheckHttpEndpoint>(json, Constants.JsonSerializerSettings);

            var httpMonitorCheck = await executor.CheckHttpEndpointAsync(check);

            await repository.CreateAsync(httpMonitorCheck);

            var @event = httpMonitorCheck.CreateHttpMonitorChecked();

            await publisher.PublishAsync(@event);
        }