-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #45] Implement methods from storage-plugin.admin(rocketmq) #55
Closed
Closed
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
51be376
add rocketmqUtils
scwlkq b891623
add RocketmqUtils.java
scwlkq 5ee7786
add RocketmqUtils.java
scwlkq 17892e3
change rocketmqUtils impl from MQAdmin to RemotingClient
scwlkq cfcc41f
fix style
scwlkq 5f76e29
fix style
scwlkq 3a3415c
fix style
scwlkq dc2634c
fix style
scwlkq 6d4a283
fix style
scwlkq 6561d69
fix test style
scwlkq 4b8fb1d
[ISSUE #29] Set up EventMesh Dashboard Front-end (#56)
SLSJL 449b352
modify rocket dependency version
scwlkq 7ebde4b
move classparse to RocketmqUtils.getTopics
scwlkq d523e26
fix style
scwlkq eaf4a3a
Revert "[ISSUE #29] Set up EventMesh Dashboard Front-end (#56)"
scwlkq e2f4c09
refactor TopicProperties
scwlkq 16e7a53
synchronous
scwlkq 50d40b5
try to sync rocketmq related code
scwlkq 31c0117
move classparser to rocketmqUtil
scwlkq e2b6c48
move RocketmqProperties to properties
scwlkq d898abc
[ISSUE #57] Modify the field, synchronize the modification, and add t…
zzxxiansheng 717ff8b
[ISSUE #60] add SDK manager (#62)
Lambert-Rao fa1c716
[ISSUE #64] Support automated deployment and Fix runtime packaging er…
Pil0tXia b33d5b0
move clientManager related to core module && add RocketmqService
scwlkq 6e4ce01
revert application-dev.yml
scwlkq 07f71d5
remove @Service
scwlkq 8ff1297
sync
scwlkq 418c6b7
move clientManager to core module
scwlkq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...-common/src/main/java/org/apache/eventmesh/dashboard/common/model/RocketmqProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.common.model; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class RocketmqProperties { | ||
|
||
private String namesrvAddr; | ||
|
||
private String clusterName; | ||
|
||
private String brokerUrl; | ||
|
||
private String endPoint; | ||
|
||
private int writeQueueNums; | ||
|
||
private int readQueueNums; | ||
|
||
private String accessKey; | ||
|
||
private String secretKey; | ||
|
||
private Long requestTimeoutMillis = 10000L; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
...hboard-common/src/main/java/org/apache/eventmesh/dashboard/common/util/RocketmqUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.common.util; | ||
|
||
import org.apache.eventmesh.dashboard.common.model.TopicProperties; | ||
|
||
import org.apache.rocketmq.common.TopicConfig; | ||
import org.apache.rocketmq.common.protocol.RequestCode; | ||
import org.apache.rocketmq.common.protocol.body.TopicConfigSerializeWrapper; | ||
import org.apache.rocketmq.common.protocol.header.CreateTopicRequestHeader; | ||
import org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader; | ||
import org.apache.rocketmq.remoting.CommandCustomHeader; | ||
import org.apache.rocketmq.remoting.RemotingClient; | ||
import org.apache.rocketmq.remoting.netty.NettyClientConfig; | ||
import org.apache.rocketmq.remoting.netty.NettyRemotingClient; | ||
import org.apache.rocketmq.remoting.protocol.RemotingCommand; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.ConcurrentMap; | ||
|
||
import org.springframework.beans.BeanUtils; | ||
|
||
import lombok.experimental.UtilityClass; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@UtilityClass | ||
public class RocketmqUtils { | ||
|
||
private final RemotingClient remotingClient; | ||
|
||
static { | ||
NettyClientConfig config = new NettyClientConfig(); | ||
config.setUseTLS(false); | ||
remotingClient = new NettyRemotingClient(config); | ||
remotingClient.start(); | ||
} | ||
|
||
|
||
public void createTopic(String topicName, String topicFilterTypeName, int perm, String nameServerAddr, | ||
int readQueueNums, int writeQueueNums, long requestTimeoutMillis) { | ||
try { | ||
CreateTopicRequestHeader requestHeader = new CreateTopicRequestHeader(); | ||
requestHeader.setTopic(topicName); | ||
requestHeader.setTopicFilterType(topicFilterTypeName); | ||
requestHeader.setReadQueueNums(readQueueNums); | ||
requestHeader.setWriteQueueNums(writeQueueNums); | ||
requestHeader.setPerm(perm); | ||
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_TOPIC, requestHeader); | ||
Object result = remotingClient.invokeSync(nameServerAddr, request, requestTimeoutMillis); | ||
log.info("rocketmq create topic result:" + result.toString()); | ||
} catch (Exception e) { | ||
log.error("RocketmqTopicCheck init failed when examining topic stats.", e); | ||
} | ||
} | ||
|
||
public List<TopicProperties> getTopics(String nameServerAddr, long requestTimeoutMillis) { | ||
List<TopicConfig> topicConfigList = new ArrayList<>(); | ||
try { | ||
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, (CommandCustomHeader) null); | ||
RemotingCommand response = remotingClient.invokeSync(nameServerAddr, request, requestTimeoutMillis); | ||
TopicConfigSerializeWrapper allTopicConfig = TopicConfigSerializeWrapper.decode(response.getBody(), TopicConfigSerializeWrapper.class); | ||
ConcurrentMap<String, TopicConfig> topicConfigTable = allTopicConfig.getTopicConfigTable(); | ||
topicConfigList = new ArrayList<>(topicConfigTable.values()); | ||
} catch (Exception e) { | ||
log.error("RocketmqTopicCheck init failed when examining topic stats.", e); | ||
} | ||
|
||
return topicConfig2TopicProperties(topicConfigList); | ||
} | ||
|
||
public void deleteTopic(String topicName, String nameServerAddr, long requestTimeoutMillis) { | ||
try { | ||
DeleteTopicRequestHeader deleteTopicRequestHeader = new DeleteTopicRequestHeader(); | ||
deleteTopicRequestHeader.setTopic(topicName); | ||
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_NAMESRV, null); | ||
Object result = remotingClient.invokeSync(nameServerAddr, request, requestTimeoutMillis); | ||
|
||
log.info("rocketmq delete topic result:" + result.toString()); | ||
} catch (Exception e) { | ||
log.error("RocketmqTopicCheck init failed when examining topic stats.", e); | ||
} | ||
} | ||
|
||
private List<TopicProperties> topicConfig2TopicProperties(List<TopicConfig> topicConfigList) { | ||
ArrayList<TopicProperties> topicPropertiesList = new ArrayList<>(); | ||
for (TopicConfig topicConfig : topicConfigList) { | ||
TopicProperties topicProperties = new TopicProperties(); | ||
BeanUtils.copyProperties(topicConfig, topicProperties); | ||
topicPropertiesList.add(topicProperties); | ||
} | ||
return topicPropertiesList; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to add these fields in a dto?