pjfanning opened a new pull request, #683:
URL: https://github.com/apache/pekko-connectors-kafka/pull/683
### Motivation
`scaladsl.Consumer.DrainingControl.isShutdown` was a `def`, so every call
chained new `flatMap`/`map` callbacks onto the control and stream-completion
futures.
`javadsl.Consumer.DrainingControl.isShutdown` only forwarded
`control.isShutdown`. It could therefore complete before the stream had
completed, which is different from the scaladsl behaviour.
### Modification
- Make `isShutdown` a `val` in both DSLs.
- Compose the javadsl stage with `streamCompletion`, matching scaladsl.
- In `ControlSpec`, the test `Control` stub's `isShutdown` now returns a
configurable future (failed by default) rather than `???`, because
`DrainingControl` now evaluates it eagerly.
The change is ported from akka/alpakka-kafka#1654, released in Alpakka Kafka
5.0.0. That release's LICENSE has a Change Date of 2026-10-24, after which it
is Apache License 2.0.
### Result
Both DSLs' `isShutdown` return a single shared future/stage. The javadsl
version now completes only once the consumer is shut down and the stream has
completed.
### Tests
- `sbt "tests/Test/testOnly org.apache.pekko.kafka.scaladsl.ControlSpec"`: 7
passed.
- Without the fix, the scaladsl "same isShutdown future" test and the
javadsl "complete isShutdown only after the stream completes" test fail.
- The javadsl same-instance test already passes before the fix and guards
the new `val`.
- `sbt core/mimaReportBinaryIssues`: no issues
- `sbt ++3.3 core/compile`: success
- `scalafmt --mode diff-ref=upstream/main`: run
### References
Refs https://github.com/akka/alpakka-kafka/pull/1654
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]