shibd commented on code in PR #255:
URL: 
https://github.com/apache/pulsar-client-node/pull/255#discussion_r1038656855


##########
README.md:
##########
@@ -26,77 +26,119 @@ The Pulsar Node.js client can be used to create Pulsar 
producers and consumers i
 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.
 
-## How to install
+## Getting Started
 
-> **Note**
->
-> These instructions are only available for versions after 1.8.0. For versions 
previous to 1.8.0, you need to install the C++ client first. Please switch to 
the corresponding version branch of this repo to read the specific instructions.
-
-### Use `npm`
+To use the Pulsar Node.js client in your project, run:
 
 ```shell
 npm install pulsar-client
 ```
 
-### Use `yarn`
+for `npm` users or
 
 ```shell
 yarn add pulsar-client
 ```
 
-After install, you can run the 
[examples](https://github.com/apache/pulsar-client-node/tree/master/examples).
+for `yarn` users.
 
-### Prebuilt binaries
+Then you can run the following simple end-to-end example:
 
-The module uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) to 
download the prebuilt binary for your platform, if it exists.
-These binaries are hosted on ASF dist subversion. The following targets are 
currently provided:
+```javascript
+const Pulsar = require('pulsar-client');
 
-Format: `napi-{platform}-{libc}-{arch}`
-- napi-darwin-unknown-x64.tar.gz
-- napi-linux-glibc-arm64.tar.gz
-- napi-linux-glibc-x64.tar.gz
-- napi-linux-musl-arm64.tar.gz
-- napi-linux-musl-x64.tar.gz
-- napi-win32-unknown-ia32.tar.gz
-- napi-win32-unknown-x64.tar.gz
+(async () => {
+  // Create a client
+  const client = new Pulsar.Client({
+    serviceUrl: 'pulsar://localhost:6650'
+  });
 
-`darwin-arm64` systems are not currently supported, you can refer `How to 
build` to build from source.
+  // Create a producer
+  const producer = await client.createProducer({
+    topic: 'persistent://public/default/my-topic',
+  });
 
+  // Create a consumer
+  const consumer = await client.subscribe({
+    topic: 'persistent://public/default/my-topic',
+    subscription: 'sub1'
+  });
 
-## How to build
+  // Send a message
+  producer.send({
+    data: Buffer.from("hello")
+  });
 
-### 1. Clone repository.
-```shell
-git clone https://github.com/apache/pulsar-client-node.git
-cd pulsar-client-node
+  // Receive the message 
+  const msg = await consumer.receive();
+  console.log(msg.getData().toString());
+  consumer.acknowledge(msg);
+
+  await producer.close();
+  await consumer.close();
+  await client.close();
+})();
+```
+
+You will see the following output:
+
+```
+hello
 ```
 
-### 2. Install C++ client.
+## More examples 

Review Comment:
   It is recommended that this section only cover `how to build(or install)`.
   
   Then we can add a note at the end of the Getting Started section.
   
   ### Get Start
   
   xxxx
   
   Note: You can see more examples in the examples directory. However, since 
these examples might use an API that was not released yet, you need to install 
this module. Refer `How to build`
   
   ### How to Build
   
   xxx



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to