• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RemotingTimeoutException类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException的典型用法代码示例。如果您正苦于以下问题:Java RemotingTimeoutException类的具体用法?Java RemotingTimeoutException怎么用?Java RemotingTimeoutException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RemotingTimeoutException类属于com.alibaba.rocketmq.remoting.exception包,在下文中一共展示了RemotingTimeoutException类的32个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test_idle_event

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public void test_idle_event() throws InterruptedException, RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException {
    RemotingServer server = createRemotingServer();
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 10; i++) {
        RemotingCommand request = RemotingCommand.createRequestCommand(0, null);
        RemotingCommand response = client.invokeSync("localhost:8888", request, 1000 * 3);
        System.out.println(i + " invoke result = " + response);
        assertTrue(response != null);

        Thread.sleep(1000 * 10);
    }

    Thread.sleep(1000 * 60);

    client.shutdown();
    server.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:21,
代码来源:NettyIdleTest.java

示例2: test_connect_timeout

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Test
public void test_connect_timeout() throws InterruptedException, RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException {
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 100; i++) {
        try {
            RemotingCommand request = RemotingCommand.createRequestCommand(0, null);
            RemotingCommand response = client.invokeSync("localhost:8888", request, 1000 * 3);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    client.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:19,
代码来源:NettyConnectionTest.java

示例3: registerFilterServerToBroker

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public RegisterFilterServerResponseHeader registerFilterServerToBroker(//
        final String brokerAddr,// 1
        final String filterServerAddr// 2
) throws RemotingCommandException, RemotingConnectException, RemotingSendRequestException,
        RemotingTimeoutException, InterruptedException, MQBrokerException {
    RegisterFilterServerRequestHeader requestHeader = new RegisterFilterServerRequestHeader();
    requestHeader.setFilterServerAddr(filterServerAddr);
    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.REGISTER_FILTER_SERVER, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(brokerAddr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        RegisterFilterServerResponseHeader responseHeader =
                (RegisterFilterServerResponseHeader) response
                    .decodeCommandCustomHeader(RegisterFilterServerResponseHeader.class);

        return responseHeader;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:27,
代码来源:FilterServerOuterAPI.java

示例4: updateConsumerOffsetOneway

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 更新Consumer消费进度
 * 
 * @throws InterruptedException
 * @throws RemotingSendRequestException
 * @throws RemotingTimeoutException
 * @throws RemotingTooMuchRequestException
 * 
 * @throws RemotingConnectException
 */
public void updateConsumerOffsetOneway(//
        final String addr,//
        final UpdateConsumerOffsetRequestHeader requestHeader,//
        final long timeoutMillis//
) throws RemotingConnectException, RemotingTooMuchRequestException, RemotingTimeoutException,
        RemotingSendRequestException, InterruptedException {
    // 添加虚拟运行环境相关的projectGroupPrefix
    if (!UtilAll.isBlank(projectGroupPrefix)) {
        requestHeader.setConsumerGroup(VirtualEnvUtil.buildWithProjectGroup(
            requestHeader.getConsumerGroup(), projectGroupPrefix));
        requestHeader.setTopic(VirtualEnvUtil.buildWithProjectGroup(requestHeader.getTopic(),
            projectGroupPrefix));
    }

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.UPDATE_CONSUMER_OFFSET, requestHeader);

    this.remotingClient.invokeOneway(addr, request, timeoutMillis);
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:30,
代码来源:MQClientAPIImpl.java

示例5: getBrokerRuntimeInfo

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public KVTable getBrokerRuntimeInfo(final String addr, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException {

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_RUNTIME_INFO, null);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return KVTable.decode(response.getBody(), KVTable.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:19,
代码来源:MQClientAPIImpl.java

示例6: updateBrokerConfig

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 更新Broker的配置文件
 * 
 * @param addr
 * @param properties
 * @param timeoutMillis
 * @throws RemotingConnectException
 * @throws RemotingSendRequestException
 * @throws RemotingTimeoutException
 * @throws InterruptedException
 * @throws MQBrokerException
 * @throws UnsupportedEncodingException
 */
public void updateBrokerConfig(final String addr, final Properties properties, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException, UnsupportedEncodingException {

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.UPDATE_BROKER_CONFIG, null);

    String str = MixAll.properties2String(properties);
    if (str != null && str.length() > 0) {
        request.setBody(str.getBytes(MixAll.DEFAULT_CHARSET));
        RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
        switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            return;
        }
        default:
            break;
        }

        throw new MQBrokerException(response.getCode(), response.getRemark());
    }
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:36,
代码来源:MQClientAPIImpl.java

示例7: getBrokerClusterInfo

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * Name Server: 从Name Server获取集群信息
 */
public ClusterInfo getBrokerClusterInfo(final long timeoutMillis) throws InterruptedException,
        RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException,
        MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_CLUSTER_INFO, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        ClusterInfo responseBody = ClusterInfo.decode(response.getBody(), ClusterInfo.class);
        return responseBody;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());

}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:24,
代码来源:MQClientAPIImpl.java

示例8: wipeWritePermOfBroker

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * Name Server: Broker下线前,清除Broker对应的权限
 */
public int wipeWritePermOfBroker(final String namesrvAddr, String brokerName, final long timeoutMillis)
        throws RemotingCommandException, RemotingConnectException, RemotingSendRequestException,
        RemotingTimeoutException, InterruptedException, MQClientException {
    WipeWritePermOfBrokerRequestHeader requestHeader = new WipeWritePermOfBrokerRequestHeader();
    requestHeader.setBrokerName(brokerName);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.WIPE_WRITE_PERM_OF_BROKER, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(namesrvAddr, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        WipeWritePermOfBrokerResponseHeader responseHeader =
                (WipeWritePermOfBrokerResponseHeader) response
                    .decodeCommandCustomHeader(WipeWritePermOfBrokerResponseHeader.class);
        return responseHeader.getWipeTopicCount();
    }
    default:
        break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:28,
代码来源:MQClientAPIImpl.java

示例9: queryTopicConsumeByWho

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 根据ConsumerGroup获取Consumer连接列表以及订阅关系
 */
public GroupList queryTopicConsumeByWho(final String addr, final String topic, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException {
    QueryTopicConsumeByWhoRequestHeader requestHeader = new QueryTopicConsumeByWhoRequestHeader();
    requestHeader.setTopic(topic);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.QUERY_TOPIC_CONSUME_BY_WHO, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        GroupList groupList = GroupList.decode(response.getBody(), GroupList.class);
        return groupList;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:25,
代码来源:MQClientAPIImpl.java

示例10: invokeAsync

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Override
public void invokeAsync(String addr, RemotingCommand request, long timeoutMillis,
        InvokeCallback invokeCallback) throws InterruptedException, RemotingConnectException,
        RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException {
    final Channel channel = this.getAndCreateChannel(addr);
    if (channel != null && channel.isActive()) {
        try {
            if (this.rpcHook != null) {
                this.rpcHook.doBeforeRequest(addr, request);
            }
            this.invokeAsyncImpl(channel, request, timeoutMillis, invokeCallback);
        }
        catch (RemotingSendRequestException e) {
            log.warn("invokeAsync: send request exception, so close the channel[{}]", addr);
            this.closeChannel(addr, channel);
            throw e;
        }
    }
    else {
        this.closeChannel(addr, channel);
        throw new RemotingConnectException(addr);
    }
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:24,
代码来源:NettyRemotingClient.java

示例11: invokeOneway

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Override
public void invokeOneway(String addr, RemotingCommand request, long timeoutMillis)
        throws InterruptedException, RemotingConnectException, RemotingTooMuchRequestException,
        RemotingTimeoutException, RemotingSendRequestException {
    final Channel channel = this.getAndCreateChannel(addr);
    if (channel != null && channel.isActive()) {
        try {
            if (this.rpcHook != null) {
                this.rpcHook.doBeforeRequest(addr, request);
            }
            this.invokeOnewayImpl(channel, request, timeoutMillis);
        }
        catch (RemotingSendRequestException e) {
            log.warn("invokeOneway: send request exception, so close the channel[{}]", addr);
            this.closeChannel(addr, channel);
            throw e;
        }
    }
    else {
        this.closeChannel(addr, channel);
        throw new RemotingConnectException(addr);
    }
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:24,
代码来源:NettyRemotingClient.java

示例12: test_idle_event

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public void test_idle_event() throws InterruptedException, RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException {
    RemotingServer server = createRemotingServer();
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 10; i++) {
        RemotingCommand request = RemotingCommand.createRequestCommand(0, null);
        RemotingCommand response = client.invokeSync("127.0.0.1:8888", request, 1000 * 3);
        System.out.println(i + " invoke result = " + response);
        assertTrue(response != null);

        Thread.sleep(1000 * 10);
    }

    Thread.sleep(1000 * 60);

    client.shutdown();
    server.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:21,
代码来源:NettyIdleTest.java

示例13: test_connect_timeout

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Test
public void test_connect_timeout() throws InterruptedException, RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException {
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 100; i++) {
        try {
            RemotingCommand request = RemotingCommand.createRequestCommand(0, null);
            RemotingCommand response = client.invokeSync("127.0.0.1:8888", request, 1000 * 3);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    client.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:19,
代码来源:NettyConnectionTest.java

示例14: test_RPC_Sync

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Test
public void test_RPC_Sync() throws InterruptedException, RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException {
    RemotingServer server = createRemotingServer();
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 100; i++) {
        TestRequestHeader requestHeader = new TestRequestHeader();
        requestHeader.setCount(i);
        requestHeader.setMessageTitle("HelloMessageTitle");
        RemotingCommand request = RemotingCommand.createRequestCommand(0, requestHeader);
        RemotingCommand response = client.invokeSync("127.0.0.1:8888", request, 1000 * 3000);
        System.out.println("invoke result = " + response);
        assertTrue(response != null);
    }

    client.shutdown();
    server.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:21,
代码来源:NettyRPCTest.java

示例15: test_RPC_Oneway

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Test
public void test_RPC_Oneway() throws InterruptedException, RemotingConnectException,
        RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException {
    RemotingServer server = createRemotingServer();
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 100; i++) {
        RemotingCommand request = RemotingCommand.createRequestCommand(0, null);
        request.setRemark(String.valueOf(i));
        client.invokeOneway("127.0.0.1:8888", request, 1000 * 3);
    }

    client.shutdown();
    server.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:17,
代码来源:NettyRPCTest.java

示例16: test_RPC_Async

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Test
public void test_RPC_Async() throws InterruptedException, RemotingConnectException,
        RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException {
    RemotingServer server = createRemotingServer();
    RemotingClient client = createRemotingClient();

    for (int i = 0; i < 100; i++) {
        RemotingCommand request = RemotingCommand.createRequestCommand(0, null);
        request.setRemark(String.valueOf(i));
        client.invokeAsync("127.0.0.1:8888", request, 1000 * 3, new InvokeCallback() {
            @Override
            public void operationComplete(ResponseFuture responseFuture) {
                System.out.println(responseFuture.getResponseCommand());
            }
        });
    }

    Thread.sleep(1000 * 3);

    client.shutdown();
    server.shutdown();
    System.out.println("-----------------------------------------------------------------");
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:24,
代码来源:NettyRPCTest.java

示例17: getAllTopicConfig

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public TopicConfigSerializeWrapper getAllTopicConfig(final String addr) throws RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return TopicConfigSerializeWrapper.decode(response.getBody(), TopicConfigSerializeWrapper.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:18,
代码来源:BrokerOuterAPI.java

示例18: getAllConsumerOffset

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 获取所有Consumer Offset
 * 
 * @param addr
 * @return
 */
public ConsumerOffsetSerializeWrapper getAllConsumerOffset(final String addr)
        throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
        RemotingConnectException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_ALL_CONSUMER_OFFSET, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return ConsumerOffsetSerializeWrapper.decode(response.getBody(),
            ConsumerOffsetSerializeWrapper.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:25,
代码来源:BrokerOuterAPI.java

示例19: getAllDelayOffset

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 获取所有定时进度
 * 
 * @param addr
 * @return
 */
public String getAllDelayOffset(final String addr) throws InterruptedException, RemotingTimeoutException,
        RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_ALL_DELAY_OFFSET, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return new String(response.getBody());
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:23,
代码来源:BrokerOuterAPI.java

示例20: getAllSubscriptionGroupConfig

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 获取订阅组配置
 * 
 * @param addr
 * @return
 */
public SubscriptionGroupWrapper getAllSubscriptionGroupConfig(final String addr)
        throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
        RemotingConnectException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS: {
        return SubscriptionGroupWrapper.decode(response.getBody(), SubscriptionGroupWrapper.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:24,
代码来源:BrokerOuterAPI.java

示例21: updateConsumerOffsetOneway

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 更新Consumer消费进度
 * 
 * @throws InterruptedException
 * @throws RemotingSendRequestException
 * @throws RemotingTimeoutException
 * @throws RemotingTooMuchRequestException
 * 
 * @throws RemotingConnectException
 */
public void updateConsumerOffsetOneway(//
        final String addr,//
        final UpdateConsumerOffsetRequestHeader requestHeader,//
        final long timeoutMillis//
) throws RemotingConnectException, RemotingTooMuchRequestException, RemotingTimeoutException,
        RemotingSendRequestException, InterruptedException {
    // 添加虚拟运行环境相关的projectGroupPrefix
    if (!UtilAll.isBlank(projectGroupPrefix)) {
        requestHeader.setConsumerGroup(VirtualEnvUtil.buildWithProjectGroup(
            requestHeader.getConsumerGroup(), projectGroupPrefix));
        requestHeader.setTopic(VirtualEnvUtil.buildWithProjectGroup(requestHeader.getTopic(),
            projectGroupPrefix));
    }

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.UPDATE_CONSUMER_OFFSET_VALUE,
                requestHeader);
    this.remotingClient.invokeOneway(addr, request, timeoutMillis);
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:30,
代码来源:MQClientAPIImpl.java

示例22: getBrokerRuntimeInfo

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public KVTable getBrokerRuntimeInfo(final String addr, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException {

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_BROKER_RUNTIME_INFO_VALUE, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return KVTable.decode(response.getBody(), KVTable.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:18,
代码来源:MQClientAPIImpl.java

示例23: updateBrokerConfig

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 更新Broker的配置文件
 * 
 * @param addr
 * @param properties
 * @param timeoutMillis
 * @throws RemotingConnectException
 * @throws RemotingSendRequestException
 * @throws RemotingTimeoutException
 * @throws InterruptedException
 * @throws MQBrokerException
 * @throws UnsupportedEncodingException
 */
public void updateBrokerConfig(final String addr, final Properties properties, final long timeoutMillis)
        throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
        InterruptedException, MQBrokerException, UnsupportedEncodingException {

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.UPDATE_BROKER_CONFIG_VALUE, null);

    String str = MixAll.properties2String(properties);
    if (str != null && str.length() > 0) {
        request.setBody(str.getBytes(MixAll.DEFAULT_CHARSET));
        RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
        switch (response.getCode()) {
        case ResponseCode.SUCCESS_VALUE: {
            return;
        }
        default:
            break;
        }

        throw new MQBrokerException(response.getCode(), response.getRemark());
    }
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:36,
代码来源:MQClientAPIImpl.java

示例24: getBrokerClusterInfo

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * Name Server: 从Name Server获取集群信息
 */
public ClusterInfo getBrokerClusterInfo(final long timeoutMillis) throws InterruptedException,
        RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException,
        MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_BROKER_CLUSTER_INFO_VALUE, null);

    RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        ClusterInfo responseBody = ClusterInfo.decode(response.getBody(), ClusterInfo.class);
        return responseBody;
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());

}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:24,
代码来源:MQClientAPIImpl.java

示例25: wipeWritePermOfBroker

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * Name Server: Broker下线前,清除Broker对应的权限
 */
public int wipeWritePermOfBroker(final String namesrvAddr, String brokerName, final long timeoutMillis)
        throws RemotingCommandException, RemotingConnectException, RemotingSendRequestException,
        RemotingTimeoutException, InterruptedException, MQClientException {
    WipeWritePermOfBrokerRequestHeader requestHeader = new WipeWritePermOfBrokerRequestHeader();
    requestHeader.setBrokerName(brokerName);

    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.WIPE_WRITE_PERM_OF_BROKER_VALUE,
                requestHeader);
    RemotingCommand response = this.remotingClient.invokeSync(namesrvAddr, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        WipeWritePermOfBrokerResponseHeader responseHeader =
                (WipeWritePermOfBrokerResponseHeader) response
                    .decodeCommandCustomHeader(WipeWritePermOfBrokerResponseHeader.class);
        return responseHeader.getWipeTopicCount();
    }
    default:
        break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:28,
代码来源:MQClientAPIImpl.java

示例26: invokeAsync

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Override
public void invokeAsync(String addr, RemotingCommand request, long timeoutMillis,
        InvokeCallback invokeCallback) throws InterruptedException, RemotingConnectException,
        RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException {
    final Channel channel = this.getAndCreateChannel(addr);
    if (channel != null && channel.isActive()) {
        try {
            this.invokeAsyncImpl(channel, request, timeoutMillis, invokeCallback);
        }
        catch (RemotingSendRequestException e) {
            log.warn("invokeAsync: send request exception, so close the channel[{}]", addr);
            this.closeChannel(addr, channel);
            throw e;
        }
    }
    else {
        this.closeChannel(addr, channel);
        throw new RemotingConnectException(addr);
    }
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:21,
代码来源:NettyRemotingClient.java

示例27: invokeOneway

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
@Override
public void invokeOneway(String addr, RemotingCommand request, long timeoutMillis)
        throws InterruptedException, RemotingConnectException, RemotingTooMuchRequestException,
        RemotingTimeoutException, RemotingSendRequestException {
    final Channel channel = this.getAndCreateChannel(addr);
    if (channel != null && channel.isActive()) {
        try {
            this.invokeOnewayImpl(channel, request, timeoutMillis);
        }
        catch (RemotingSendRequestException e) {
            log.warn("invokeOneway: send request exception, so close the channel[{}]", addr);
            this.closeChannel(addr, channel);
            throw e;
        }
    }
    else {
        this.closeChannel(addr, channel);
        throw new RemotingConnectException(addr);
    }
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:21,
代码来源:NettyRemotingClient.java

示例28: getAllTopicConfig

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public TopicConfigSerializeWrapper getAllTopicConfig(final String addr) throws RemotingConnectException,
        RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_ALL_TOPIC_CONFIG_VALUE, null);

    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return TopicConfigSerializeWrapper.decode(response.getBody(), TopicConfigSerializeWrapper.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:18,
代码来源:BrokerOuterAPI.java

示例29: getAllConsumerOffset

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 获取所有Consumer Offset
 * 
 * @param addr
 * @return
 */
public ConsumerOffsetSerializeWrapper getAllConsumerOffset(final String addr)
        throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
        RemotingConnectException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_ALL_CONSUMER_OFFSET_VALUE, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return ConsumerOffsetSerializeWrapper.decode(response.getBody(),
            ConsumerOffsetSerializeWrapper.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:25,
代码来源:BrokerOuterAPI.java

示例30: getAllDelayOffset

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 获取所有定时进度
 * 
 * @param addr
 * @return
 */
public String getAllDelayOffset(final String addr) throws InterruptedException, RemotingTimeoutException,
        RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_ALL_DELAY_OFFSET_VALUE, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return new String(response.getBody());
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:23,
代码来源:BrokerOuterAPI.java

示例31: getAllSubscriptionGroupConfig

点赞 3

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
/**
 * 获取订阅组配置
 * 
 * @param addr
 * @return
 */
public SubscriptionGroupWrapper getAllSubscriptionGroupConfig(final String addr)
        throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
        RemotingConnectException, MQBrokerException {
    RemotingCommand request =
            RemotingCommand.createRequestCommand(MQRequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG_VALUE,
                null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
    case ResponseCode.SUCCESS_VALUE: {
        return SubscriptionGroupWrapper.decode(response.getBody(), SubscriptionGroupWrapper.class);
    }
    default:
        break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:25,
代码来源:BrokerOuterAPI.java

示例32: fetchMasterAddrByClusterName

点赞 2

import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException; //导入依赖的package包/类
public static Set<String> fetchMasterAddrByClusterName(final MQAdminExt adminExt, final String clusterName)
        throws InterruptedException, RemotingConnectException, RemotingTimeoutException,
        RemotingSendRequestException, MQBrokerException {
    Set<String> masterSet = new HashSet<String>();

    ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo();

    Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName);

    if (brokerNameSet != null) {
        for (String brokerName : brokerNameSet) {
            BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);
            if (brokerData != null) {

                String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID);
                if (addr != null) {
                    masterSet.add(addr);
                }
            }
        }
    }
    else {
        System.out
            .printf("[error] Make sure the specified clusterName exists or the nameserver which connected is correct.");
    }

    return masterSet;
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:29,
代码来源:CommandUtil.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)