Пример #1
0
        private static Transmission CreateTransmission(IChannelTelemetry telemetry)
        {
            byte[]       data         = JsonSerializer.Serialize(new[] { telemetry });
            Transmission transmission = new Transmission(
                new Uri(@"http://some.url"),
                data,
                "application/x-json-stream",
                JsonSerializer.CompressionType);

            return(transmission);
        }
Пример #2
0
        /// <summary>
        ///     Persist the in-memory telemetry items.
        /// </summary>
        internal void Flush(IChannelTelemetry telemetryItem)
        {
            if (telemetryItem != null)
            {
                byte[]       data         = JsonSerializer.Serialize(new[] { telemetryItem });
                Transmission transmission = new Transmission(
                    EndpointAddress,
                    data,
                    "application/x-json-stream",
                    JsonSerializer.CompressionType);

                _storage.EnqueueAsync(transmission).ConfigureAwait(false).GetAwaiter().GetResult();
            }
        }