Skip to content

Commit

Permalink
rocketmq禁消费集成测试脚本test-10
Browse files Browse the repository at this point in the history
Signed-off-by: daizhenyu <[email protected]>
  • Loading branch information
daizhenyu committed Jan 12, 2024
1 parent cce9a30 commit ab7e5bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.12" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.12" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,9 @@
<curator.version>4.3.0</curator.version>
<httpclient4x.version>4.5.13</httpclient4x.version>
<comons-log.version>1.2</comons-log.version>
<fastjson.version>2.0.9</fastjson.version>
</properties>

<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public String checkStatus() {
/**
* 消费者初始化参数并启动
*/
@RequestMapping(value = "initAndStart", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@RequestMapping(value = "initAndStart", method = RequestMethod.GET)
public void initAndStart() {
Thread thread = new Thread(() -> {
consumer.setNamesrvAddr(rocketMqAddress);
Expand Down Expand Up @@ -102,7 +102,7 @@ public ConsumeOrderlyStatus consumeMessage(List<MessageExt> messageExts,
* @param topic 订阅的topic
* @throws MQClientException
*/
@RequestMapping(value = "subscribe", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@RequestMapping(value = "subscribe", method = RequestMethod.GET)
public void subscribe(@RequestParam("topic") String topic) throws MQClientException {
consumer.subscribe(topic, RocketMqConstant.TAG_SCOPE);
}
Expand All @@ -111,9 +111,8 @@ public void subscribe(@RequestParam("topic") String topic) throws MQClientExcept
* 消费者取消订阅topic
*
* @param topic 取消订阅的topic
* @throws MQClientException
*/
@RequestMapping(value = "unsubscribe", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@RequestMapping(value = "unsubscribe", method = RequestMethod.GET)
public void unsubscribe(@RequestParam("topic") String topic) {
consumer.unsubscribe(topic);
}
Expand All @@ -124,10 +123,10 @@ public void unsubscribe(@RequestParam("topic") String topic) {
* @param topic 订阅的topic
* @param group 消费者组
* @return 消费者实例id数量
* @throws MQClientException
*/
@RequestMapping(value = "consumerIdList", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@RequestMapping(value = "consumerIdList", method = RequestMethod.GET)
public int getConsumerIdList(@RequestParam("topic") String topic, @RequestParam("group") String group) {
System.out.println("查询消费者列表");
List<String> consumerIdList = consumer.getDefaultMQPushConsumerImpl().getmQClientFactory()
.findConsumerIdList(topic, group);
if (consumerIdList == null) {
Expand Down

0 comments on commit ab7e5bc

Please sign in to comment.