diff --git a/NATS.Client/Properties/AssemblyInfo.cs b/NATS.Client/Properties/AssemblyInfo.cs index 837cb1eb6..e8aeb644d 100755 --- a/NATS.Client/Properties/AssemblyInfo.cs +++ b/NATS.Client/Properties/AssemblyInfo.cs @@ -1,7 +1,6 @@ -// Copyright 2015 Apcera Inc. All rights reserved. +// Copyright 2015-2017 Apcera Inc. All rights reserved. using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -12,7 +11,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Apcera, Inc.")] [assembly: AssemblyProduct("NATS")] -[assembly: AssemblyCopyright("Copyright © Apcera 2016")] +[assembly: AssemblyCopyright("Copyright © Apcera 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -34,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.7.1.0")] -[assembly: AssemblyFileVersion("0.7.1.0")] +[assembly: AssemblyVersion("0.8.0.0")] +[assembly: AssemblyFileVersion("0.8.0.0")] diff --git a/NATS.Client/project.json b/NATS.Client/project.json index e82808ba3..3bca13dd0 100755 --- a/NATS.Client/project.json +++ b/NATS.Client/project.json @@ -1,8 +1,8 @@ { "description": "NATS Client API", - "copyright": "Copyright © Apcera 2016", + "copyright": "Copyright © Apcera 2017", "title": "NATS Client", - "version": "0.7.1-*", + "version": "0.8.0-*", "dependencies": { "NETStandard.Library": "1.6.0", "System.Net.Security": "4.0.0", diff --git a/documentation/DoxyFile.NATS.Client b/documentation/DoxyFile.NATS.Client index 1618eed99..eacaeb7dc 100755 --- a/documentation/DoxyFile.NATS.Client +++ b/documentation/DoxyFile.NATS.Client @@ -38,7 +38,7 @@ PROJECT_NAME = "NATS .NET Client" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.7.0 +PROJECT_NUMBER = 0.8.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/documentation/NATS.Client/html/annotated.html b/documentation/NATS.Client/html/annotated.html index 48f7363d0..bf687a33d 100755 --- a/documentation/NATS.Client/html/annotated.html +++ b/documentation/NATS.Client/html/annotated.html @@ -33,7 +33,7 @@
▼NNATS | |
▼NClient | |
CConnectionFactory | Creates a connection to the NATS server. |
CConnEventArgs | Event arguments for the ConnEventHandler type delegate. |
CEncodedConnection | This class subclasses the Connection class to support serialization. |
CEncodedMessageEventArgs | Event arguments for the EncodedConnection Asynchronous Subscriber delegate. |
CErrEventArgs | Event arguments for the ErrorEventHandler type delegate. |
CIAsyncSubscription | An object of this class is an asynchronous subscription representing interest in a subject. The subject can have wildcards (partial:*, full:>). Messages will be delivered to the associated MessageHandler event delegates. While nothing prevents event handlers from being added or removed while processing messages. If the subscriber was created without providing a handler, no messages will be received until Start() has been called. This allows event handlers to be added before message processing begins. |
CIConnection | Represents the connection to the NATS server. |
CIEncodedConnection | Represents an encoded connection to the NATS server. |
CIStatistics | Tracks various statistics received and sent on this connection. |
CISubscription | Represents interest in a NATS topic. |
CISyncSubscription | A Syncronous Subscripion will express interest in a given subject. The subject can have wildcards (partial:*, full:>). Messages arriving are retrieved via NextMsg() |
CMsg | A NATS message is an object encapsulating a subject, optional reply payload, and subscription information, sent or received by teh client application. |
CMsgHandlerEventArgs | This class is passed into the MsgHandler delegate, providing the message received. |
CNATSBadSubscriptionException | The exception that is thrown when a subscriber operation is performed on an invalid subscriber. |
CNATSConnectionClosedException | The exception that is thrown when a an operation is performed on a connection that is closed. |
CNATSConnectionException | The exception that is thrown when there is a connection error. |
CNATSException | The exception that is thrown when there is a NATS error condition. All NATS exception inherit from this class. |
CNATSMaxMessagesException | The exception that is thrown when a subscriber has exceeded the maximum number of messages that has been configured. |
CNATSMaxPayloadException | The exception that is thrown when a message payload exceeds what the maximum configured. |
CNATSNoServersException | The exception that is thrown when a connection cannot be made to any server. |
CNATSProtocolException | This exception that is thrown when there is an internal error with the NATS protocol. |
CNATSSecureConnRequiredException | The exception that is thrown when a secure connection is required. |
CNATSSecureConnWantedException | The exception that is thrown when a secure connection is requested, but not required. |
CNATSSlowConsumerException | The exception that is thrown when a consumer (subscription) is slow. |
CNATSStaleConnectionException | The exception that is thrown when an operation occurs on a connection that has been determined to be stale. |
CNATSTimeoutException | The exception that is thrown when a NATS operation times out. |
CNUID | NUID needs to be very fast to generate and truly unique, all while being entropy pool friendly. We will use 12 bytes of crypto generated data (entropy draining), and 10 bytes of sequential data that is started at a pseudo random number and increments with a pseudo-random increment. Total is 22 bytes of base 36 ascii text. |
COptions | This class is used to setup all NATs client options. |
CAsyncSubscription | AsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. This class should not be used directly. |
CConnection | Connection represents a bare connection to a NATS server. Users should create an IConnection instance using ConnectionFactory rather than directly using this class. |
CConnectionFactory | Provides factory methods to create connections to NATS Servers. |
CConnEventArgs | Provides the details when the state of a Connection changes. |
CEncodedConnection | Represents an Connection which uses a client specified encoding scheme. |
CEncodedMessageEventArgs | Provides decoded messages received by subscriptions or requests. |
CErrEventArgs | Provides details for an error encountered asynchronously by an IConnection. |
CIAsyncSubscription | IAsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. |
CIConnection | Represents a connection to the NATS server. |
CIEncodedConnection | Represents a connection to a NATS Server which uses a client specified encoding scheme. |
CIStatistics | Tracks various statistics received and sent on an IConnection. |
CISubscription | Represents interest in a NATS topic. |
CISyncSubscription | ISyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int). |
CMsg | A NATS message is an object encapsulating a subject, optional reply payload, and subscription information, sent or received by the client application. |
CMsgHandlerEventArgs | Provides the message received by an IAsyncSubscription. |
CNATSBadSubscriptionException | The exception that is thrown when a subscriber operation is performed on an invalid subscriber. |
CNATSConnectionClosedException | The exception that is thrown when a an operation is performed on a connection that is closed. |
CNATSConnectionException | The exception that is thrown when there is a connection error. |
CNATSException | The exception that is thrown when there is a NATS error condition. All NATS exception inherit from this class. |
CNATSMaxMessagesException | The exception that is thrown when a subscriber has exceeded the maximum number of messages that has been configured. |
CNATSMaxPayloadException | The exception that is thrown when a message payload exceeds what the maximum configured. |
CNATSNoServersException | The exception that is thrown when a connection cannot be made to any server. |
CNATSProtocolException | This exception that is thrown when there is an internal error with the NATS protocol. |
CNATSSecureConnRequiredException | The exception that is thrown when a secure connection is required. |
CNATSSecureConnWantedException | The exception that is thrown when a secure connection is requested, but not required. |
CNATSSlowConsumerException | The exception that is thrown when a consumer (subscription) is slow. |
CNATSStaleConnectionException | The exception that is thrown when an operation occurs on a connection that has been determined to be stale. |
CNATSTimeoutException | The exception that is thrown when a NATS operation times out. |
CNUID | NUID needs to be very fast to generate and truly unique, all while being entropy pool friendly. We will use 12 bytes of crypto generated data (entropy draining), and 10 bytes of sequential data that is started at a pseudo random number and increments with a pseudo-random increment. Total is 22 bytes of base 36 ascii text. |
COptions | This class is used to setup all NATs client options. |
CStatistics | Tracks various statistics received and sent on an IConnection. |
CSubscription | Represents interest in a NATS topic. This class should not be used directly. |
CSyncSubscription | SyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int). This class should not be used directly. |
Properties | |
Connection | Conn [get] |
Connection | Conn [get] |
Event arguments for the ConnEventHandler type delegate.
+Provides the details when the state of a Connection changes.
Connection NATS.Client.ConnEventArgs.Conn | +Connection NATS.Client.ConnEventArgs.Conn |
Gets the connection associated with the event.
+Gets the Connection associated with the event.
Creates a connection to the NATS server.
+Provides factory methods to create connections to NATS Servers.
Creates a connection factory to the NATS server.
+Initializes a new instance of the ConnectionFactory class, providing factory methods to create connections to NATS Servers.
CreateConnection will attempt to connect to the NATS server. The url can contain username/password semantics. Comma seperated arrays are also supported, e.g. urlA, urlB.
+Attempt to connect to the NATS server referenced by url .
+url can contain username/password semantics. Comma seperated arrays are also supported, e.g. "urlA, urlB"
.
url | The url |
url | A string containing the URL (or URLs) to the NATS Server. See the Remarks section for more information. |
NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
Create a connection to the NATs server using default options.
-Create a connection to the NATs server using the default options.
+NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
CreateConnection to the NATs server using the provided options.
+Create a connection to a NATS Server defined by the given options.
opts | NATs client options |
opts | The NATS client options to use for this connection. |
NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
Create an encoded connection to the NATs server using default options.
-Attempt to connect to the NATS server, with an encoded connection, using the default options.
+NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
CreateEncodeedConnection will attempt to connect to the NATS server. The url can contain username/password semantics.
+Attempt to connect to the NATS server, with an encoded connection, referenced by url .
+url can contain username/password semantics. Comma seperated arrays are also supported, e.g. urlA, urlB.
url | The url |
url | A string containing the URL (or URLs) to the NATS Server. See the Remarks section for more information. |
NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
CreateEncodedConnection to the NATs server using the provided options.
+Attempt to connect to the NATS server, with an encoded connection, using the given options.
opts | NATs client options |
opts | The NATS client options to use for this connection. |
NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
CreateSecureConnection will attempt to connect to the NATS server using TLS. The url can contain username/password semantics.
+Attempt to connect to the NATS server using TLS referenced by url .
+url can contain username/password semantics. Comma seperated arrays are also supported, e.g. urlA, urlB.
url | connect url |
url | A string containing the URL (or URLs) to the NATS Server. See the Remarks section for more information. |
NATSNoServersException | No connection to a NATS Server could be established. |
NATSConnectionException | A timeout occurred connecting to a NATS Server.-or-An exception was encountered while connecting to a NATS Server. See System.Exception.InnerException for more details. |
Retrieves the default set ot client options.
+Retrieves the default set of client options.
+This is the complete list of members for NATS.Client.EncodedConnection, including all inherited members.
Public Member Functions | |
void | Publish (string subject, string reply, object o) |
void | Publish (string subject, Object obj) |
void | Publish (string subject, string reply, object obj) |
IAsyncSubscription | SubscribeAsync (string subject, EventHandler< EncodedMessageEventArgs > handler) |
IAsyncSubscription | SubscribeAsync (string subject, string queue, EventHandler< EncodedMessageEventArgs > handler) |
object | Request (string subject, object obj) |
Public Member Functions inherited from NATS.Client.Connection | |
void | Publish (string subject, byte[] data) |
void | Publish (Msg msg) |
void | Publish (string subject, string reply, byte[] data) |
Msg | Request (string subject, byte[] data, int timeout) |
Msg | Request (string subject, byte[] data) |
Task< Msg > | RequestAsync (string subject, byte[] data, int timeout) |
Task< Msg > | RequestAsync (string subject, byte[] data) |
Task< Msg > | RequestAsync (string subject, byte[] data, int timeout, CancellationToken token) |
Task< Msg > | RequestAsync (string subject, byte[] data, CancellationToken token) |
string | NewInbox () |
ISyncSubscription | SubscribeSync (string subject) |
IAsyncSubscription | SubscribeAsync (string subject) |
IAsyncSubscription | SubscribeAsync (string subject, EventHandler< MsgHandlerEventArgs > handler) |
ISyncSubscription | SubscribeSync (string subject, string queue) |
IAsyncSubscription | SubscribeAsync (string subject, string queue) |
IAsyncSubscription | SubscribeAsync (string subject, string queue, EventHandler< MsgHandlerEventArgs > handler) |
void | Flush (int timeout) |
void | Flush () |
void | Close () |
bool | IsClosed () |
bool | IsReconnecting () |
void | ResetStats () |
override string | ToString () |
void | Dispose () |
Public Member Functions inherited from NATS.Client.IEncodedConnection | |
void | Publish (string subject, object obj) |
void | ResetStats () |
-Additional Inherited Members | |
+Protected Member Functions | |
override void | Dispose (bool disposing) |
+Properties | |
Serializer | OnSerialize [get, set] |
Deserializer | OnDeserialize [get, set] |
Properties inherited from NATS.Client.Connection | |
Options | Opts [get] |
string | ConnectedUrl [get] |
string | ConnectedId [get] |
string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
IStatistics | Stats [get] |
long | MaxPayload [get] |
Properties inherited from NATS.Client.IConnection | |
Options | Opts [get] |
string | ConnectedUrl [get] |
string | ConnectedId [get] |
string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
IStatistics | Stats [get] |
long | MaxPayload [get] |
Properties inherited from NATS.Client.IEncodedConnection | |
Options | Opts [get] |
string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
This class subclasses the Connection class to support serialization.
+Represents an Connection which uses a client specified encoding scheme.
+
|
+ +protectedvirtual | +
Closes the EncodedConnection and optionally releases the managed resources.
+disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Reimplemented from NATS.Client.Connection.
+ +void NATS.Client.EncodedConnection.Publish | +( | +string | +subject, | +
+ | + | Object | +obj | +
+ | ) | ++ |
Publishes the serialized value of obj to the given subject .
+subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | The serialzed form of obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | OnSerialize is null .-or-There was an unexpected exception performing an internal NATS call while publishing. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Publish will perform a Publish() expecting a response on the reply subject. Use Request() for automatically waiting for a response inline.
+Publishes the serialized value of obj to the given subject .
subject | Subject to publish on |
reply | Subject the receiver will on. |
obj | The object to send |
subject | The subject to publish obj to over the current connection. |
reply | An optional reply subject. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | The serialzed form of obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSException | OnSerialize is null .-or-There was an unexpected exception performing an internal NATS call while publishing. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
-A negative timeout blocks forever, zero is not allowed.
+Sends a request payload and returns the deserialized response, or throws NATSTimeoutException if the timeout expires.
+Request(string, object, int) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
obj | The object to send |
timeout | time to block |
subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
ArgumentOutOfRangeException | timeout is less than or equal to zero (0 ). |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | The serialzed form of obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
@@ -295,15 +500,27 @@Request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
+Sends a request payload and returns the deserialized response.
+Request(string, object) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
obj | The object to send |
subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSMaxPayloadException | The serialzed form of obj exceeds the maximum payload size supported by the NATS server. |
NATSConnectionClosedException | The Connection is closed. |
NATSTimeoutException | A timeout occurred while sending the request or receiving the response. |
NATSException | There was an unexpected exception performing an internal NATS call while executing the request. See System.Exception.InnerException for more details. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
@@ -333,15 +550,26 @@SubscribeAsync will create an AsyncSubscriber with interest in a given subject, assign the handler, and immediately start receiving messages.
+Expresses interest in the given subject to the NATS Server, and begins delivering messages to the given event handler.
+The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | Subject of interest. |
handler | An encoded message handler delegate. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
handler | The EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
ArgumentNullException | handler is null . |
NATSException | OnDeserialize is null . |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
@@ -377,19 +605,77 @@This method creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously. Start() must be called to begin receiving messages.
+Creates an asynchronous queue subscriber on the given subject , and begins delivering messages to the given event handler.
+The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | Subject of interest |
queue | Name of the queue group |
handler | A message handler to initialize the MessageHandler event with. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
queue | The name of the queue group in which to participate. |
handler | The EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
ArgumentNullException | handler is null . |
NATSException | OnDeserialize is null . |
NATSBadSubscriptionException | subject is null or entirely whitespace. |
NATSConnectionClosedException | The Connection is closed. |
IOException | There was a failure while writing to the network. |
Implements NATS.Client.IEncodedConnection.
+
+
|
+ +getset | +
Gets or sets the method which is called to deserialize objects from a message payload.
+If null
is given then the default deserialization method for the platform is used, if one exists.
+
|
+ +getset | +
Gets or sets the method which is called to serialize objects sent as a message payload.
+If null
is given then the default serialization method for the platform is used, if one exists.
Event arguments for the EncodedConnection Asynchronous Subscriber delegate.
+Provides decoded messages received by subscriptions or requests.
Gets the original message this object was deserialized from.
+Gets the original Msg that ReceivedObject was deserialized from.
Gets the reply
+Gets the reply topic for the received Msg.
Gets the subject this object was received on.
+Gets the subject for the received Msg.
Properties | |
Connection | Conn [get] |
Connection | Conn [get] |
Subscription | Subscription [get] |
Subscription | Subscription [get] |
string | Error [get] |
Event arguments for the ErrorEventHandler type delegate.
+Provides details for an error encountered asynchronously by an IConnection.
Connection NATS.Client.ErrEventArgs.Conn | +Connection NATS.Client.ErrEventArgs.Conn |
Gets the connection associated with the event.
+Gets the Connection associated with the event.
Gets the error associated with the event.
+Gets the error message associated with the event.
Subscription NATS.Client.ErrEventArgs.Subscription | +Subscription NATS.Client.ErrEventArgs.Subscription |
Gets the Subscription associated wit the event.
+Gets the NATS.Client.Subscription associated with the event.
A NATS message is an object encapsulating a subject, optional reply payload, and subscription information, sent or received by teh client application.
+A NATS message is an object encapsulating a subject, optional reply payload, and subscription information, sent or received by the client application.
Creates an empty message.
+Initializes a new instance of the Msg class without any subject, reply, or data.
Creates a message with a subject, reply, and data.
+Initializes a new instance of the Msg class with a subject, reply, and data.
subject | Subject of the message, required. |
reply | Reply subject, can be null. |
data | Message payload |
subject | Subject of the message. |
reply | A reply subject, or null . |
data | A byte array containing the message payload. |
Creates a message with a subject and data.
+Initializes a new instance of the Msg class with a subject and data.
subject | Subject of the message, required. |
data | Message payload |
subject | Subject of the message. |
data | A byte array containing the message payload. |
Creates a message with a subject and no payload.
+Initializes a new instance of the Msg class with a subject and no data.
subject | Subject of the message, required. |
subject | Subject of the message. |
Assigns the data of the message. This is a direct assignment, to avoid expensive copy operations. A change to the passed byte array will be changed in the message.
-The application is responsible for the data integrity in the message.
+Assigns the data of the message.
+This is a direct assignment, to avoid expensive copy operations. A change to the passed byte array will be changed in the message.
+The calling application is responsible for the data integrity in the message.
data | a bytes buffer of data. |
Gets the subscription assigned to the messages.
+Gets the ISubscription which received the message.
Sets data in the message. This copies application data into the message.
-See AssignData to directly pass the bytes buffer.
- +Gets or sets the payload of the message.
+This copies application data into the message. See AssignData to directly pass the bytes buffer.
+This class is passed into the MsgHandler delegate, providing the message received.
+Provides the message received by an IAsyncSubscription.
[get, set]
[get, set]
[get, set]
[get, set]
[get, set]
[get, set]
This class is used to setup all NATs client options.
@@ -195,13 +201,28 @@Adds a certifcate for use with a secure connection.
+Adds an X.509 certifcate from a file for use with a secure connection.
fileName | Path to the certificate file to add. |
ArgumentNullException | fileName is null . |
System.Security.Cryptography.CryptographicException | An error with the certificate ocurred. For example:
|
Adds a certificate for use with a secure connection.
+Adds an X.509 certifcate for use with a secure connection.
certificate | Certificate to add. |
certificate | An X.509 certificate represented as an X509Certificate2 object. |
ArgumentNullException | certificate is null . |
System.Security.Cryptography.CryptographicException | An error with the certificate ocurred. For example:
|
Represents the method that will handle an event raised when a connection has reconnected to a server.
+EventHandler<ConnEventArgs> NATS.Client.Options.ServerDiscoveredEventHandler = null | +
Represents the method that will handle an event raised whenever a new server has joined the cluster.
+Overrides the default NATS RemoteCertificationValidationCallback.
-The default callback simply checks if there were any protocol errors. Overriding this callback useful during testing, or accepting self signed certificates.
+The default callback simply checks if there were any protocol errors. Overriding this callback is useful during testing, or accepting self signed certificates.
Gets or Sets the allow reconnect flag. When set to false, the NATs client will not attempt to reconnect if a connection has been lost.
+Gets or sets a value indicating whether or not an IConnection will attempt to reconnect to the NATS server if a connection has been lost.
Gets or Sets the randomization of choosing a server to connect to.
+Gets or sets a value indicating whether or not the server chosen for connection should not be selected randomly.
Sets the user password used when connecting to the NATs server when not included directly in the URLs.
+Sets the user password used when connecting to the NATs server, when not included directly in the URLs.
Gets or sets the interval pings will be sent to the server. Take care to coordinate this value with the server's interval.
+Gets or sets the interval, in milliseconds, pings will be sent to the server.
+Take care to coordinate this value with the server's interval.
Gets or Sets the amount of time, in milliseconds, the client will wait during a reconnection.
+Gets or sets the amount of time, in milliseconds, the client will wait before attempting a reconnection.
Get or sets the secure property. Not currently implemented.
+Get or sets a value indicating whether or not a secure connection (TLS) should be made to NATS servers.
Gets or Sets the array of servers that the NATs client will connect to.
+Gets or sets the array of servers that the NATs client will connect to.
+The individual URLs may contain username/password information.
Sets or gets number of long running tasks to deliver messages to asynchronous subscribers. The default is 0 indicating each asynchronous subscriber has its own channel and task created to deliver messages.
+Gets or sets the number of long running tasks to deliver messages to asynchronous subscribers. The default is zero (0
) indicating each asynchronous subscriber has its own channel and task created to deliver messages.
The default where each subscriber has a delivery task is very performant, but does not scale well when large numbers of subscribers are required in an application. Setting this value will limit the number of subscriber channels to the specified number of long running tasks. These tasks will process messages for ALL asynchronous subscribers rather than one task for each subscriber. Delivery order by subscriber is still guaranteed. The shared message processing channels are still each bounded by the SubChannelLength option. Note, slow subscriber errors will flag the last subscriber processed in the tasks, which may not actually be the slowest subscriber.
+
+
|
+ +getset | +
Gets or sets the batch size for calling subscription handlers.
+When delivering messages to the subscriber, the batch size determines how many messages could be retrieved from the internal subscription queue at one time. This can allow higher performance from a single subscriber by avoiding the locking overhead of one-at-a-time retrieval from the queue.
+Gets or sets the timeout when flushing a connection.
+Gets or sets the timeout, in milliseconds, when connecting to a NATS server.
Gets or sets the url used to connect to the NATs server. This may contain user information.
+Gets or sets the url used to connect to the NATs server.
+This may contain username/password information.
+ +
+
|
+ +getset | +
Gets or sets a value indicating whether or not the old request pattern should be used.
+The old request pattern involved a separate subscription per request inbox. The new style (default) involves creating a single inbox subscription per connection, upon the first request, and mapping outbound requests over that one subscription.
Gets or sets the user name used when connecting to the NATs server when not included directly in the URLs.
+Gets or sets the user name used when connecting to the NATs server, when not included directly in the URLs.
Gets or sets the verbosity of logging.
+Gets or sets a value indicating whether or not logging information should be verbose.
CNATS.Client.ConnectionFactory | Creates a connection to the NATS server. | |||||||||||||||||
CNATS.Client.ConnEventArgs | Event arguments for the ConnEventHandler type delegate. | |||||||||||||||||
CNATS.Client.EncodedMessageEventArgs | Event arguments for the EncodedConnection Asynchronous Subscriber delegate. | |||||||||||||||||
CNATS.Client.ErrEventArgs | Event arguments for the ErrorEventHandler type delegate. | |||||||||||||||||
CNATS.Client.IConnection | Represents the connection to the NATS server. | |||||||||||||||||
▼CNATS.Client.IEncodedConnection | Represents an encoded connection to the NATS server. | |||||||||||||||||
CNATS.Client.EncodedConnection | This class subclasses the Connection class to support serialization. | |||||||||||||||||
CNATS.Client.IStatistics | Tracks various statistics received and sent on this connection. | |||||||||||||||||
▼CNATS.Client.ISubscription | Represents interest in a NATS topic. | |||||||||||||||||
CNATS.Client.IAsyncSubscription | An object of this class is an asynchronous subscription representing interest in a subject. The subject can have wildcards (partial:*, full:>). Messages will be delivered to the associated MessageHandler event delegates. While nothing prevents event handlers from being added or removed while processing messages. If the subscriber was created without providing a handler, no messages will be received until Start() has been called. This allows event handlers to be added before message processing begins. | |||||||||||||||||
CNATS.Client.ISyncSubscription | A Syncronous Subscripion will express interest in a given subject. The subject can have wildcards (partial:*, full:>). Messages arriving are retrieved via NextMsg() | |||||||||||||||||
CNATS.Client.Msg | A NATS message is an object encapsulating a subject, optional reply payload, and subscription information, sent or received by teh client application. | |||||||||||||||||
CNATS.Client.MsgHandlerEventArgs | This class is passed into the MsgHandler delegate, providing the message received. |
CNATS.Client.ConnectionFactory | Provides factory methods to create connections to NATS Servers. | |||||||||||||||||
CNATS.Client.ConnEventArgs | Provides the details when the state of a Connection changes. | |||||||||||||||||
CNATS.Client.EncodedMessageEventArgs | Provides decoded messages received by subscriptions or requests. | |||||||||||||||||
CNATS.Client.ErrEventArgs | Provides details for an error encountered asynchronously by an IConnection. | |||||||||||||||||
▼CNATS.Client.IConnection | Represents a connection to the NATS server. | |||||||||||||||||
▼CNATS.Client.Connection | Connection represents a bare connection to a NATS server. Users should create an IConnection instance using ConnectionFactory rather than directly using this class. | |||||||||||||||||
CNATS.Client.EncodedConnection | Represents an Connection which uses a client specified encoding scheme. | |||||||||||||||||
▼CNATS.Client.IEncodedConnection | Represents a connection to a NATS Server which uses a client specified encoding scheme. | |||||||||||||||||
CNATS.Client.EncodedConnection | Represents an Connection which uses a client specified encoding scheme. | |||||||||||||||||
▼CNATS.Client.IStatistics | Tracks various statistics received and sent on an IConnection. | |||||||||||||||||
CNATS.Client.Statistics | Tracks various statistics received and sent on an IConnection. | |||||||||||||||||
▼CNATS.Client.ISubscription | Represents interest in a NATS topic. | |||||||||||||||||
CNATS.Client.AsyncSubscription | AsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. This class should not be used directly. | |||||||||||||||||
▼CNATS.Client.IAsyncSubscription | IAsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. | |||||||||||||||||
CNATS.Client.AsyncSubscription | AsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. This class should not be used directly. | |||||||||||||||||
▼CNATS.Client.ISyncSubscription | ISyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int). | |||||||||||||||||
CNATS.Client.SyncSubscription | SyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int). This class should not be used directly. | |||||||||||||||||
▼CNATS.Client.Subscription | Represents interest in a NATS topic. This class should not be used directly. | |||||||||||||||||
CNATS.Client.AsyncSubscription | AsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event. This class should not be used directly. | |||||||||||||||||
CNATS.Client.SyncSubscription | SyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int). This class should not be used directly. | |||||||||||||||||
CNATS.Client.SyncSubscription | SyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int). This class should not be used directly. | |||||||||||||||||
CNATS.Client.Msg | A NATS message is an object encapsulating a subject, optional reply payload, and subscription information, sent or received by the client application. | |||||||||||||||||
CNATS.Client.MsgHandlerEventArgs | Provides the message received by an IAsyncSubscription. | |||||||||||||||||
▼CNATS.Client.NATSException | The exception that is thrown when there is a NATS error condition. All NATS exception inherit from this class. | |||||||||||||||||
CNATS.Client.NATSBadSubscriptionException | The exception that is thrown when a subscriber operation is performed on an invalid subscriber. | |||||||||||||||||
CNATS.Client.NATSConnectionClosedException | The exception that is thrown when a an operation is performed on a connection that is closed. | |||||||||||||||||
NATS .NET Client
- 0.7.0
+ 0.8.0
The nats.io .NET C# Client, Supported by Apcera
|
diff --git a/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription-members.html b/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription-members.html
index 3240b97b9..654d8b4f2 100755
--- a/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription-members.html
+++ b/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription-members.html
@@ -33,7 +33,7 @@
||||||||||||||||||
NATS .NET Client
- 0.7.0
+ 0.8.0
The nats.io .NET C# Client, Supported by Apcera
|
diff --git a/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription.html b/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription.html
index 7fb0def2a..efe6b43c6 100755
--- a/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription.html
+++ b/documentation/NATS.Client/html/interface_n_a_t_s_1_1_client_1_1_i_async_subscription.html
@@ -33,7 +33,7 @@
||||||||||||||||||
NATS .NET Client
- 0.7.0
+ 0.8.0
The nats.io .NET C# Client, Supported by Apcera
|
@@ -122,6 +122,7 @@
string | Queue [get] |
Connection | Connection [get] |
Connection | Connection [get] |
bool | IsValid [get] |
An object of this class is an asynchronous subscription representing interest in a subject. The subject can have wildcards (partial:*, full:>). Messages will be delivered to the associated MessageHandler event delegates. While nothing prevents event handlers from being added or removed while processing messages. If the subscriber was created without providing a handler, no messages will be received until Start() has been called. This allows event handlers to be added before message processing begins.
+IAsyncSubscription asynchronously delivers messages to listeners of the MessageHandler event.
+If the IAsyncSubscription is created without listening to the MessageHandler event, no messages will be received until Start() has been called.
Starts receiving messages.
-If a message handler was not passed when creating the subscriber, the subscriber must assign delegates then complete the subscription process with this method.
+Starts delivering received messages to listeners on MessageHandler from a separate thread.
+If the IAsyncSubscription has already started delivering messages, this method is a no-op.
+ +Implemented in NATS.Client.AsyncSubscription.
Adds or removes a message handler for this subscriber.
+Occurs when the IAsyncSubscription receives a message from the underlying ISubscription.
Inherits IDisposable.
- -Inherited by NATS.Client.Connection.
+Public Member Functions | |
Represents the connection to the NATS server.
+Represents a connection to the NATS server.
Close will close the connection to the server. This call will release all blocking calls, such as Flush() and NextMsg().
+Closes the IConnection and all associated subscriptions.
+ + +Implemented in NATS.Client.Connection.
Flush will perform a round trip to the server and return when it receives the internal reply.
+Performs a round trip to the server and returns when it receives the internal reply, or throws a NATSTimeoutException exception if the NATS Server does not reply in time.
timeout | The timeout in milliseconds. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
+Flush will perform a round trip to the server and return when it receives the internal reply.
+Performs a round trip to the server and returns when it receives the internal reply.
+ +Implemented in NATS.Client.Connection.
Test if this connection has been closed.
-Returns a value indicating whether or not the IConnection instance is closed.
+true
if and only if the IConnection is closed, otherwise false
.Implemented in NATS.Client.Connection.
Test if this connection is reconnecting.
-Returns a value indicating whether or not the IConnection is currently reconnecting.
+true
if and only if the IConnection is reconnecting, otherwise false
.Implemented in NATS.Client.Connection.
NewInbox will return an inbox string which can be used for directed replies from subscribers. These are guaranteed to be unique, but can be shared and subscribed to by others.
-Creates an inbox string which can be used for directed replies from subscribers.
+The returned inboxes are guaranteed to be unique, but can be shared and subscribed to by others.
+Implemented in NATS.Client.Connection.
Publish publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver.
+Publishes data to the given subject .
+NATS implements a publish-subscribe message distribution model. NATS publish subscribe is a one-to-many communication. A publisher sends a message on a subject. Any active subscriber listening on that subject receives the message. Subscribers can register interest in wildcard subjects.
+In the basic NATS platfrom, if a subscriber is not listening on the subject (no subject match), or is not acive when the message is sent, the message is not recieved. NATS is a fire-and-forget messaging system. If you need higher levels of service, you can either use NATS Streaming, or build the additional reliability into your client(s) yourself.
subject | Subject to publish the message to. |
data | Message payload |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
+Publishes a Msg object, which includes the Subject, an optional Reply and an optional Data field.
+Publishes a Msg instance, which includes the subject, an optional reply, and an optional data field.
msg | The message to send. |
msg | A Msg instance containing the subject, optional reply, and data to publish to the NATS server. |
Implemented in NATS.Client.Connection.
Publish will perform a Publish() excpecting a response on the reply subject. Use Request() for automatically waiting for a response inline.
+Publishes data to the given subject .
subject | Subject to publish on |
reply | Subject the receiver will on. |
data | The message payload |
subject | The subject to publish data to over the current connection. |
reply | An optional reply subject. |
data | An array of type Byte that contains the data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
-A negative timeout blocks forever, zero is not allowed.
+Sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
+Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
data | payload of the message |
timeout | time to block |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
+Sends a request payload and returns the response Msg.
+NATS supports two flavors of request-reply messaging: point-to-point or one-to-many. Point-to-point involves the fastest or first to respond. In a one-to-many exchange, you set a limit on the number of responses the requestor may receive and instead must use a subscription (ISubscription.AutoUnsubscribe(int)). In a request-response exchange, publish request operation publishes a message with a reply subject expecting a response on that reply subject.
+Request(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
data | payload of the message |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Asynchronrous method of request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
-A negative timeout blocks forever, zero is not allowed.
+Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires.
+RequestAsync(string, byte[], int) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
data | payload of the message |
timeout | time to block |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.Connection.
Asynchronrous method of Request that will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
+Asynchronously sends a request payload and returns the response Msg.
+RequestAsync(string, byte[]) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
data | payload of the message |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
Implemented in NATS.Client.Connection.
Asynchronrous method of request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
-A negative timeout blocks forever, zero is not allowed.
+Asynchronously sends a request payload and returns the response Msg, or throws NATSTimeoutException if the timeout expires, while monitoring for cancellation requests.
+RequestAsync(string, byte[], int, CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
data | payload of the message |
timeout | time to block |
token | cancellation token source |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Asynchronrous method of Request that will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
+Asynchronously sends a request payload and returns the response Msg, while monitoring for cancellation requests.
+RequestAsync(string, byte[], CancellationToken) will create an unique inbox for this request, sharing a single subscription for all replies to this Connection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
data | payload of the message |
token | cancellation token |
subject | The subject to publish data to over the current connection. |
data | An array of type Byte that contains the request data to publish to the connected NATS server. |
token | The token to monitor for cancellation requests. |
Implemented in NATS.Client.Connection.
Resets connection statistics.
+Resets the associated statistics for the IConnection.
+Implemented in NATS.Client.Connection.
SubscribeAsynchronously will create an AsyncSubscriber with interest in a given subject. Start() must be called to begin receiving messages.
+Expresses interest in the given subject to the NATS Server.
+The IAsyncSubscription returned will not start receiving messages until IAsyncSubscription.Start is called.
subject | Subject of interest. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
Implemented in NATS.Client.Connection.
SubscribeAsynch will create an AsyncSubscriber with interest in a given subject, assign the handler, and immediately start receiving messages.
+Expresses interest in the given subject to the NATS Server, and begins delivering messages to the given event handler.
+The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | Subject of interest. |
handler | A message handler to initialize the MessageHandler event with. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
handler | The EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
Implemented in NATS.Client.Connection.
This method creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously. Start() must be called to begin receiving messages.
+Creates an asynchronous queue subscriber on the given subject .
+All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message.
+The IAsyncSubscription returned will not start receiving messages until IAsyncSubscription.Start is called.
subject | Subject of interest |
queue | Name of the queue group |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
queue | The name of the queue group in which to participate. |
Implemented in NATS.Client.Connection.
This method creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously. Start() must be called to begin receiving messages.
+Creates an asynchronous queue subscriber on the given subject , and begins delivering messages to the given event handler.
+All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message.
+The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | Subject of interest |
queue | Name of the queue group |
handler | A message handler to initialize the MessageHandler event with. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
queue | The name of the queue group in which to participate. |
handler | The EventHandler<MsgHandlerEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
Implemented in NATS.Client.Connection.
Subscribe will create a subscriber with interest in a given subject. The subject can have wildcards (partial:*, full:>). Messages will be delivered to the associated MsgHandler. If no MsgHandler is set, the subscription is a synchronous subscription and can be polled via Subscription.NextMsg(). Subscriber message handler delegates can be added or removed anytime.
+Expresses interest in the given subject to the NATS Server.
subject | Subject of interest. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
Implemented in NATS.Client.Connection.
Creates a synchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message synchronously.
+Creates a synchronous queue subscriber on the given subject .
+All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message synchronously.
subject | Subject of interest |
queue | Name of the queue group |
subject | The subject on which to listen for messages. |
queue | The name of the queue group in which to participate. |
Implemented in NATS.Client.Connection.
Returns the id of the server currently connected.
+Gets the server ID of the NATS server to which this instance is connected, otherwise null
.
Returns the url of the server currently connected, null otherwise.
+Gets the URL of the NATS server to which this instance is connected, otherwise null
.
Returns only the server urls that have been discovered after a connection has been established. If authentication is enabled, Options.User or Options.Token must be used when connecting with these urls.
+Gets an array of server URLs that were discovered after this instance connected.
+If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.
LastError reports the last error encountered via the Connection.
+Gets the last Exception encountered by this instance, otherwise null
.
Returns the server defined size limit that a message payload can have.
+Gets the maximum size in bytes of any payload sent to the connected NATS Server.
+Returns the options used to create this connection.
+Gets the configuration options for this instance.
Returns the list of known server urls, including additional servers discovered after a connection has been established. If authentication is enabled, Options.User or Options.Token must be used when connecting with these urls.
+Gets an array of known server URLs for this instance.
+Servers also includes any additional servers discovered after a connection has been established. If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.
Gets the current state of the connection.
+Gets the current state of the IConnection.
+Returns a race safe copy of connection statistics.
+Gets the statistics tracked for the IConnection.
+string[] | Servers [get] |
string[] | DiscoveredServers [get] |
Exception | LastError [get] |
ConnState | State [get] |
Represents an encoded connection to the NATS server.
+Represents a connection to a NATS Server which uses a client specified encoding scheme.
Close will close the connection to the server. This call will release all blocking calls, such as Flush() and NextMsg().
+Closes the IConnection and all associated subscriptions.
+Flush will perform a round trip to the server and return when it receives the internal reply.
+Performs a round trip to the server and returns when it receives the internal reply, or throws a NATSTimeoutException exception if the NATS Server does not reply in time.
timeout | The timeout in milliseconds. |
timeout | The number of milliseconds to wait. |
Flush will perform a round trip to the server and return when it receives the internal reply.
+Performs a round trip to the server and returns when it receives the internal reply.
Test if this connection has been closed.
-Returns a value indicating whether or not the IConnection instance is closed.
+true
if and only if the IConnection is closed, otherwise false
.Test if this connection is reconnecting.
-Returns a value indicating whether or not the IConnection is currently reconnecting.
+true
if and only if the IConnection is reconnecting, otherwise false
.NewInbox will return an inbox string which can be used for directed replies from subscribers. These are guaranteed to be unique, but can be shared and subscribed to by others.
-Creates an inbox string which can be used for directed replies from subscribers.
+The returned inboxes are guaranteed to be unique, but can be shared and subscribed to by others.
+Publish serializes and publishes an object to the given subject. The object argument is left untouched and needs to be correctly interpreted on the receiver.
+Publishes the serialized value of obj to the given subject .
subject | Subject to publish the message to. |
obj | The object to send |
subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
Publish will perform a Publish() expecting a response on the reply subject. Use Request() for automatically waiting for a response inline.
+Publishes the serialized value of obj to the given subject .
subject | Subject to publish on |
reply | Subject the receiver will on. |
obj | The object to send |
subject | The subject to publish obj to over the current connection. |
reply | An optional reply subject. |
obj | The Object to serialize and publish to the connected NATS server. |
Implemented in NATS.Client.EncodedConnection.
+Implemented in NATS.Client.EncodedConnection.
Request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
-A negative timeout blocks forever, zero is not allowed.
+Sends a request payload and returns the deserialized response, or throws NATSTimeoutException if the timeout expires.
+Request(string, object, int) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
obj | The object to send |
timeout | time to block |
subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
timeout | The number of milliseconds to wait. |
Implemented in NATS.Client.EncodedConnection.
@@ -441,15 +450,17 @@Request will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
+Sends a request payload and returns the deserialized response.
+Request(string, object) will create an unique inbox for this request, sharing a single subscription for all replies to this IEncodedConnection instance. However, if Options.UseOldRequestStyle is set, each request will have its own underlying subscription. The old behavior is not recommended as it may cause unnecessary overhead on connected NATS servers.
subject | Subject to send the request on. |
obj | The object to send |
subject | The subject to publish obj to over the current connection. |
obj | The Object to serialize and publish to the connected NATS server. |
Implemented in NATS.Client.EncodedConnection.
@@ -468,7 +479,8 @@Resets connection statistics.
+Resets the associated statistics for the IConnection.
+SubscribeAsync will create an AsyncSubscriber with interest in a given subject, assign the handler, and immediately start receiving messages.
+Expresses interest in the given subject to the NATS Server, and begins delivering messages to the given event handler.
+The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | Subject of interest. |
handler | An encoded message handler delegate. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
handler | The EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
Implemented in NATS.Client.EncodedConnection.
@@ -540,16 +554,18 @@This method creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously. Start() must be called to begin receiving messages.
+Creates an asynchronous queue subscriber on the given subject , and begins delivering messages to the given event handler.
+The IAsyncSubscription returned will start delivering messages to the event handler as soon as they are received. The caller does not have to invoke IAsyncSubscription.Start.
subject | Subject of interest |
queue | Name of the queue group |
handler | A message handler to initialize the MessageHandler event with. |
subject | The subject on which to listen for messages. The subject can have wildcards (partial: * , full: > ). |
queue | The name of the queue group in which to participate. |
handler | The EventHandler<TEventArgs> invoked when messages are received on the returned IAsyncSubscription. |
Implemented in NATS.Client.EncodedConnection.
@@ -574,7 +590,7 @@Returns the id of the server currently connected.
+Gets the server ID of the NATS server to which this instance is connected, otherwise null
.
Returns the url of the server currently connected, null otherwise.
+Gets the URL of the NATS server to which this instance is connected, otherwise null
.
+
|
+ +get | +
Gets an array of server URLs that were discovered after this instance connected.
+If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.
LastError reports the last error encountered via the Connection.
+Gets the last Exception encountered by this instance, otherwise null
.
Returns the server defined size limit that a message payload can have.
+Gets the maximum size in bytes of any payload sent to the connected NATS Server.
+Overrides the default deserialization.
+Gets or sets the method which is called to deserialize objects from a message payload.
Overrides the default serialization.
+Gets or sets the method which is called to serialize objects sent as a message payload.
Returns the options used to create this connection.
+Gets the configuration options for this instance.
Servers returns the list of potential servers, including those updated after a connection has been made.
+Gets an array of known server URLs for this instance.
+Servers also includes any additional servers discovered after a connection has been established. If authentication is enabled, Options.User or Options.Token must be used when connecting with these URLs.
Gets the current state of the connection.
+Gets the current state of the IConnection.
+Returns a race safe copy of connection statistics.
+Gets the statistics tracked for the IConnection.
+Inherited by NATS.Client.Statistics.
+Properties | |
Tracks various statistics received and sent on this connection.
+Tracks various statistics received and sent on an IConnection.
string | Queue [get] |
Connection | Connection [get] |
Connection | Connection [get] |
bool | IsValid [get] |
Represents interest in a NATS topic.
+Subscriptions represent interest in a topic on a NATS Server or cluster of NATS Servers. Subscriptions can be exact or include wildcards. A subscriber can process a NATS message synchronously (ISyncSubscription) or asynchronously (IAsyncSubscription).
+AutoUnsubscribe will issue an automatic Unsubscribe that is processed by the server when max messages have been received. This can be useful when sending a request to an unknown number of subscribers. Request() uses this functionality.
+Issues an automatic call to Unsubscribe when max messages have been received.
+This can be useful when sending a request to an unknown number of subscribers. Connection's Request methods use this functionality.
max | Number of messages to receive before unsubscribing. |
max | The maximum number of messages to receive on the subscription before calling Unsubscribe. Values less than or equal to zero (0 ) unsubscribe immediately. |
Implemented in NATS.Client.Subscription, and NATS.Client.AsyncSubscription.
+Clears the maximum pending statistics.
+Clears the maximum pending bytes and messages statistics.
+ +Implemented in NATS.Client.Subscription.
Gets the maximum pending messages and pending bytes recorded.
+Returns the maximum number of pending bytes and messages during the life of the Subscription.
maxPendingBytes | Maximum number of pending bytes recorded. |
maxPendingMessages | Maximum number of pending messages recorded. |
maxPendingBytes | When this method returns, maxPendingBytes will contain the current maximum pending bytes. |
maxPendingMessages | When this method returns, maxPendingBytes will contain the current maximum pending messages. |
Implemented in NATS.Client.Subscription.
+Gets pending messages and bytes.
+Returns the pending byte and message counts.
pendingBytes | Current number of pending bytes. |
pendingMessages | Current number of pending messages. |
pendingBytes | When this method returns, pendingBytes will contain the count of bytes not yet processed on the ISubscription. |
pendingMessages | When this method returns, pendingMessages will contain the count of messages not yet processed on the ISubscription. |
Implemented in NATS.Client.Subscription.
+Sets the message limit and bytes limit of a subscriber.
+Sets the limits for pending messages and bytes for this instance.
+Zero (0
) is not allowed. Negative values indicate that the given metric is not limited.
messageLimit | Maximum number of pending messages to allow. |
bytesLimit | Maximum number of pending bytes to allow. |
messageLimit | The maximum number of pending messages. |
bytesLimit | The maximum number of pending bytes of payload. |
Implemented in NATS.Client.Subscription.
+Removes interest in the given subject.
+Removes interest in the Subject.
+ +Implemented in NATS.Client.Subscription, and NATS.Client.AsyncSubscription.
Connection NATS.Client.ISubscription.Connection | +Connection NATS.Client.ISubscription.Connection |
Gets the Connection this subscriber was created on.
+Gets the NATS.Client.Connection associated with this instance.
Gets the number of messages delivered to a subscriber.
+Gets the number of delivered messages for this instance.
Gets the number of message dropped by violations of pending limits.
-If the server declares the connection a slow consumer, this number may not be valid.
+Gets the number of known dropped messages for this instance.
+This will correspond to the messages dropped by violations of PendingByteLimit and/or PendingMessageLimit. If the NATS server declares the connection a slow consumer, the count may not be accurate.
True if the subscription is active, false otherwise.
+Gets a value indicating whether or not the ISubscription is still valid.
Gets the maximum number of pending bytes recorded.
+Gets the maximum number of pending bytes seen so far by this instance.
Gets the maximum number of pending messages recorded.
+Gets the maximum number of messages seen so far by this instance.
Gets or sets the maximum number of pending bytes to allow.
+Gets or sets the maximum allowed count of pending bytes.
+The limit must not be zero (0
). Negative values indicate there is no limit on the number of pending bytes.
Gets the current number of pending bytes.
+Gets the number of bytes not yet processed on this instance.
Gets or sets the maximum number of pending messages to allow.
+Gets or sets the maximum allowed count of pending messages.
+The limit must not be zero (0
). Negative values indicate there is no limit on the number of pending messages.
Gets the current number of pending messages.
+Gets the number of messages not yet processed on this instance.
Gets the name of the queue groups this subscriber belongs to.
-Optional queue group name. If present, all subscriptions with the same name will form a distributed queue, and each message will only be processed by one member of the group.
+Gets the optional queue group name.
+If present, all subscriptions with the same name will form a distributed queue, and each message will only be processed by one member of the group. Although queue groups have multiple subscribers, each message is consumed by only one.
Gets the number of messages received, but not processed, this subscriber.
+Gets the number of messages remaining in the delivery queue.
Gets the subject of interest.
+Gets the subject for this subscription.
+Subject names, including reply subject (INBOX) names, are case-sensitive and must be non-empty alphanumeric strings with no embedded whitespace, and optionally token-delimited using the dot character (.
), e.g.: FOO
, BAR
, foo.BAR
, FOO.BAR
, and FOO.BAR.BAZ
are all valid subject names, while: FOO. BAR
, foo. .bar
and foo..bar
are not valid subject names.
NATS supports the use of wildcards in subject subscriptions.
+*
) matches any token at any level of the subject. >
), also known as the full wildcard, matches one or more tokens at the tail of a subject, and must be the last token. The wildcard subject foo.>
will match foo.bar
or foo.bar.baz.1
, but not foo
. foo.*.bar
or foo.>
are syntactically valid; foo*.bar
, f*o.b*r
and foo>
are not). For example, the wildcard subscrpitions foo.*.quux
and foo.>
both match foo.bar.quux
, but only the latter matches foo.bar.baz
. With the full wildcard, it is also possible to express interest in every subject that may exist in NATS (>
).
string | Queue [get] |
Connection | Connection [get] |
Connection | Connection [get] |
bool | IsValid [get] |
A Syncronous Subscripion will express interest in a given subject. The subject can have wildcards (partial:*, full:>). Messages arriving are retrieved via NextMsg()
+ISyncSubscription provides messages for a subject through calls to NextMessage() and NextMessage(int).
This method will return the next message available to a synchronous subscriber or block until one is available.
-Returns the next Msg available to a synchronous subscriber, blocking until one is available.
+Implemented in NATS.Client.SyncSubscription.
This method will return the next message available to a synchronous subscriber or block until one is available. A timeout can be used to return when no message has been delivered.
-A timeout of 0 will return null immediately if there are no messages.
+Returns the next Msg available to a synchronous subscriber, or block up to a given timeout until the next one is available.
timeout | Timeout value |
timeout | The amount of time, in milliseconds, to wait for the next message. |
Implemented in NATS.Client.SyncSubscription.
Classes | |
class | AsyncSubscription |
class | Connection |
class | ConnectionFactory |
class | ConnEventArgs |
class | Options |
class | Statistics |
class | Subscription |
class | SyncSubscription |
Enumerations | |
enum | ConnState |
enum | ConnState { + ConnState.DISCONNECTED = 0, +ConnState.CONNECTED, +ConnState.CLOSED, +ConnState.RECONNECTING, + + ConnState.CONNECTING + + } |
@@ -204,7 +222,24 @@ |
State of the connection.
+State of the IConnection.
+Enumerator | |
---|---|
DISCONNECTED |
+ The IConnection is disconnected. + |
CONNECTED |
+ The IConnection is connected to a NATS Server. + |
CLOSED |
+ The IConnection has been closed. + |
RECONNECTING |
+ The IConnection is currently reconnecting to a NATS Server. + |
CONNECTING |
+ The IConnection is currently connecting to a NATS Server. + |
Overrides the default binary deserialization.
+Represents a method that will handle deserialization of a byte array into an Object.
data | Data from the mesasge payload |
data | The byte array in a Msg payload that contains the Object to deserialize. |
Overrides default binary serialization.
+Represents the method that will handle serialization of obj to a byte array.
obj | The object to serialize |
obj | The Object to serialize. |