org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader Java Examples

The following examples show how to use org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdminBrokerProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private RemotingCommand deleteTopic(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    DeleteTopicRequestHeader requestHeader =
        (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

    log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

    this.brokerController.getTopicConfigManager().deleteTopicConfig(requestHeader.getTopic());
    this.brokerController.getMessageStore()
        .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #2
Source File: AdminBrokerProcessor.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
private synchronized RemotingCommand deleteTopic(ChannelHandlerContext ctx,
        RemotingCommand request) throws RemotingCommandException {
        final RemotingCommand response = RemotingCommand.createResponseCommand(null);
        DeleteTopicRequestHeader requestHeader =
            (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

        log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

//        删除topic=》
        this.brokerController.getTopicConfigManager().deleteTopicConfig(requestHeader.getTopic());
//        删除客户端消息队列中的无用的topic=》
        this.brokerController.getMessageStore()
            .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());

        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);
        return response;
    }
 
Example #3
Source File: AdminBrokerProcessor.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
/**
 * 删除Broker中的topic
 * @param ctx ;
 * @param request ;
 * @return ;
 * @throws RemotingCommandException ;
 */
private synchronized RemotingCommand deleteTopic(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {

    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    DeleteTopicRequestHeader requestHeader =
        (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

    log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

    this.brokerController.getTopicConfigManager().deleteTopicConfig(requestHeader.getTopic());
    this.brokerController.getMessageStore()
        .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #4
Source File: AdminBrokerProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private RemotingCommand deleteTopic(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    DeleteTopicRequestHeader requestHeader =
        (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

    log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

    this.brokerController.getTopicConfigManager().deleteTopicConfig(requestHeader.getTopic());
    this.brokerController.getMessageStore()
        .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #5
Source File: AdminBrokerProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private synchronized RemotingCommand deleteTopic(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    DeleteTopicRequestHeader requestHeader =
        (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

    log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

    String topic = requestHeader.getTopic();
    if (!TopicValidator.validateTopic(topic, response)) {
        return response;
    }
    if (TopicValidator.isSystemTopic(topic, response)) {
        return response;
    }

    this.brokerController.getTopicConfigManager().deleteTopicConfig(topic);
    this.brokerController.getMessageStore()
        .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());
    if (this.brokerController.getBrokerConfig().isAutoDeleteUnusedStats()) {
        this.brokerController.getBrokerStatsManager().onTopicDeleted(requestHeader.getTopic());
    }
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #6
Source File: AdminBrokerProcessor.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private RemotingCommand deleteTopic(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    DeleteTopicRequestHeader requestHeader =
        (DeleteTopicRequestHeader)request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

    log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

    this.brokerController.getTopicConfigManager().deleteTopicConfig(requestHeader.getTopic());
    this.brokerController.getMessageStore()
        .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #7
Source File: AdminBrokerProcessor.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
private RemotingCommand deleteTopic(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    DeleteTopicRequestHeader requestHeader =
        (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);

    log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));

    this.brokerController.getTopicConfigManager().deleteTopicConfig(requestHeader.getTopic());
    this.brokerController.getMessageStore()
        .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #8
Source File: AdminBrokerProcessorTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private RemotingCommand buildDeleteTopicRequest(String topic) {
    DeleteTopicRequestHeader requestHeader = new DeleteTopicRequestHeader();
    requestHeader.setTopic(topic);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_BROKER, requestHeader);
    request.makeCustomHeaderToNet();
    return request;
}