unbridled-41 opened a new pull request, #3991:
URL: https://github.com/apache/rocketmq-dashboard/pull/3991

   Related to #3990.
   
   ## Problem / Evidence
   
   The Apache consumer group settings editor (`GET/POST 
/api/groups/{name}/settings`, added for #2512) exposes only `retryQueueNums` 
and `retryMaxTimes` of the broker `SubscriptionGroupConfig`. The consumption 
switches that the same config carries — `consumeEnable`, 
`consumeMessageOrderly`, `consumeBroadcastEnable` — cannot be viewed or changed 
anywhere in Studio:
   
   - `web/src/api/metadata.ts`: `ConsumerGroupSettings` had exactly `groupName 
/ retryQueueNums / retryMaxTimes`; the settings tab in 
`web/src/pages/instance/consumer.tsx` rendered two numeric inputs.
   - `server/.../provider/apache/RocketMQAdminClientImpl.java`: 
`updateConsumerGroupSettings` set only the two retry fields before 
`createAndUpdateSubscriptionGroupConfig`.
   - The classic dashboard (previous generation in this repository, 
`frontend-new/src/components/consumer/ConsumerConfigItem.jsx` on the `master` 
branch) edits all of these switches through the same broker API 
(`/consumer/createOrUpdate.do`). In Studio they require external tooling 
(`mqadmin updateSubGroup` per broker).
   
   Issue #2512 scoped the first slice to the two retry fields; it never 
excluded the remaining config fields, and its contract — read the effective 
config, update every master broker, preserve unrelated fields, audit the change 
— is exactly the mechanism this PR extends.
   
   ## What was added
   
   - `ConsumerGroupSettingsVO` now carries `consumeEnable`, 
`consumeMessageOrderly`, `consumeBroadcastEnable` (read from the effective 
broker config).
   - `UpdateConsumerGroupSettingsDTO` accepts the three switches as optional 
booleans; an omitted switch preserves the current broker value (same 
partial-update contract the endpoint already follows for unrelated fields).
   - `AdminClient` / `RocketMQAdminClientImpl` / `MetadataService` / 
`ConsumerGroupController` pass the switches through; the audit record now lists 
the resulting switch values.
   - The consumer detail modal settings tab renders three `Switch` controls 
(启用消费 / 顺序消费 / 广播消费) next to the retry inputs, initialized from the GET 
response.
   - Cloud instances remain unsupported for this editor: the 
`requireApacheInstance` gate in `MetadataService` is unchanged.
   
   ## Priority & scoring
   
   FEATURE_PRIORITY = 项目需求 32 + 外部实现成熟度 26 + 项目契合度 17 + 可测试性 9 = **84**. The 
classic dashboard ships this editing capability on the same broker API 
(external maturity), the write path already exists and is Apache-gated (fit), 
and the behavior is fully covered by unit/controller/UI tests (testability). 
IMPLEMENTATION_CONFIDENCE: 84 — additive, single Apache-only code path, no 
schema or breaking API change.
   
   ## Tests (actual commands and results)
   
   New tests, red first:
   
   - `updateConsumerGroupSettingsAppliesConsumptionSwitches` and 
`getConsumerGroupSettingsReturnsConsumptionSwitches` 
(`RocketMQAdminClientImplTest`): switches are written to the broker config and 
returned by the read path; omitted switches preserve existing values.
   - `consumerGroupSettingsUpdateShouldForwardConsumptionSwitches` 
(`ConsumerGroupControllerTest`): the controller forwards the switches and 
returns them.
   - `edits consumption switches from the detail modal settings tab` 
(`ConsumerPage.test.tsx`): switches render with broker values and the save 
payload includes them.
   
   Red evidence (implementation stashed, tests kept):
   
   - Server: `mvn test-compile` → 9 compilation errors, e.g. `method 
updateConsumerGroupSettings ... cannot be applied to given types` (×5) and 
`cannot find symbol: method consumeEnable(boolean)` (×2).
   - Web: `npx vitest run src/pages/instance/__tests__/ConsumerPage.test.tsx -t 
"consumption switches"` → `TestingLibraryElementError: Unable to find 
role="switch" and name "启用消费"`.
   
   Green:
   
   - `mvn -ntp test 
-Dtest='RocketMQAdminClientImplTest,ConsumerGroupControllerTest,MetadataServiceTest'`
 → **Tests run: 100, Failures: 0, Errors: 0**.
   - Full backend `mvn -ntp clean test` → **Tests run: 2038, Failures: 4**. The 
4 failures are the pre-existing baseline set, identical to the pristine 
`rocketmq-studio` baseline (36126024): `AuthCorsIntegrationTest` ×2, 
`AliyunInstanceProviderTest.getGroupProgressShouldMapLagRowsTest`, plus the 
known load-fragile 
`OpenAiCompatibleLlmGatewayTest.successfulAndFailedStreamsEmitOneTerminalSequence`
 (passes 9/9 in isolation). 2038 = baseline 2035 + 3 new tests; zero new 
failures.
   - `npx vitest run src/pages/instance/__tests__/ConsumerPage.test.tsx` → **30 
passed (30)** including the new test.
   - Full web `npx vitest run` → **923 tests, 2 failed** (`ClientsPage` 
search-reset, `ConsumerPage` health diagnostics), both in untouched files and 
both pass in isolation (48/48 for the two files) — the documented load 
fragility of the full suite in this sandbox, not related to this change.
   - `npx tsc -b` clean; `npx eslint` on the three changed web files clean; 
`npm run build` succeeds.
   
   ## Compatibility & Risk
   
   - Additive and backward compatible: existing clients that send only 
`retryQueueNums`/`retryMaxTimes` keep working — omitted switches preserve 
broker values (covered by the updated delegation test passing `null` switches).
   - No database schema change; no new dependency; licenses unchanged (all 
rocketmq client types already in use).
   - Risk: an operator can now disable consumption (or enable 
broadcast/orderly) from the UI. This is the same capability the classic 
dashboard exposes on the same admin API, and the write path already updates 
every master broker and records an audit entry with the resulting values; the 
detail remains gated to Apache instances exactly like the retry fields.
   - Differences from the classic implementation: Studio keeps the 
read-validate-propagate-then-audit flow with per-broker config preservation 
instead of blind form submit, and exposes only the three switches (not the 
broker-id routing pair), keeping the editor aligned with the existing endpoint 
scope.


-- 
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]

Reply via email to