com.alibaba.rocketmq.remoting.RemotingClient Java Examples

The following examples show how to use com.alibaba.rocketmq.remoting.RemotingClient. 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: MQAdminExtImpl.java    From rocket-console with Apache License 2.0 6 votes vote down vote up
@Override
public TopicConfig examineTopicConfig(String addr, String topic) {
    RemotingClient remotingClient = MQAdminInstance.threadLocalRemotingClient();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);
    RemotingCommand response = null;
    try {
        response = remotingClient.invokeSync(addr, request, 3000);
    } catch (Exception err) {
        throw Throwables.propagate(err);
    }
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            TopicConfigSerializeWrapper topicConfigSerializeWrapper = decode(response.getBody(), TopicConfigSerializeWrapper.class);
            return topicConfigSerializeWrapper.getTopicConfigTable().get(topic);
        }
        default:
            throw Throwables.propagate(new MQBrokerException(response.getCode(), response.getRemark()));
    }
}
 
Example #2
Source File: MQAdminInstance.java    From rocket-console with Apache License 2.0 5 votes vote down vote up
/**
 * 使用反射获取到DefaultMQAdminExt中的RemotingCommand
 *
 * @return
 */
public static RemotingClient threadLocalRemotingClient() {
    DefaultMQAdminExtImpl defaultMQAdminExtImpl = Reflect.on(MQAdminInstance.threadLocalMQAdminExt()).get("defaultMQAdminExtImpl");
    MQClientInstance mqClientInstance = Reflect.on(defaultMQAdminExtImpl).get("mqClientInstance");
    MQClientAPIImpl mQClientAPIImpl = Reflect.on(mqClientInstance).get("mQClientAPIImpl");
    return Reflect.on(mQClientAPIImpl).get("remotingClient");
}
 
Example #3
Source File: MQClientAPIImpl.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
public RemotingClient getRemotingClient() {
    return remotingClient;
}
 
Example #4
Source File: MQClientAPIImpl.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public RemotingClient getRemotingClient() {
    return remotingClient;
}
 
Example #5
Source File: MQClientAPIImpl.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
public RemotingClient getRemotingClient() {
    return remotingClient;
}