C# Class NATS.Client.Connection

Represents the connection to the server.
Inheritance: IConnection, IDisposable
Show file Open project: nats-io/csnats Class Usage Examples

Public Methods

Method Description
Close ( ) : void
Flush ( ) : void

Flush will perform a round trip to the server and return when it receives the internal reply.

Flush ( int timeout ) : void
IsClosed ( ) : bool
IsReconnecting ( ) : bool
NewInbox ( ) : string
Publish ( Msg msg ) : void
Publish ( string subject, byte data ) : void
Publish ( string subject, string reply, byte data ) : void
Request ( string subject, byte data ) : Msg
Request ( string subject, byte data, int timeout ) : Msg
RequestAsync ( string subject, byte data ) : Task
RequestAsync ( string subject, byte data, CancellationToken token ) : Task
RequestAsync ( string subject, byte data, int timeout ) : Task
RequestAsync ( string subject, byte data, int timeout, CancellationToken token ) : Task
ResetStats ( ) : void
SubscribeAsync ( string subject ) : IAsyncSubscription
SubscribeAsync ( string subject, EventHandler handler ) : IAsyncSubscription
SubscribeAsync ( string subject, string queue ) : IAsyncSubscription
SubscribeAsync ( string subject, string queue, EventHandler handler ) : IAsyncSubscription
SubscribeSync ( string subject ) : ISyncSubscription
SubscribeSync ( string subject, string queue ) : ISyncSubscription
ToString ( ) : string

Returns a string representation of the value of this Connection instance.

Private Methods

Method Description
Connection ( ) : System
Connection ( Options options ) : System
IDisposable ( ) : void
addSubscription ( Subscription s ) : void
buildPublishProtocolBuffer ( int size ) : void
checkForSecure ( ) : void
clearPendingFlushCalls ( ) : void
close ( ConnState closeState, bool invokeDelegates ) : void
connect ( Srv s, Exception &exToThrow ) : bool
connect ( ) : void
connectProto ( ) : string
convertToString ( byte buffer, long length ) : string
createConn ( Srv s ) : bool
createPongs ( ) : Queue>
deliverMsgs ( Channel ch ) : void
disableSubChannelPooling ( ) : void
doReconnect ( ) : void
enableSubChannelPooling ( ) : void
flushReconnectPendingItems ( ) : void
flusher ( ) : void
generateThreadName ( string prefix ) : string
getMessageChannel ( ) : Channel

Gets an available message channel for use with async subscribers. It will setup the message channel pool if configured to do so.

getNormalizedError ( MemoryStream errorStream ) : string
isClosed ( ) : bool
isConnected ( ) : bool
isConnecting ( ) : bool
isFlusherDone ( ) : bool
isReconnecting ( ) : bool
kickFlusher ( ) : void
makeTLSConn ( ) : void
pickServer ( ) : void
pingTimerCallback ( object state ) : void
processAsyncInfo ( byte jsonBytes, int length ) : void
processConnectInit ( ) : void
processDisconnect ( ) : void
processErr ( MemoryStream errorStream ) : void
processExpectedInfo ( ) : void
processInfo ( string json ) : void
processMsg ( byte msg, long length ) : void
processMsgArgs ( byte buffer, long length ) : void
processOK ( ) : void
processOpError ( Exception e ) : void
processPing ( ) : void
processPong ( ) : void
processReconnect ( ) : void
processSlowConsumer ( Subscription s ) : void
publish ( string subject, string reply, byte data ) : void
readLoop ( ) : void
readOp ( ) : Control
removeFlushEntry ( Channel chan ) : bool
removeSub ( Subscription s ) : void
request ( string subject, byte data, int timeout ) : Msg
requestAsync ( string subject, byte data, int timeout ) : Task
requestAsync ( string subject, byte data, int timeout, CancellationToken ct ) : Task
resendSubscriptions ( ) : void
saveFlushException ( Channel ch, Exception e ) : void
scheduleConnEvent ( EventHandler connEvent ) : void
sendConnect ( ) : void
sendPing ( Channel ch ) : void
sendProto ( byte value, int length ) : void
sendSubscriptionMessage ( AsyncSubscription s ) : void
setFlusherDone ( bool value ) : void
setupServerPool ( ) : void
sleep ( int millis ) : void
spinUpSocketWatchers ( ) : void
startPingTimer ( ) : void
stopPingTimer ( ) : void
subscribeAsync ( string subject, string queue, EventHandler handler ) : AsyncSubscription
subscribeSync ( string subject, string queue ) : SyncSubscription
unsubscribe ( Subscription sub, int max ) : void
waitForExits ( ) : void
waitForFlusherKick ( ) : bool
writePublishProto ( byte dst, string subject, string reply, int msgSize ) : int
writeString ( string value ) : void
writeString ( string format, object a, object b ) : void
writeString ( string format, object a, object b, object c ) : void
writeStringToBuffer ( byte buffer, int offset, string value ) : int

Method Details

Close() public method

public Close ( ) : void
return void

Flush() public method

Flush will perform a round trip to the server and return when it receives the internal reply.
public Flush ( ) : void
return void

Flush() public method

public Flush ( int timeout ) : void
timeout int
return void

IsClosed() public method

public IsClosed ( ) : bool
return bool

IsReconnecting() public method

public IsReconnecting ( ) : bool
return bool

NewInbox() public method

public NewInbox ( ) : string
return string

Publish() public method

public Publish ( Msg msg ) : void
msg Msg
return void

Publish() public method

public Publish ( string subject, byte data ) : void
subject string
data byte
return void

Publish() public method

public Publish ( string subject, string reply, byte data ) : void
subject string
reply string
data byte
return void

Request() public method

public Request ( string subject, byte data ) : Msg
subject string
data byte
return Msg

Request() public method

public Request ( string subject, byte data, int timeout ) : Msg
subject string
data byte
timeout int
return Msg

RequestAsync() public method

public RequestAsync ( string subject, byte data ) : Task
subject string
data byte
return Task

RequestAsync() public method

public RequestAsync ( string subject, byte data, CancellationToken token ) : Task
subject string
data byte
token System.Threading.CancellationToken
return Task

RequestAsync() public method

public RequestAsync ( string subject, byte data, int timeout ) : Task
subject string
data byte
timeout int
return Task

RequestAsync() public method

public RequestAsync ( string subject, byte data, int timeout, CancellationToken token ) : Task
subject string
data byte
timeout int
token System.Threading.CancellationToken
return Task

ResetStats() public method

public ResetStats ( ) : void
return void

SubscribeAsync() public method

public SubscribeAsync ( string subject ) : IAsyncSubscription
subject string
return IAsyncSubscription

SubscribeAsync() public method

public SubscribeAsync ( string subject, EventHandler handler ) : IAsyncSubscription
subject string
handler EventHandler
return IAsyncSubscription

SubscribeAsync() public method

public SubscribeAsync ( string subject, string queue ) : IAsyncSubscription
subject string
queue string
return IAsyncSubscription

SubscribeAsync() public method

public SubscribeAsync ( string subject, string queue, EventHandler handler ) : IAsyncSubscription
subject string
queue string
handler EventHandler
return IAsyncSubscription

SubscribeSync() public method

public SubscribeSync ( string subject ) : ISyncSubscription
subject string
return ISyncSubscription

SubscribeSync() public method

public SubscribeSync ( string subject, string queue ) : ISyncSubscription
subject string
queue string
return ISyncSubscription

ToString() public method

Returns a string representation of the value of this Connection instance.
public ToString ( ) : string
return string