当前位置: 首页>>代码示例>>Java>>正文


Java ProducerConnection类代码示例

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


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

示例1: getProducerConnection

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@CmdTrace(cmdClazz = ProducerConnectionSubCommand.class)
public ProducerConnection getProducerConnection(String group, String topicName) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topicName);
        return pc;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:19,代码来源:ConnectionService.java

示例2: examineProducerConnectionInfo

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup, final String topic)
        throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    ProducerConnection result = new ProducerConnection();

    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            return this.mQClientFactory.getMQClientAPIImpl().getProducerConnectionList(addr,
                producerGroup, 300);
        }
    }

    if (result.getConnectionSet().isEmpty()) {
        throw new MQClientException("Not found the consumer group connection", null);
    }

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

示例3: execute

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String group = commandLine.getOptionValue('g').trim();
        String topic = commandLine.getOptionValue('t').trim();

        ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topic);

        int i = 1;
        for (Connection conn : pc.getConnectionSet()) {
            System.out.printf("%04d  %-32s %-22s %-8s %s\n",//
                i++,//
                conn.getClientId(),//
                conn.getClientAddr(),//
                conn.getLanguage(),//
                MQVersion.getVersionDesc(conn.getVersion())//
                );
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:33,代码来源:ProducerConnectionSubCommand.java

示例4: getProducerConnection

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@Override
public ProducerConnection getProducerConnection(String producerGroup, String topic) {
    try {
        return mqAdminExt.examineProducerConnectionInfo(producerGroup, topic);
    } catch (RemotingException | MQClientException | MQBrokerException | InterruptedException e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:9,代码来源:ProducerServiceImpl.java

示例5: getProducerConnectionList

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
/**
 * 根据ProducerGroup获取Producer连接列表
 */
public ProducerConnection getProducerConnectionList(final String addr, final String producerGroup,
        final long timeoutMillis) throws RemotingConnectException, RemotingSendRequestException,
        RemotingTimeoutException, InterruptedException, MQBrokerException {
    // 添加虚拟运行环境相关的projectGroupPrefix
    String producerGroupWithProjectGroup = producerGroup;
    if (!UtilAll.isBlank(projectGroupPrefix)) {
        producerGroupWithProjectGroup =
                VirtualEnvUtil.buildWithProjectGroup(producerGroup, projectGroupPrefix);
    }

    GetProducerConnectionListRequestHeader requestHeader = new GetProducerConnectionListRequestHeader();
    requestHeader.setProducerGroup(producerGroupWithProjectGroup);

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

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

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:31,代码来源:MQClientAPIImpl.java

示例6: execute

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String group = commandLine.getOptionValue('g').trim();
        String topic = commandLine.getOptionValue('t').trim();

        ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topic);

        int i = 1;
        for (Connection conn : pc.getConnectionSet()) {
            System.out.printf("%04d  %-32s %-22s %-8s %s\n",//
                i++,//
                conn.getClientId(),//
                conn.getClientAddr(),//
                conn.getLanguage(),//
                MQVersion.getVersionDesc(conn.getVersion())//
                );
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:33,代码来源:ProducerConnectionSubCommand.java

示例7: getProducerConnectionList

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
/**
 * 根据ProducerGroup获取Producer连接列表
 */
public ProducerConnection getProducerConnectionList(final String addr, final String producerGroup,
        final long timeoutMillis) throws RemotingConnectException, RemotingSendRequestException,
        RemotingTimeoutException, InterruptedException, MQBrokerException {
    // 添加虚拟运行环境相关的projectGroupPrefix
    String producerGroupWithProjectGroup = producerGroup;
    if (!UtilAll.isBlank(projectGroupPrefix)) {
        producerGroupWithProjectGroup =
                VirtualEnvUtil.buildWithProjectGroup(producerGroup, projectGroupPrefix);
    }

    GetProducerConnectionListRequestHeader requestHeader = new GetProducerConnectionListRequestHeader();
    requestHeader.setProducerGroup(producerGroupWithProjectGroup);

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

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:31,代码来源:MQClientAPIImpl.java

示例8: examineProducerConnectionInfo

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup, String topic)
        throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    return MQAdminInstance.threadLocalMQAdminExt().examineProducerConnectionInfo(producerGroup, topic);
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:6,代码来源:MQAdminExtImpl.java

示例9: examineProducerConnectionInfo

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
@Override
public ProducerConnection examineProducerConnectionInfo(String producerGroup, final String topic)
        throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    return defaultMQAdminExtImpl.examineProducerConnectionInfo(producerGroup, topic);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQAdminExt.java

示例10: examineProducerConnectionInfo

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
/**
 * 查看Producer网络连接
 * 
 * @param producerGroup
 * @param topic
 * @return
 * @throws InterruptedException
 * @throws MQClientException
 * @throws RemotingException
 * @throws MQBrokerException
 */
public ProducerConnection examineProducerConnectionInfo(final String producerGroup, final String topic)
        throws RemotingException, MQClientException, InterruptedException, MQBrokerException;
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:14,代码来源:MQAdminExt.java

示例11: getProducerConnection

import com.alibaba.rocketmq.common.protocol.body.ProducerConnection; //导入依赖的package包/类
ProducerConnection getProducerConnection(String producerGroup, String topic); 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:2,代码来源:ProducerService.java


注:本文中的com.alibaba.rocketmq.common.protocol.body.ProducerConnection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。