This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new a81f97973 fix(group): apply the requested delivery order type when a 
group is updated (#5950)
a81f97973 is described below

commit a81f97973a115be08b0ea35c94b65248148dd535
Author: 烤化の初雪 <[email protected]>
AuthorDate: Fri Nov 27 12:16:32 2026 +0800

    fix(group): apply the requested delivery order type when a group is updated 
(#5950)
---
 .../provider/apache/RocketMQAdminClientImpl.java   | 10 +++++
 .../apache/RocketMQAdminClientImplTest.java        | 52 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git 
a/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImpl.java
 
b/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImpl.java
index 1e5c400cc..b46f537be 100644
--- 
a/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImpl.java
+++ 
b/server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImpl.java
@@ -776,16 +776,26 @@ public class RocketMQAdminClientImpl implements 
AdminClient {
                     }
                     configs.put(addr, config);
                 }
+                // The same request field the create path applies to the 
broker: a plan that offers to
+                // switch ordered consumption has to reach 
consumeMessageOrderly, or the update is a
+                // silent no-op for that field. An absent value keeps the 
broker's own flag.
+                boolean deliveryOrderTypeRequested = 
StringUtils.hasText(group.getDeliveryOrderType());
+                boolean consumeMessageOrderly = 
isOrderlyDelivery(group.getDeliveryOrderType());
                 for (Map.Entry<String, SubscriptionGroupConfig> entry : 
configs.entrySet()) {
                     // Preserve each broker's other settings; zero is an 
explicit retry limit.
                     SubscriptionGroupConfig config = entry.getValue();
                     config.setRetryMaxTimes(group.getRetryMaxTimes());
+                    if (deliveryOrderTypeRequested) {
+                        config.setConsumeMessageOrderly(consumeMessageOrderly);
+                    }
                     
admin.createAndUpdateSubscriptionGroupConfig(entry.getKey(), config);
                     updatedBrokers++;
                 }
 
                 persistConsumerGroup(group, clusterName, domain, 
group.getRetryMaxTimes());
                 recordAudit("UPDATE_GROUP", groupName, "retryMaxTimes=" + 
group.getRetryMaxTimes()
+                        + ", consumeMessageOrderly=" + 
(deliveryOrderTypeRequested
+                                ? Boolean.toString(consumeMessageOrderly) : 
"unchanged")
                         + ", brokersUpdated=" + updatedBrokers + "/" + 
totalBrokers, "SUCCESS");
                 return group;
             } catch (BusinessException e) {
diff --git 
a/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImplTest.java
 
b/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImplTest.java
index b8ba62a66..6f5c2ab6b 100644
--- 
a/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImplTest.java
+++ 
b/server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImplTest.java
@@ -1744,6 +1744,58 @@ class RocketMQAdminClientImplTest {
                 org.mockito.ArgumentMatchers.contains("retryMaxTimes=" + 
retryMaxTimes), eq("SUCCESS"));
     }
 
+    @Test
+    void updateConsumerGroupAppliesTheRequestedDeliveryOrderTypeTest() throws 
Exception {
+        TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new 
MybatisConfiguration(), ""), RmqGroup.class);
+        
when(adminExt.examineBrokerClusterInfo()).thenReturn(clusterInfoWithMaster());
+        SubscriptionGroupConfig existing = new SubscriptionGroupConfig();
+        existing.setGroupName("cg-orders");
+        existing.setConsumeMessageOrderly(false);
+        when(adminExt.examineSubscriptionGroupConfig("10.0.0.1:10911", 
"cg-orders")).thenReturn(existing);
+        RmqGroup entity = new RmqGroup();
+        entity.setId(7L);
+        when(groupMapper.selectOne(any())).thenReturn(entity);
+
+        ConsumerGroupVO group = new ConsumerGroupVO();
+        group.setInstanceId("instance-a");
+        group.setName("cg-orders");
+        group.setRetryMaxTimes(16);
+        // The ordered spelling the create form and the AI tool contract 
submit for this field.
+        group.setDeliveryOrderType("MESSAGES_ORDER");
+
+        adminClient.updateConsumerGroup(group);
+
+        ArgumentCaptor<SubscriptionGroupConfig> written = 
ArgumentCaptor.forClass(SubscriptionGroupConfig.class);
+        
verify(adminExt).createAndUpdateSubscriptionGroupConfig(eq("10.0.0.1:10911"), 
written.capture());
+        // The plan offered the switch, so the update has to reach 
consumeMessageOrderly instead of
+        // reporting success for a field it never wrote.
+        assertThat(written.getValue().isConsumeMessageOrderly()).isTrue();
+    }
+
+    @Test
+    void 
updateConsumerGroupKeepsTheBrokerFlagWhenNoDeliveryOrderTypeIsRequestedTest() 
throws Exception {
+        TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new 
MybatisConfiguration(), ""), RmqGroup.class);
+        
when(adminExt.examineBrokerClusterInfo()).thenReturn(clusterInfoWithMaster());
+        SubscriptionGroupConfig existing = new SubscriptionGroupConfig();
+        existing.setGroupName("cg-orders");
+        existing.setConsumeMessageOrderly(true);
+        when(adminExt.examineSubscriptionGroupConfig("10.0.0.1:10911", 
"cg-orders")).thenReturn(existing);
+        RmqGroup entity = new RmqGroup();
+        entity.setId(7L);
+        when(groupMapper.selectOne(any())).thenReturn(entity);
+
+        ConsumerGroupVO group = new ConsumerGroupVO();
+        group.setInstanceId("instance-a");
+        group.setName("cg-orders");
+        group.setRetryMaxTimes(16);
+
+        adminClient.updateConsumerGroup(group);
+
+        ArgumentCaptor<SubscriptionGroupConfig> written = 
ArgumentCaptor.forClass(SubscriptionGroupConfig.class);
+        
verify(adminExt).createAndUpdateSubscriptionGroupConfig(eq("10.0.0.1:10911"), 
written.capture());
+        assertThat(written.getValue().isConsumeMessageOrderly()).isTrue();
+    }
+
     @ParameterizedTest
     @ValueSource(strings = {"missing", "unavailable"})
     void updateConsumerGroupReadsAllConfigurationsBeforeWriting(String 
failure) throws Exception {

Reply via email to