f1amingo opened a new pull request, #1496: URL: https://github.com/apache/rocketmq-clients/pull/1496
### Summary The Node.js client accepted invalid options that the Java client rejects at build time: blank topics were silently dropped, invalid `maxAttempts` / `awaitDuration`, missing listeners and empty subscriptions only failed later or never, and blank message keys or properties were sent as is. This PR validates them up front with a `TypeError`, matching the Java client. Public API signatures are unchanged. ### Changes - `BaseClient`: `topics` must be an array of non-empty strings (blank topics now throw instead of being ignored). - `Producer`: `maxAttempts` must be a positive integer. - `PushConsumer`: the listener must provide `consume()`, and `subscriptions` must be a non-empty `Map`. - `SimpleConsumer`: `awaitDuration` must be positive and finite, and `subscriptions` must be a non-empty `Map`. - `Message`: `keys` must be an array without blank keys; `properties` must be a `Map` without blank keys or values. Behavior change: code that relied on blank topics being ignored, on constructing a consumer with empty subscriptions, or on blank keys/property values will now fail fast. ### How Did You Test This Change? - New unit tests in `test/client/OptionsValidation.test.ts` (39 cases) cover rejected and accepted inputs. - `npm run lint` and `npm run build` pass; an E2E regression suite against a cloud cluster passes with this change. -- 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]
