private async Task HandleQueueMessage(HttpResponseHeaderCollection headers, IHttpContent content) { string brokerPropertiesSource; if (!headers.TryGetValue("BrokerProperties", out brokerPropertiesSource)) { Log.Warning("Received Azure queue message without broker properties."); return; } string bodySource = await content.ReadAsStringAsync(); if (string.IsNullOrEmpty(bodySource)) { Log.Warning("Received Azure queue message with empty body."); return; } JsonObject brokerProperties; if (!JsonObject.TryParse(brokerPropertiesSource, out brokerProperties)) { Log.Warning("Received Azure queue message with invalid broker properties."); return; } JsonObject body; if (!JsonObject.TryParse(bodySource, out body)) { Log.Warning("Received Azure queue message with not supported body (JSON expected)."); return; } Log.Verbose("Received valid Azure queue message."); MessageReceived?.Invoke(this, new MessageReceivedEventArgs(brokerProperties, body)); }
private async Task HandleQueueMessage(HttpResponseHeaderCollection headers, IHttpContent content) { string brokerPropertiesSource; if (!headers.TryGetValue("BrokerProperties", out brokerPropertiesSource)) { _log.Warning("Received Azure queue message without broker properties."); return; } var bodySource = await content.ReadAsStringAsync(); if (string.IsNullOrEmpty(bodySource)) { _log.Warning("Received Azure queue message with empty body."); return; } var brokerProperties = JObject.Parse(brokerPropertiesSource); var body = JObject.Parse(bodySource); _log.Verbose("Received valid Azure queue message."); MessageReceived?.Invoke(this, new MessageReceivedEventArgs(brokerProperties, body)); }
/// <summary> /// Check HTTP response headers for tile availability, e.g. X-VE-Tile-Info=no-tile /// </summary> public static bool IsTileAvailable(HttpResponseHeaderCollection responseHeaders) { string tileInfo; return(!responseHeaders.TryGetValue("X-VE-Tile-Info", out tileInfo) || tileInfo != "no-tile"); }
private async Task HandleQueueMessage(HttpResponseHeaderCollection headers, IHttpContent content) { string brokerPropertiesSource; if (!headers.TryGetValue("BrokerProperties", out brokerPropertiesSource)) { Log.Warning("Received Azure queue message without broker properties."); return; } var bodySource = await content.ReadAsStringAsync(); if (string.IsNullOrEmpty(bodySource)) { Log.Warning("Received Azure queue message with empty body."); return; } var brokerProperties = JObject.Parse(brokerPropertiesSource); var body = JObject.Parse(bodySource); Log.Verbose("Received valid Azure queue message."); MessageReceived?.Invoke(this, new MessageReceivedEventArgs(brokerProperties, body)); }
private static bool ImageAvailable(HttpResponseHeaderCollection responseHeaders) { return(!responseHeaders.TryGetValue("X-VE-Tile-Info", out string tileInfo) || tileInfo != "no-tile"); }