You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ma...@apache.org on 2019/06/12 02:43:52 UTC

[pulsar-client-node] 04/29: make config inline

This is an automated email from the ASF dual-hosted git repository.

massakam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git

commit 05c9e48f397522395e0411d3c28aad354ac05e9a
Author: yfuruta <yf...@yahoo-corp.jp>
AuthorDate: Tue Mar 12 10:55:19 2019 +0900

    make config inline
---
 examples/consumer.js | 10 ++++------
 examples/producer.js | 10 ++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/examples/consumer.js b/examples/consumer.js
index 7092c6b..c754ac3 100644
--- a/examples/consumer.js
+++ b/examples/consumer.js
@@ -21,19 +21,17 @@ const Pulsar = require('../index.js');
 
 (async () => {
   // Create a client
-  const clientConfig = {
+  const client = new Pulsar.Client({
     serviceUrl: 'pulsar://localhost:6650',
     operationTimeoutSeconds: 30,
-  };
-  const client = new Pulsar.Client(clientConfig);
+  });
 
   // Create a consumer
-  const consumerConfig = {
+  const consumer = await client.subscribe({
     topic: 'persistent://public/default/my-topic',
     subscription: 'sub1',
     ackTimeoutMs: 10000,
-  };
-  const consumer = await client.subscribe(consumerConfig);
+  });
 
   // Receive messages
   for (let i = 0; i < 10; i += 1) {
diff --git a/examples/producer.js b/examples/producer.js
index b1b6856..8730719 100644
--- a/examples/producer.js
+++ b/examples/producer.js
@@ -21,19 +21,17 @@ const Pulsar = require('../index.js');
 
 (async () => {
   // Create a client
-  const clientConfig = {
+  const client = new Pulsar.Client({
     serviceUrl: 'pulsar://localhost:6650',
     operationTimeoutSeconds: 30,
-  };
-  const client = new Pulsar.Client(clientConfig);
+  });
 
   // Create a producer
-  const producerConfig = {
+  const producer = await client.createProducer({
     topic: 'persistent://public/default/my-topic',
     sendTimeoutMs: 30000,
     batchingEnabled: true,
-  };
-  const producer = await client.createProducer(producerConfig);
+  });
 
   // Send messages
   const results = [];