ClientSbeSession
SBE client session — one per connected client.
Inherits: SbeSession
Implements: IMessageListenerSession, ILogReceiver, ILogSource, IDisposable
Constructors
public ClientSbeSession(string version, string language, Stream clientStream, TcpClient client, SbeSession serverSession, string authorizationToken, ISessionTransactionIdStorage transactionIdStorage, bool isDemo, int maxPendingMessages)
clientSbeSession = ClientSbeSession(version, language, clientStream, client, serverSession, authorizationToken, transactionIdStorage, isDemo, maxPendingMessages)
Initializes a new instance of the ClientSbeSession.
Properties
public string AuthorizationToken { get; }
value = clientSbeSession.AuthorizationToken
Authorization token assigned after successful login.
public long BytesReceived { get; set; }
value = clientSbeSession.BytesReceived
clientSbeSession.BytesReceived = value
The number of bytes received.
public long BytesSent { get; set; }
value = clientSbeSession.BytesSent
clientSbeSession.BytesSent = value
The number of bytes sent.
public int ErrorCount { get; set; }
value = clientSbeSession.ErrorCount
clientSbeSession.ErrorCount = value
The number of errors.
public override bool IsConnected { get; }
value = clientSbeSession.IsConnected
Is connected.
public int OutgoingQueueCount { get; }
value = clientSbeSession.OutgoingQueueCount
Current size of the outgoing message queue (-1 if the channel does not expose a count).
public EndPoint RemoteEndPoint { get; }
value = clientSbeSession.RemoteEndPoint
Remote endpoint of the connected client.
public SbeRecordSerializer Serializer { get; }
value = clientSbeSession.Serializer
SBE serializer for this session.
public SbeSession ServerSession { get; }
value = clientSbeSession.ServerSession
Server-side session configuration.
public int TotalErrorCount { get; set; }
value = clientSbeSession.TotalErrorCount
clientSbeSession.TotalErrorCount = value
Total error count.
public ISessionTransactionIdStorage TransactionIdStorage { get; }
value = clientSbeSession.TransactionIdStorage
public DateTime UpdatedTime { get; }
value = clientSbeSession.UpdatedTime
Timestamp of the last received message (heartbeat or data).
public byte[] WriteBuffer { get; }
value = clientSbeSession.WriteBuffer
Per-session write buffer for SBE serialization. Each session needs its own buffer because outgoing messages are processed concurrently in separate Tasks. The buffer grows on demand (see Int32)) so large frames are not dropped.
Methods
protected override void DisposeManaged()
clientSbeSession.DisposeManaged()
Release resources.
public bool EnqueueWork(ServerSubscription subscription, string requestId, Func<ClientSbeSession, string, CancellationToken, ValueTask<bool>> handler)
result = clientSbeSession.EnqueueWork(subscription, requestId, handler)
Enqueue a serialization work item for processing. Returns false if the queue is full (client backpressure).
public void EnsureWriteBuffer(int minSize)
clientSbeSession.EnsureWriteBuffer(minSize)
Ensures the write buffer can hold at least bytes, reallocating (doubling capacity) when the current buffer is too small.
- minSize
- Minimum required buffer size in bytes.
public override void IncreaseBytesSent(int count)
clientSbeSession.IncreaseBytesSent(count)
Increase BytesSent.
- count
- Value.
public override void IncreaseErrorCount()
clientSbeSession.IncreaseErrorCount()
Increase ErrorCount.
public Task Init(SbeServerSettings serverSettings, Action<ClientSbeSession> logout, CancellationToken cancellationToken)
result = clientSbeSession.Init(serverSettings, logout, cancellationToken)
Start the outgoing message processing loop.
public override void ResetErrorCount()
clientSbeSession.ResetErrorCount()
Reset ErrorCount.
public ValueTask WriteFramedMessageAsync(ReadOnlyMemory<byte> payload, CancellationToken cancellationToken)
result = clientSbeSession.WriteFramedMessageAsync(payload, cancellationToken)
Write SBE framed message to the client stream. [4-byte length prefix (uint32 LE)][SBE message payload]