Ejemplo n.º 1
0
 /// <summary>
 /// Configuration for the tcp connection.
 /// </summary>
 /// <param name="tracker">Mechanism for tracking telemetry.</param>
 /// <param name="connectionRetry">Retry details for (re)establishing the connection.</param>
 /// <param name="versionSupport">Support for different protocol versions for Kakfa requests and responses.</param>
 /// <param name="requestTimeout">The maximum time to wait for requests.</param>
 /// <param name="encoders">Custom Encoding support for different protocol types</param>
 public ConnectionConfiguration(ITrackEvents tracker, IRetry connectionRetry = null, IVersionSupport versionSupport = null, TimeSpan?requestTimeout = null, IEnumerable <IProtocolTypeEncoder> encoders = null)
     : this(connectionRetry, versionSupport, requestTimeout, encoders, null,
            tracker != null ? (ConnectError)tracker.Disconnected : null,
            tracker != null ? (Connecting)tracker.Connecting : null,
            tracker != null ? (Connecting)tracker.Connected : null,
            tracker != null ? (Writing)tracker.WriteEnqueued : null,
            tracker != null ? (Writing)tracker.Writing : null,
            tracker != null ? (WriteSuccess)tracker.Written : null,
            tracker != null ? (WriteError)tracker.WriteFailed : null,
            tracker != null ? (Reading)tracker.Reading : null,
            tracker != null ? (ReadingChunk)tracker.ReadingChunk : null,
            tracker != null ? (ReadChunk)tracker.ReadChunk : null,
            tracker != null ? (Read)tracker.Read : null,
            tracker != null ? (ReadError)tracker.ReadFailed: null,
            tracker != null ? (ProduceRequestMessages)tracker.ProduceRequestMessages : null)
 {
 }
Ejemplo n.º 2
0
        public static IConnectionConfiguration ToConfiguration(this ITrackEvents tracker)
        {
            if (tracker == null)
            {
                return(ConnectionConfiguration.Default);
            }

            return(new ConnectionConfiguration(
                       onDisconnected: tracker.Disconnected,
                       onConnecting: tracker.Connecting,
                       onConnected: tracker.Connected,
                       onWriting: tracker.Writing,
                       onWritingBytes: tracker.WritingBytes,
                       onWroteBytes: tracker.WroteBytes,
                       onWritten: tracker.Written,
                       onWriteFailed: tracker.WriteFailed,
                       onReading: tracker.Reading,
                       onReadingBytes: tracker.ReadingBytes,
                       onReadBytes: tracker.ReadBytes,
                       onRead: tracker.Read,
                       onReadFailed: tracker.ReadFailed,
                       onProduceRequestMessages: tracker.ProduceRequestMessages));
        }