コード例 #1
0
        private void PerformActionsOnClientResponse(string apiMessage)
        {
            logger.LogInfo(apiMessage);
            var message = CreateMessage(apiMessage);

            producer.ProduceMessage(message);
        }
コード例 #2
0
        /// <summary>
        /// Publishes summary message (aggregated info about topic) every interval
        /// </summary>
        public void StartPublishingAggregatedEvents()
        {
            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Thread.Sleep(_publishingIntervalInMiliseconds);
                    if (_stopPublishing)
                    {
                        _messageProducer = null;
                        return;
                    }

                    var producerMessage = GetSummaryMessage();
                    _messageProducer.ProduceMessage(producerMessage);
                }
            });
        }