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


Java ClientChannelInfo类代码示例

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


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

示例1: init

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:20,代码来源:PullMessageProcessorTest.java

示例2: init

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:18,代码来源:ClientManageProcessorTest.java

示例3: getConsumerConnectionList

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
private RemotingCommand getConsumerConnectionList(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerConnectionListRequestHeader requestHeader =
        (GetConsumerConnectionListRequestHeader) request.decodeCommandCustomHeader(GetConsumerConnectionListRequestHeader.class);

    ConsumerGroupInfo consumerGroupInfo =
        this.brokerController.getConsumerManager().getConsumerGroupInfo(requestHeader.getConsumerGroup());
    if (consumerGroupInfo != null) {
        ConsumerConnection bodydata = new ConsumerConnection();
        bodydata.setConsumeFromWhere(consumerGroupInfo.getConsumeFromWhere());
        bodydata.setConsumeType(consumerGroupInfo.getConsumeType());
        bodydata.setMessageModel(consumerGroupInfo.getMessageModel());
        bodydata.getSubscriptionTable().putAll(consumerGroupInfo.getSubscriptionTable());

        Iterator<Map.Entry<Channel, ClientChannelInfo>> it = consumerGroupInfo.getChannelInfoTable().entrySet().iterator();
        while (it.hasNext()) {
            ClientChannelInfo info = it.next().getValue();
            Connection connection = new Connection();
            connection.setClientId(info.getClientId());
            connection.setLanguage(info.getLanguage());
            connection.setVersion(info.getVersion());
            connection.setClientAddr(RemotingHelper.parseChannelRemoteAddr(info.getChannel()));

            bodydata.getConnectionSet().add(connection);
        }

        byte[] body = bodydata.encode();
        response.setBody(body);
        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);

        return response;
    }

    response.setCode(ResponseCode.CONSUMER_NOT_ONLINE);
    response.setRemark("the consumer group[" + requestHeader.getConsumerGroup() + "] not online");
    return response;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:39,代码来源:AdminBrokerProcessor.java

示例4: getProducerConnectionList

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
private RemotingCommand getProducerConnectionList(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetProducerConnectionListRequestHeader requestHeader =
        (GetProducerConnectionListRequestHeader) request.decodeCommandCustomHeader(GetProducerConnectionListRequestHeader.class);

    ProducerConnection bodydata = new ProducerConnection();
    HashMap<Channel, ClientChannelInfo> channelInfoHashMap =
        this.brokerController.getProducerManager().getGroupChannelTable().get(requestHeader.getProducerGroup());
    if (channelInfoHashMap != null) {
        Iterator<Map.Entry<Channel, ClientChannelInfo>> it = channelInfoHashMap.entrySet().iterator();
        while (it.hasNext()) {
            ClientChannelInfo info = it.next().getValue();
            Connection connection = new Connection();
            connection.setClientId(info.getClientId());
            connection.setLanguage(info.getLanguage());
            connection.setVersion(info.getVersion());
            connection.setClientAddr(RemotingHelper.parseChannelRemoteAddr(info.getChannel()));

            bodydata.getConnectionSet().add(connection);
        }

        byte[] body = bodydata.encode();
        response.setBody(body);
        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);
        return response;
    }

    response.setCode(ResponseCode.SYSTEM_ERROR);
    response.setRemark("the producer group[" + requestHeader.getProducerGroup() + "] not exist");
    return response;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:33,代码来源:AdminBrokerProcessor.java

示例5: processRequest_UnRegisterProducer

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
@Test
public void processRequest_UnRegisterProducer() throws Exception {
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);
    HashMap<Channel, ClientChannelInfo> channelMap = brokerController.getProducerManager().getGroupChannelTable().get(group);
    assertThat(channelMap).isNotNull();
    assertThat(channelMap.get(channel)).isEqualTo(clientChannelInfo);

    RemotingCommand request = createUnRegisterProducerCommand();
    RemotingCommand response = clientManageProcessor.processRequest(handlerContext, request);
    assertThat(response).isNotNull();
    assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS);

    channelMap = brokerController.getProducerManager().getGroupChannelTable().get(group);
    assertThat(channelMap).isNull();
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:16,代码来源:ClientManageProcessorTest.java

示例6: getConsumerConnectionList

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
private RemotingCommand getConsumerConnectionList(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerConnectionListRequestHeader requestHeader =
        (GetConsumerConnectionListRequestHeader) request.decodeCommandCustomHeader(GetConsumerConnectionListRequestHeader.class);

    ConsumerGroupInfo consumerGroupInfo =
        this.brokerController.getConsumerManager().getConsumerGroupInfo(requestHeader.getConsumerGroup());
    if (consumerGroupInfo != null) {
        ConsumerConnection bodydata = new ConsumerConnection();
        bodydata.setConsumeFromWhere(consumerGroupInfo.getConsumeFromWhere());
        bodydata.setConsumeType(consumerGroupInfo.getConsumeType());
        bodydata.setMessageModel(consumerGroupInfo.getMessageModel());
        bodydata.getSubscriptionTable().putAll(consumerGroupInfo.getSubscriptionTable());

        Iterator<Map.Entry<Channel, ClientChannelInfo>> it = consumerGroupInfo.getChannelInfoTable().entrySet().iterator();
        while (it.hasNext()) {
            ClientChannelInfo info = it.next().getValue();
            Connection connection = new Connection();
            connection.setClientId(info.getClientId());
            connection.setLanguage(info.getLanguage());
            connection.setVersion(info.getVersion());
            connection.setClientAddr(RemotingHelper.parseChannelRemoteAddr(info.getChannel()));

            bodydata.getConnectionSet().add(connection);
        }

        byte[] body = bodydata.encode();
        response.setBody(body);
        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);

        return response;
    }

    response.setCode(ResponseCode.CONSUMER_NOT_ONLINE);
    response.setRemark("the consumer group[" + requestHeader.getConsumerGroup() + "] not online");
    return response;
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:40,代码来源:AdminBrokerProcessor.java

示例7: getProducerConnectionList

import org.apache.rocketmq.broker.client.ClientChannelInfo; //导入依赖的package包/类
private RemotingCommand getProducerConnectionList(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetProducerConnectionListRequestHeader requestHeader =
        (GetProducerConnectionListRequestHeader) request.decodeCommandCustomHeader(GetProducerConnectionListRequestHeader.class);

    ProducerConnection bodydata = new ProducerConnection();
    HashMap<Channel, ClientChannelInfo> channelInfoHashMap =
        this.brokerController.getProducerManager().getGroupChannelTable().get(requestHeader.getProducerGroup());
    if (channelInfoHashMap != null) {
        Iterator<Map.Entry<Channel, ClientChannelInfo>> it = channelInfoHashMap.entrySet().iterator();
        while (it.hasNext()) {
            ClientChannelInfo info = it.next().getValue();
            Connection connection = new Connection();
            connection.setClientId(info.getClientId());
            connection.setLanguage(info.getLanguage());
            connection.setVersion(info.getVersion());
            connection.setClientAddr(RemotingHelper.parseChannelRemoteAddr(info.getChannel()));

            bodydata.getConnectionSet().add(connection);
        }

        byte[] body = bodydata.encode();
        response.setBody(body);
        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);
        return response;
    }

    response.setCode(ResponseCode.SYSTEM_ERROR);
    response.setRemark("the producer group[" + requestHeader.getProducerGroup() + "] not exist");
    return response;
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:34,代码来源:AdminBrokerProcessor.java


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