savearray2 commented on issue #119:
URL: 
https://github.com/apache/pulsar-client-node/issues/119#issuecomment-690976782


   Okay, I probably should have done some more research (and gotten more sleep) 
before posting this. Sorry about this mess.
   The problem with the unhandled promise rejection **is not** with the pulsar 
library. I had a typo in my testing framework code.
   
   The second problem with the segmentation fault happens when the client is 
not closed properly before exit. It may be desirable to include code in the 
library to attach to a process exit to automatically close out the client if it 
hasn't been already, but this might add unneeded complexity.
   
   The following code fixes the test:
   ```js
   const Pulsar = require('.')
   const client = new Pulsar.Client({
        serviceUrl: 'pulsar://this-will-fail:6650'
   })
   client.createProducer({
        topic: 'persistent://a/b/c',
   }).then(() => {
        console.log('success')
        client.close()
   }).catch((err) => {
        console.log('normal err')
        console.log(err)
        client.close()
   })
   ```
   
   Please note the inclusion of ```client.close()```.
   
   This issue may be closed at the maintainers' leisure.
   Again, I apologize for the trouble.


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


Reply via email to