C# 클래스 KafkaNet.KafkaTcpSocket

The TcpSocket provides an abstraction from the main driver from having to handle connection to and reconnections with a server. The interface is intentionally limited to only read/write. All connection and reconnect details are handled internally.
상속: IKafkaTcpSocket
파일 보기 프로젝트 열기: gigya/KafkaNetClient 1 사용 예제들

공개 메소드들

메소드 설명
Dispose ( ) : void
KafkaTcpSocket ( IKafkaLog log, KafkaNet.Model.KafkaEndpoint endpoint, int maxRetry, System.TimeSpan maximumReconnectionTimeout = null, KafkaNet.Model.StatisticsTrackerOptions statisticsTrackerOptions = null ) : KafkaNet.Common

Construct socket and open connection to a specified server.

ReadAsync ( int readSize ) : Task

Read a certain byte array size return only when all bytes received.

ReadAsync ( int readSize, CancellationToken cancellationToken ) : Task

Read a certain byte array size return only when all bytes received.

WriteAsync ( KafkaDataPayload payload ) : Task

Convenience function to write full buffer data to the server.

WriteAsync ( KafkaDataPayload payload, CancellationToken cancellationToken ) : Task

Write the buffer data to the server.

비공개 메소드들

메소드 설명
DedicatedSocketTask ( ) : Task

Stop all pendding task when can not establish connection in max retry, but keep trying to recove and connect to this connection. Only the broker router can dispose of it.

EnqueueReadTask ( int readSize, CancellationToken cancellationToken ) : Task
EnqueueWriteTask ( KafkaDataPayload payload, CancellationToken cancellationToken ) : Task
GetStreamAsync ( ) : Task
ProcessNetworkstreamTasks ( NetworkStream netStream ) : Task
ProcessNetworkstreamTasksReadTask ( NetworkStream netStream ) : Task
ProcessNetworkstreamsSendTask ( NetworkStream netStream ) : Task
ProcessReadTaskAsync ( NetworkStream netStream, SocketPayloadReadTask readTask ) : Task
ProcessSentTasksAsync ( NetworkStream netStream, SocketPayloadSendTask sendTask ) : Task
RaiseServerDisconnectedEvent ( ) : void
ReEstablishConnectionAsync ( ) : Task

(Re-)establish the Kafka server connection. Assumes that the caller has already obtained the _clientLock

SetExceptionToAllPendingTasks ( Exception ex ) : void
ThrowTaskExceptionIfFaulted ( Task task ) : Task
UseStatisticsTracker ( ) : bool
WrappedException ( Exception ex ) : Exception

메소드 상세

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

KafkaTcpSocket() 공개 메소드

Construct socket and open connection to a specified server.
public KafkaTcpSocket ( IKafkaLog log, KafkaNet.Model.KafkaEndpoint endpoint, int maxRetry, System.TimeSpan maximumReconnectionTimeout = null, KafkaNet.Model.StatisticsTrackerOptions statisticsTrackerOptions = null ) : KafkaNet.Common
log IKafkaLog Logging facility for verbose messaging of actions.
endpoint KafkaNet.Model.KafkaEndpoint The IP endpoint to connect to.
maxRetry int
maximumReconnectionTimeout System.TimeSpan The maximum time to wait when backing off on reconnection attempts.
statisticsTrackerOptions KafkaNet.Model.StatisticsTrackerOptions
리턴 KafkaNet.Common

ReadAsync() 공개 메소드

Read a certain byte array size return only when all bytes received.
public ReadAsync ( int readSize ) : Task
readSize int The size in bytes to receive from server.
리턴 Task

ReadAsync() 공개 메소드

Read a certain byte array size return only when all bytes received.
public ReadAsync ( int readSize, CancellationToken cancellationToken ) : Task
readSize int The size in bytes to receive from server.
cancellationToken System.Threading.CancellationToken A cancellation token which will cancel the request.
리턴 Task

WriteAsync() 공개 메소드

Convenience function to write full buffer data to the server.
public WriteAsync ( KafkaDataPayload payload ) : Task
payload KafkaDataPayload The buffer data to send.
리턴 Task

WriteAsync() 공개 메소드

Write the buffer data to the server.
public WriteAsync ( KafkaDataPayload payload, CancellationToken cancellationToken ) : Task
payload KafkaDataPayload The buffer data to send.
cancellationToken System.Threading.CancellationToken A cancellation token which will cancel the request.
리턴 Task