コード例 #1
0
        public async Task ProcessHttpMessage(HttpMessage message)
        {
            var runscopeMessage = new RunscopeMessage()
            {
                UniqueIdentifier = message.MessageId
            };

            if (message.IsRequest)
            {
                _Logger.LogInfo("Processing HTTP request " + message.MessageId.ToString());
                runscopeMessage.Request = await RunscopeRequest.CreateFromAsync(message.HttpRequestMessage);
            }
            else
            {
                _Logger.LogInfo("Processing HTTP response " + message.MessageId.ToString());
                runscopeMessage.Response = await RunscopeResponse.CreateFromAsync(message.HttpResponseMessage);
            }

            var messagesLink = new MessagesLink() { Method = HttpMethod.Post };
            messagesLink.BucketKey = _BucketKey;
            messagesLink.RunscopeMessage = runscopeMessage;
            var runscopeResponse = await _HttpClient.SendAsync(messagesLink.CreateRequest());
            if (runscopeResponse.IsSuccessStatusCode)
            {
                _Logger.LogDebug("Message forwarded to Runscope");
            } else
            {
                _Logger.LogDebug("Failed to send request");
            }
        }
コード例 #2
0
        public void CreateEmptyRunscopeMessage()
        {
            var message = new RunscopeMessage();

            Assert.NotNull(message);
        }