Skip to content

fix: implement requester-side deduplication of reply messages by repl…#38

Merged
helios57 merged 1 commit intomasterfrom
feature/duplicated-responses
Feb 6, 2026
Merged

fix: implement requester-side deduplication of reply messages by repl…#38
helios57 merged 1 commit intomasterfrom
feature/duplicated-responses

Conversation

@helios57
Copy link
Collaborator

@helios57 helios57 commented Feb 5, 2026

[…yIndex](fix: implement requester-side deduplication of reply messages by replyIndex)

@helios57 helios57 self-assigned this Feb 5, 2026
@helios57 helios57 added the bug Something isn't working label Feb 5, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements requester-side deduplication of reply messages to handle duplicate replies that may occur during operational scenarios such as broker updates or reconnections.

Changes:

  • Added deduplication logic that tracks received replyIndex values per request to ignore duplicate replies
  • Fixed timestamp initialization issues in test classes (milliseconds vs seconds)
  • Added test coverage for the deduplication behavior

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/community/solace/spring/cloud/requestreply/service/ResponseHandler.java Added per-request deduplication tracking using receivedIndices set and cleanup logic
src/main/java/community/solace/spring/cloud/requestreply/service/RequestReplyServiceImpl.java Integrated deduplication check in onReplyReceived and fixed grouped message content-type handling
src/main/java/community/solace/spring/cloud/requestreply/service/header/RequestReplyMessageHeaderSupportService.java Added getReplyIndex method to extract reply index from messages
src/main/java/community/solace/spring/cloud/requestreply/service/header/parser/SpringHeaderParser.java Implemented MessageHeaderReplyIndexParser interface with getReplyIndex method
src/main/java/community/solace/spring/cloud/requestreply/service/header/parser/replyindex/MessageReplyIndexParser.java New interface for parsing reply index from messages
src/main/java/community/solace/spring/cloud/requestreply/service/header/parser/replyindex/MessageHeaderReplyIndexParser.java New interface extending MessageReplyIndexParser for header-based parsing
src/test/java/community/solace/spring/cloud/requestreply/service/TestSdtStreamSupport.java New test helper for building SDTStream payloads
src/test/java/community/solace/spring/cloud/requestreply/service/RequestReplySimpleServiceTests.java Added deduplication test and updated existing tests to use grouped messages
src/test/java/community/solace/spring/cloud/requestreply/model/SensorReading.java Made fields mutable and added Jackson annotations for JSON deserialization
src/test/java/community/solace/spring/cloud/requestreply/AbstractRequestReplySimpleIT.java Fixed timestamp values and changed method visibility
src/test/java/community/solace/spring/cloud/requestreply/AbstractRequestReplyMessageInterceptorIT.java Fixed timestamp values and changed method visibility
src/test/java/community/solace/spring/cloud/requestreply/AbstractRequestReplyLoggingIT.java Fixed timestamp values and changed method visibility
README.md Added documentation explaining deduplication behavior and memory management
CHANGELOG.md Added entry for version 5.3.5 documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@helios57 helios57 force-pushed the feature/duplicated-responses branch from 3024c0c to 56da615 Compare February 5, 2026 17:05
@helios57 helios57 requested a review from Copilot February 5, 2026 17:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@helios57 helios57 force-pushed the feature/duplicated-responses branch 2 times, most recently from 5896e02 to 27cf4a9 Compare February 6, 2026 12:01
…yIndex

To prevent corrupt results when replies are duplicated (e.g. after broker disconnect/reconnect), the requester now deduplicates reply messages using the `replyIndex` header.

Changes:
- `ResponseHandler`: Implements deduplication logic using a `BitSet`. Supports both single and range indices.
- `RequestReplyServiceImpl`: Integrates duplicate checking and fixes `CONTENT_TYPE` restoration for grouped SDTStream messages.
- Configuration: Adds `spring.cloud.stream.requestreply.dedup.maxBitsWhenUnknown` (default 100,000) to limit memory usage when `totalReplies` is unknown.
- Headers: Adds `MessageReplyIndexParser` infrastructure to extract `replyIndex`.
- Tests: Fixes timestamp initialization to use milliseconds and adds deduplication scenarios.
- Docs: Updates CHANGELOG and README for version 5.3.5.
@helios57 helios57 force-pushed the feature/duplicated-responses branch from 27cf4a9 to ffba321 Compare February 6, 2026 14:48
@helios57 helios57 merged commit 3f1bbf3 into master Feb 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants