當前位置: 首頁>>代碼示例>>Java>>正文


Java RemotingCommand.setVersion方法代碼示例

本文整理匯總了Java中org.apache.rocketmq.remoting.protocol.RemotingCommand.setVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java RemotingCommand.setVersion方法的具體用法?Java RemotingCommand.setVersion怎麽用?Java RemotingCommand.setVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.rocketmq.remoting.protocol.RemotingCommand的用法示例。


在下文中一共展示了RemotingCommand.setVersion方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createUnRegisterProducerCommand

import org.apache.rocketmq.remoting.protocol.RemotingCommand; //導入方法依賴的package包/類
private RemotingCommand createUnRegisterProducerCommand() {
    UnregisterClientRequestHeader requestHeader = new UnregisterClientRequestHeader();
    requestHeader.setClientID(clientId);
    requestHeader.setProducerGroup(group);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UNREGISTER_CLIENT, requestHeader);
    request.setLanguage(LanguageCode.JAVA);
    request.setVersion(100);
    request.makeCustomHeaderToNet();
    return request;
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:11,代碼來源:ClientManageProcessorTest.java

示例2: createUnRegisterConsumerCommand

import org.apache.rocketmq.remoting.protocol.RemotingCommand; //導入方法依賴的package包/類
private RemotingCommand createUnRegisterConsumerCommand() {
    UnregisterClientRequestHeader requestHeader = new UnregisterClientRequestHeader();
    requestHeader.setClientID(clientId);
    requestHeader.setConsumerGroup(group);
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UNREGISTER_CLIENT, requestHeader);
    request.setLanguage(LanguageCode.JAVA);
    request.setVersion(100);
    request.makeCustomHeaderToNet();
    return request;
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:11,代碼來源:ClientManageProcessorTest.java

示例3: testProcessRequest_RegisterBrokerWithFilterServer

import org.apache.rocketmq.remoting.protocol.RemotingCommand; //導入方法依賴的package包/類
@Test
public void testProcessRequest_RegisterBrokerWithFilterServer() throws RemotingCommandException,
    NoSuchFieldException, IllegalAccessException {
    RemotingCommand request = genSampleRegisterCmd(true);

    // version >= MQVersion.Version.V3_0_11.ordinal() to register with filter server
    request.setVersion(100);

    ChannelHandlerContext ctx = mock(ChannelHandlerContext.class);
    when(ctx.channel()).thenReturn(null);

    RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request);

    assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS);
    assertThat(response.getRemark()).isNull();

    RouteInfoManager routes = namesrvController.getRouteInfoManager();
    Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable");
    brokerAddrTable.setAccessible(true);

    BrokerData broker = new BrokerData();
    broker.setBrokerName("broker");
    broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1"));

    assertThat((Map) brokerAddrTable.get(routes))
        .contains(new HashMap.SimpleEntry("broker", broker));
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:28,代碼來源:DefaultRequestProcessorTest.java


注:本文中的org.apache.rocketmq.remoting.protocol.RemotingCommand.setVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。