This commit is contained in:
nvac
2024-04-10 15:57:16 +08:00
committed by GitHub
5 changed files with 66 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ public class TopicConfigInfo {
private List<String> clusterNameList; private List<String> clusterNameList;
private List<String> brokerNameList; private List<String> brokerNameList;
private String messageType;
/** topicConfig */ /** topicConfig */
private String topicName; private String topicName;
@@ -91,6 +92,14 @@ public class TopicConfigInfo {
this.order = order; this.order = order;
} }
public String getMessageType() {
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@@ -18,6 +18,7 @@
package org.apache.rocketmq.dashboard.service.impl; package org.apache.rocketmq.dashboard.service.impl;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -30,6 +31,7 @@ import org.apache.rocketmq.client.trace.TraceContext;
import org.apache.rocketmq.client.trace.TraceDispatcher; import org.apache.rocketmq.client.trace.TraceDispatcher;
import org.apache.rocketmq.common.MixAll; import org.apache.rocketmq.common.MixAll;
import org.apache.rocketmq.common.TopicConfig; import org.apache.rocketmq.common.TopicConfig;
import org.apache.rocketmq.common.attribute.TopicMessageType;
import org.apache.rocketmq.remoting.protocol.admin.TopicStatsTable; import org.apache.rocketmq.remoting.protocol.admin.TopicStatsTable;
import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.protocol.body.ClusterInfo; import org.apache.rocketmq.remoting.protocol.body.ClusterInfo;
@@ -56,6 +58,8 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import static org.apache.rocketmq.common.TopicAttributes.TOPIC_MESSAGE_TYPE_ATTRIBUTE;
@Service @Service
public class TopicServiceImpl extends AbstractCommonService implements TopicService { public class TopicServiceImpl extends AbstractCommonService implements TopicService {
@@ -123,6 +127,13 @@ public class TopicServiceImpl extends AbstractCommonService implements TopicServ
public void createOrUpdate(TopicConfigInfo topicCreateOrUpdateRequest) { public void createOrUpdate(TopicConfigInfo topicCreateOrUpdateRequest) {
TopicConfig topicConfig = new TopicConfig(); TopicConfig topicConfig = new TopicConfig();
BeanUtils.copyProperties(topicCreateOrUpdateRequest, topicConfig); BeanUtils.copyProperties(topicCreateOrUpdateRequest, topicConfig);
String messageType = topicCreateOrUpdateRequest.getMessageType();
if (StringUtils.isBlank(messageType)) {
messageType = TopicMessageType.UNSPECIFIED.name();
}
topicConfig.setAttributes(ImmutableMap.of("+".concat(TOPIC_MESSAGE_TYPE_ATTRIBUTE.getName()), messageType));
try { try {
ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
for (String brokerName : changeToBrokerNameSet(clusterInfo.getClusterAddrTable(), for (String brokerName : changeToBrokerNameSet(clusterInfo.getClusterAddrTable(),
@@ -156,6 +167,13 @@ public class TopicServiceImpl extends AbstractCommonService implements TopicServ
TopicConfig topicConfig = examineTopicConfig(topic, brokerData.getBrokerName()); TopicConfig topicConfig = examineTopicConfig(topic, brokerData.getBrokerName());
BeanUtils.copyProperties(topicConfig, topicConfigInfo); BeanUtils.copyProperties(topicConfig, topicConfigInfo);
topicConfigInfo.setBrokerNameList(Lists.newArrayList(brokerData.getBrokerName())); topicConfigInfo.setBrokerNameList(Lists.newArrayList(brokerData.getBrokerName()));
String messageType = topicConfig.getAttributes().get(TOPIC_MESSAGE_TYPE_ATTRIBUTE.getName());
if (StringUtils.isBlank(messageType)) {
messageType = TopicMessageType.UNSPECIFIED.name();
}
topicConfigInfo.setMessageType(messageType);
topicConfigInfoList.add(topicConfigInfo); topicConfigInfoList.add(topicConfigInfo);
} }
return topicConfigInfoList; return topicConfigInfoList;

View File

@@ -84,6 +84,12 @@ var en = {
"READ_QUEUE_NUMS":"readQueueNums", "READ_QUEUE_NUMS":"readQueueNums",
"WRITE_QUEUE_NUMS":"writeQueueNums", "WRITE_QUEUE_NUMS":"writeQueueNums",
"PERM":"perm", "PERM":"perm",
"MESSAGE_TYPE":"messageType",
"MESSAGE_TYPE_UNSPECIFIED": "UNSPECIFIED",
"MESSAGE_TYPE_NORMAL": "NORMAL",
"MESSAGE_TYPE_FIFO": "FIFO",
"MESSAGE_TYPE_DELAY": "DELAY",
"MESSAGE_TYPE_TRANSACTION": "TRANSACTION",
"TAG":"Tag", "TAG":"Tag",
"KEY":"Key", "KEY":"Key",
"MESSAGE_BODY":"Message Body", "MESSAGE_BODY":"Message Body",

View File

@@ -85,6 +85,12 @@ var zh = {
"READ_QUEUE_NUMS":"读队列数量", "READ_QUEUE_NUMS":"读队列数量",
"WRITE_QUEUE_NUMS":"写队列数量", "WRITE_QUEUE_NUMS":"写队列数量",
"PERM":"perm", "PERM":"perm",
"MESSAGE_TYPE":"消息类型",
"MESSAGE_TYPE_UNSPECIFIED": "未指定",
"MESSAGE_TYPE_NORMAL": "普通消息",
"MESSAGE_TYPE_FIFO": "顺序消息",
"MESSAGE_TYPE_DELAY": "定时/延时消息",
"MESSAGE_TYPE_TRANSACTION": "事务消息",
"TAG":"标签", "TAG":"标签",
"KEY":"值", "KEY":"值",
"MESSAGE_BODY":"消息主体", "MESSAGE_BODY":"消息主体",

View File

@@ -213,6 +213,33 @@
<span class="text-danger" ng-show="addAppForm.perm.$error.required">{{'PERM'|translate}}不能为空.</span> <span class="text-danger" ng-show="addAppForm.perm.$error.required">{{'PERM'|translate}}不能为空.</span>
</div> </div>
</div> </div>
<div class="form-group">
<label class="control-label col-sm-2" style="margin: 0 !important;">{{'MESSAGE_TYPE'|translate}}:</label>
<div class="col-sm-10">
<form name="messageType">
<label>
<input type="radio" ng-model="item.messageType" value="UNSPECIFIED" ng-disabled="{{!ngDialogData.writeOperationEnabled}}"/>
{{'MESSAGE_TYPE_UNSPECIFIED'|translate}}
</label>&nbsp;
<label>
<input type="radio" ng-model="item.messageType" value="NORMAL" ng-disabled="{{!ngDialogData.writeOperationEnabled}}"/>
{{'MESSAGE_TYPE_NORMAL'|translate}}
</label>&nbsp;
<label>
<input type="radio" ng-model="item.messageType" value="FIFO" ng-disabled="{{!ngDialogData.writeOperationEnabled}}"/>
{{'MESSAGE_TYPE_FIFO'|translate}}
</label>&nbsp;
<label>
<input type="radio" ng-model="item.messageType" value="DELAY" ng-disabled="{{!ngDialogData.writeOperationEnabled}}"/>
{{'MESSAGE_TYPE_DELAY'|translate}}
</label>&nbsp;
<label>
<input type="radio" ng-model="item.messageType" value="TRANSACTION" ng-disabled="{{!ngDialogData.writeOperationEnabled}}"/>
{{'MESSAGE_TYPE_TRANSACTION'|translate}}
</label>
</form>
</div>
</div>
</form> </form>
<div class="modal-footer"> <div class="modal-footer">
<div class="ngdialog-buttons"> <div class="ngdialog-buttons">