1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

GitBook: [master] 178 pages modified

This commit is contained in:
Ginger Collison
2020-09-04 20:10:37 +00:00
committed by gitbook-bot
parent 30e3cdc1fa
commit d21aed4887
13 changed files with 160 additions and 26 deletions

View File

@@ -91,16 +91,16 @@ let nc = await connect({
nnatsConnection *conn = NULL;
natsOptions *opts = NULL;
natsStatus s = NATS_OK;
s = natsOptions_Create(&opts);
if (s == NATS_OK)
// Set the timeout to 10 seconds (10,000 milliseconds)
s = natsOptions_SetTimeout(opts, 10000);
if (s == NATS_OK)
s = natsConnection_Connect(&conn, opts);
(...)
// Destroy objects that were created
natsConnection_Destroy(conn);
natsOptions_Destroy(opts);

View File

@@ -272,7 +272,7 @@ public class SlowConsumerListener {
static void
errorCB(natsConnection *conn, natsSubscription *sub, natsStatus s, void *closure)
{
// Do something
printf("Error: %d - %s", s, natsStatus_GetText(s));
}

View File

@@ -268,7 +268,6 @@ natsConnection_Destroy(conn);
natsOptions_Destroy(opts);
```
{% endtab %}
{% endtabs %}
The mechanics of drain for a subscription are simpler:

View File

@@ -90,6 +90,7 @@ let nc = await connect({
nc.close();
```
{% endtab %}
{% tab title="C" %}
```c
natsConnection *conn = NULL;

View File

@@ -172,6 +172,5 @@ if (s == NATS_OK)
natsConnection_Destroy(conn);
```
{% endtab %}
{% endtabs %}