Search in sources :

Example 1 with DeleteTopicRequestHeader

use of org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader in project rocketmq by apache.

the class MQClientAPIImpl method deleteTopicInNameServer.

public void deleteTopicInNameServer(final String addr, final String topic, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    DeleteTopicRequestHeader requestHeader = new DeleteTopicRequestHeader();
    requestHeader.setTopic(topic);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_NAMESRV, requestHeader);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    assert response != null;
    switch(response.getCode()) {
        case ResponseCode.SUCCESS:
            {
                return;
            }
        default:
            break;
    }
    throw new MQClientException(response.getCode(), response.getRemark());
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) DeleteTopicRequestHeader(org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader) MQClientException(org.apache.rocketmq.client.exception.MQClientException)

Example 2 with DeleteTopicRequestHeader

use of org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class MQClientAPIImpl method deleteTopicInBroker.

public void deleteTopicInBroker(final String addr, final String topic, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    DeleteTopicRequestHeader requestHeader = new DeleteTopicRequestHeader();
    requestHeader.setTopic(topic);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_BROKER, requestHeader);
    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr), request, timeoutMillis);
    assert response != null;
    switch(response.getCode()) {
        case ResponseCode.SUCCESS:
            {
                return;
            }
        default:
            break;
    }
    throw new MQClientException(response.getCode(), response.getRemark());
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) DeleteTopicRequestHeader(org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader) MQClientException(org.apache.rocketmq.client.exception.MQClientException)

Example 3 with DeleteTopicRequestHeader

use of org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class MQClientAPIImpl method deleteTopicInNameServer.

public void deleteTopicInNameServer(final String addr, final String topic, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    DeleteTopicRequestHeader requestHeader = new DeleteTopicRequestHeader();
    requestHeader.setTopic(topic);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_NAMESRV, requestHeader);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    assert response != null;
    switch(response.getCode()) {
        case ResponseCode.SUCCESS:
            {
                return;
            }
        default:
            break;
    }
    throw new MQClientException(response.getCode(), response.getRemark());
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) DeleteTopicRequestHeader(org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader) MQClientException(org.apache.rocketmq.client.exception.MQClientException)

Example 4 with DeleteTopicRequestHeader

use of org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class AdminBrokerProcessor method deleteTopic.

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;
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) DeleteTopicRequestHeader(org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader)

Example 5 with DeleteTopicRequestHeader

use of org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader in project rocketmq by apache.

the class MQClientAPIImpl method deleteTopicInBroker.

public void deleteTopicInBroker(final String addr, final String topic, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    DeleteTopicRequestHeader requestHeader = new DeleteTopicRequestHeader();
    requestHeader.setTopic(topic);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_BROKER, requestHeader);
    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr), request, timeoutMillis);
    assert response != null;
    switch(response.getCode()) {
        case ResponseCode.SUCCESS:
            {
                return;
            }
        default:
            break;
    }
    throw new MQClientException(response.getCode(), response.getRemark());
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) DeleteTopicRequestHeader(org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader) MQClientException(org.apache.rocketmq.client.exception.MQClientException)

Aggregations

DeleteTopicRequestHeader (org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader)6 RemotingCommand (org.apache.rocketmq.remoting.protocol.RemotingCommand)6 MQClientException (org.apache.rocketmq.client.exception.MQClientException)4