You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/25 14:22:47 UTC

[GitHub] [pulsar-client-node] yosiat opened a new pull request #85: Create reference for client

yosiat opened a new pull request #85: Create reference for client
URL: https://github.com/apache/pulsar-client-node/pull/85
 
 
   Since we don’t have reference for the client, v8 can garbage collect this instance, which can cause the next code:
   
   ```
   const Pulsar = require('pulsar-client');
   
   (async () => {
     // Create a client
     const client = new Pulsar.Client({
       serviceUrl: 'pulsar://localhost:6650'
     });
   
     // Create a producer
     const producer = await client.createProducer({
       topic: 'persistent://public/default/my-topic',
       sendTimeoutMs: 30000,
       batchingEnabled: true,
     });
   
     let i =0;
     async function produceMessage() {
       i = i + 1;
   
       const msg = `my-message-${i}`;
       const ret = await producer.send({
         data: Buffer.from(msg),
       });
       console.log(`Sent message: ${msg}`);
       console.log(ret);
   
       setTimeout(produceMessage, 1000);
     }
   
     produceMessage();
   })();
   ```
   
   To close the connection suddenly and fail the producer.
   
   
   Fixes: https://github.com/apache/pulsar-client-node/issues/78
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [pulsar-client-node] sijie commented on issue #85: Create reference for client

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #85: Create reference for client
URL: https://github.com/apache/pulsar-client-node/pull/85#issuecomment-604173500
 
 
   @yosiat this is cool! Thank you for your contribution!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [pulsar-client-node] yosiat commented on issue #85: Create reference for client

Posted by GitBox <gi...@apache.org>.
yosiat commented on issue #85: Create reference for client
URL: https://github.com/apache/pulsar-client-node/pull/85#issuecomment-604069164
 
 
   @hrsakai @sijie can you please review this PR ?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [pulsar-client-node] massakam merged pull request #85: Create reference for client

Posted by GitBox <gi...@apache.org>.
massakam merged pull request #85: Create reference for client
URL: https://github.com/apache/pulsar-client-node/pull/85
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services