Hanabi9248 opened a new pull request, #18628:
URL: https://github.com/apache/iotdb/pull/18628
## Description
Fixes #18625.
Pass the complete MQTT publication to custom payload formatters so they can
use the client ID, username and QoS alongside the topic and payload.
The new `formatMessage(InterceptPublishMessage)` default method delegates to
`format(String, ByteBuf)`, which retains the existing payload-only fallback.
Existing formatters need no changes. A separate method name also avoids making
existing `format(null)` calls ambiguous. The broker still owns and releases the
payload; the customization guide documents its lifetime.
## Tests
On JDK 25, the 30-module Maven reactor build and all 11 MQTT tests passed:
```sh
mvn -pl external-service-impl/mqtt -am test \
-Dtest=PayloadFormatterContextTest,JSONPayloadFormatterTest,LinePayloadFormatterTest
\
-Dsurefire.failIfNoSpecifiedTests=false
```
The new tests cover payload-only and topic-aware formatters, handler
dispatch, and payload release when a formatter returns or throws. Both handler
tests fail when run against the old handler. Cluster integration tests were not
run.
- [x] Added unit tests and updated the customization guide.
- [x] Added Javadoc for the new callback.
--
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]