RobertIndie opened a new pull request, #319: URL: https://github.com/apache/pulsar-client-node/pull/319
## Motivation Currently, there is no error handling for the message listener. If any errors are thrown from the user's listener, the program will crash. ## Modification * Add error handling for the message listener. The client won't crash the program if there are any errors in the user function. Instead, it will log as the error. * Add LogUtils to the internal native code. * Add `GetTopic` and `GetSubscriptionName` for the internal native consumer. <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- ### Contribution Checklist - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*. - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review. - Each pull request should address only one issue, not mix up code from multiple issues. - Each commit in the pull request has a meaningful commit message - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below. --> ### Motivation Currently, there is no error handling for the message listener. The program will crash if any errors are thrown from the user's listener. ### Modifications * Add error handling for the message listener. The client won't crash the program if there are any errors in the user function. Instead, it will log as the error. * Add LogUtils to the internal native code. * Add `GetTopic` and `GetSubscriptionName` for the internal native consumer. ### Verifying this change This change added tests. The log will be like ``` [ERROR][../src/Consumer.cc:72] [persistent://public/default/node-test-11][sub] Message listener error in processing message: some error ``` ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc-required` (Your PR needs to update docs and you will update later) - [x] `doc-not-needed` (Please explain why) - [ ] `doc` (Your PR contains doc changes) - [ ] `doc-complete` (Docs have been already added) -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org