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:
committed by
gitbook-bot
parent
30e3cdc1fa
commit
d21aed4887
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -268,7 +268,6 @@ natsConnection_Destroy(conn);
|
||||
natsOptions_Destroy(opts);
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% endtabs %}
|
||||
|
||||
The mechanics of drain for a subscription are simpler:
|
||||
|
||||
@@ -90,6 +90,7 @@ let nc = await connect({
|
||||
nc.close();
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="C" %}
|
||||
```c
|
||||
natsConnection *conn = NULL;
|
||||
|
||||
@@ -172,6 +172,5 @@ if (s == NATS_OK)
|
||||
natsConnection_Destroy(conn);
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% endtabs %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user