Skip to content

fix(studio): make message provider fail explicitly instead of returning empty stub results - #751

Closed
123123213weqw wants to merge 1 commit into
apache:rocketmq-studiofrom
123123213weqw:fix/684-message-provider-not-implemented
Closed

fix(studio): make message provider fail explicitly instead of returning empty stub results#751
123123213weqw wants to merge 1 commit into
apache:rocketmq-studiofrom
123123213weqw:fix/684-message-provider-not-implemented

Conversation

@123123213weqw

Copy link
Copy Markdown

Fixes #684

Problem

MessageProviderStub is wired as the production MessageProvider, but queryMessages returns an empty list and getMessageTrace returns an empty trace. A successful empty response can mislead operators into thinking no message or trace exists, when in fact no real provider is connected.

Fix

Until a real message provider is connected, both operations now fail explicitly with a structured 501 Not Implemented BusinessException (mapped by GlobalExceptionHandler to a clean Result.error(501, ...)), matching the issue's expected behavior. Added MessageProviderStubTest.

Verification

mvn test -Dtest=MessageProviderStubTest on JDK 21: Tests run: 2, Failures: 0, Errors: 0, Skipped: 0.

Diff

2 files changed, +56 / -10.

…ng empty stub results

MessageProviderStub was wired as the production MessageProvider but returned
an empty list from queryMessages and an empty trace from getMessageTrace,
which could mislead operators into thinking no message or trace exists.

Until a real message provider is connected, both operations now fail
explicitly with a structured 501 Not Implemented BusinessException.
Added MessageProviderStubTest for the new behavior.

Fixes apache#684
@lizhimins

Copy link
Copy Markdown
Member

Thanks for the contribution. This is already covered by #685, merged into rocketmq-studio as 02e7bed: MessageProviderStub.queryMessages and getMessageTrace now both throw BusinessException(501, ...) instead of returning empty results, and MessageProviderStubTest asserts the 501 behaviour. #685 was opened first, so it was merged under first-come-first-served review order.

Two details from your version were not carried over, and a small follow-up PR would be welcome if you think they are worth it: per-method messages (Message query ... vs Message trace ...) instead of one shared message, and the class-level Javadoc explaining why empty results are misleading. Please keep the @Slf4j warn logs, though — they are useful when diagnosing a deployment that still runs the stub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants