[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325610073
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325609376
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325608229
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325608469
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325609045
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325609998
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325611358
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
 
 Review comment:
   ```suggestion
   ## Create a client
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325611029
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new 

[GitHub] [pulsar] Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js Client Docs

2019-09-18 Thread GitBox
Jennifer88huang commented on a change in pull request #5212: [Doc] Add Node.js 
Client Docs
URL: https://github.com/apache/pulsar/pull/5212#discussion_r325609674
 
 

 ##
 File path: site2/docs/client-libraries-node.md
 ##
 @@ -0,0 +1,402 @@
+---
+id: client-libraries-node
+title: The Pulsar Node.js client
+sidebar_label: Node.js
+---
+
+The Pulsar Node.js client can be used to create Pulsar 
[producers](#producers), [consumers](#consumers), and [readers](#readers) in 
Node.js.
+
+## Installation
+
+You can install the 
[`pusar-client`](https://www.npmjs.com/package/pulsar-client) library via 
[npm](https://www.npmjs.com/).
+
+### Requirements
+Pulsar Node.js client library is based on the C++ client library.
+Follow [these instructions](client-libraries-cpp.md#compilation) and install 
the Pulsar C++ client library.
+
+### Compatibility
+
+Compatibility between each version of the Node.js client and the C++ client is 
as follows:
+
+| Node.js client | C++ client |
+| :- | :- |
+| 1.0.0  | 2.3.0 or later |
+
+If an incompatible version of the C++ client is installed, you may fail to 
build or run this library.
+
+### Installation using npm
+
+Install the `pulsar-client` library via [npm](https://www.npmjs.com/):
+
+```shell
+$ npm install pulsar-client
+```
+
+>  Note
+> 
+> Also, this library works only in Node.js 10.x or later because it uses the 
[`node-addon-api`](https://github.com/nodejs/node-addon-api) module to wrap the 
C++ library.
+
+## Connection URLs
+To connect to Pulsar using client libraries, you need to specify a [Pulsar 
protocol](developing-binary-protocol.md) URL.
+
+Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` 
scheme and have a default port of 6650. Here is an example for `localhost`:
+
+```http
+pulsar://localhost:6650
+```
+
+A URL for a production Pulsar cluster may look something like this:
+
+```http
+pulsar://pulsar.us-west.example.com:6650
+```
+
+If you're using [TLS encryption](security-tls-transport.md) or [TLS 
Authentication](security-tls-authentication.md), the URL will look like 
something like this:
+
+```http
+pulsar+ssl://pulsar.us-west.example.com:6651
+```
+
+## Creating a client
+
+In order to interact with Pulsar, you'll first need a client object. You can 
create a client instance using a `new` operator and the `Client` method, 
passing in a client options object (more on configuration 
[below](#client-configuration)).
+
+Here is an example:
+
+```JavaScript
+const Pulsar = require('pulsar-client');
+
+(async () => {
+  const client = new Pulsar.Client({
+serviceUrl: 'pulsar://localhost:6650',
+  });
+  
+  await client.close();
+})();
+```
+
+### Client configuration
+
+The following configurable parameters are available for Pulsar clients:
+
+| Parameter | Description | Default |
+| : | :-- | :-- |
+| `serviceUrl` | The connection URL for the Pulsar cluster. See 
[above](#connection-urls) for more info. |  |
+| `authentication` | Configure the authentication provider. (default: no 
authentication). See [TLS Authentication](security-tls-authentication.md) for 
more info. | |
+| `operationTimeoutSeconds` | The timeout for Node.js client operations 
(creating producers, subscribing to and unsubscribing from 
[topics](reference-terminology.md#topic)). Retries will occur until this 
threshold is reached, at which point the operation will fail. | 30 |
+| `ioThreads` | The number of threads to use for handling connections to 
Pulsar [brokers](reference-terminology.md#broker). | 1 |
+| `messageListenerThreads` | The number of threads used by message listeners 
([consumers](#consumers) and [readers](#readers)). | 1 |
+| `concurrentLookupRequest` | The number of concurrent lookup requests that 
can be sent on each broker connection. Setting a maximum helps to keep from 
overloading brokers. You should set values over the default of 5 only if 
the client needs to produce and/or subscribe to thousands of Pulsar topics. | 
5 |
+| `tlsTrustCertsFilePath` | The file path for the trusted TLS certificate. | |
+| `tlsValidateHostname` | The boolean value of setup whether to enable TLS 
hostname verification. | `false` |
+| `tlsAllowInsecureConnection` | The boolean value of setup whether the Pulsar 
client accepts untrusted TLS certificate from broker. | `false` |
+| `statsIntervalInSeconds` | Interval between each stat info. Stats is 
activated with positive statsInterval. The value should be set to 1 second at 
least | 600 |
+
+## Producers
+
+Pulsar producers publish messages to Pulsar topics. You can 
[configure](#producer-configuration) Node.js producers using a producer 
configuration object.
+
+Here is an example:
+
+```JavaScript
+const producer = await client.createProducer({
+  topic: 'my-topic',
+});
+
+await producer.send({
+  data: Buffer.from("Hello, Pulsar"),
+});
+
+await producer.close();
+```
+
+>  Promise operation
+> When you create a new