All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redismq.server.controller.ConsumerController Maven / Gradle / Ivy

package com.redismq.server.controller;

import com.redismq.common.connection.RedisMQClientUtil;
import com.redismq.common.pojo.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;


@RestController
@RequestMapping("/consumer")
public class ConsumerController {
    
    @Autowired
    private RedisMQClientUtil redisMQClientUtil;
    
    /**
     * 消费者客户端列表
     */
    @GetMapping("list")
    public ResponseEntity> list() {
        List clientsWithTime = redisMQClientUtil.getAllClients();
        
        return ResponseEntity.ok(clientsWithTime);
    }
    
    /**
     * 强制下线客户端 还没做拉黑,就算下线了该客户端还会自动注册
     */
    @GetMapping("down")
    public void down(Client client) {
        redisMQClientUtil.removeClient(client);
    }
    
    /**
     * 强制所有消费者重平衡 TODO前端未接入
     */
    @PutMapping("rebalance")
    public void rebalance(String groupId) {
        redisMQClientUtil.publishRebalance(groupId,"redisMQAdminClient");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy