コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the KafkaConnection class.
        /// </summary>
        /// <param name="log">Logging interface used to record any log messages created by the connection.</param>
        /// <param name="client">The kafka socket initialized to the kafka server.</param>
        /// <param name="responseTimeoutMs">The amount of time to wait for a message response to be received after sending message to Kafka.  Defaults to 30s.</param>
        public KafkaConnection(IKafkaTcpSocket client, TimeSpan?responseTimeoutMs = null, IKafkaLog log = null)
        {
            _client            = client;
            _log               = log ?? new DefaultTraceLog();
            _responseTimeoutMs = responseTimeoutMs ?? TimeSpan.FromMilliseconds(DefaultResponseTimeoutMs);

            StartReadStreamPoller();
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the KafkaConnection class.
        /// </summary>
        /// <param name="log">Logging interface used to record any log messages created by the connection.</param>
        /// <param name="client">The kafka socket initialized to the kafka server.</param>
        /// <param name="responseTimeoutMs">The amount of time to wait for a message response to be received after sending message to Kafka.  Defaults to 30s.</param>
        public KafkaConnection(IKafkaTcpSocket client, TimeSpan?responseTimeoutMs = null, IKafkaLog log = null)
        {
            _client               = client;
            _log                  = log ?? new DefaultTraceLog();
            _responseTimeoutMS    = responseTimeoutMs ?? TimeSpan.FromMilliseconds(DefaultResponseTimeoutMs);
            _responseTimeoutTimer = new ScheduledTimer()
                                    .Do(ResponseTimeoutCheck)
                                    .Every(TimeSpan.FromMilliseconds(100))
                                    .StartingAt(DateTime.Now.Add(_responseTimeoutMS))
                                    .Begin();

            StartReadStreamPoller();
        }