org.apache.rocketmq.common.protocol.header.namesrv.PutKVConfigRequestHeader Java Examples

The following examples show how to use org.apache.rocketmq.common.protocol.header.namesrv.PutKVConfigRequestHeader. 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: DefaultRequestProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public RemotingCommand putKVConfig(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final PutKVConfigRequestHeader requestHeader =
        (PutKVConfigRequestHeader) request.decodeCommandCustomHeader(PutKVConfigRequestHeader.class);

    this.namesrvController.getKvConfigManager().putKVConfig(
        requestHeader.getNamespace(),
        requestHeader.getKey(),
        requestHeader.getValue()
    );

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #2
Source File: DefaultRequestProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #3
Source File: DefaultRequestProcessor.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public RemotingCommand putKVConfig(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final PutKVConfigRequestHeader requestHeader =
        (PutKVConfigRequestHeader) request.decodeCommandCustomHeader(PutKVConfigRequestHeader.class);

    this.namesrvController.getKvConfigManager().putKVConfig(
        requestHeader.getNamespace(),
        requestHeader.getKey(),
        requestHeader.getValue()
    );

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #4
Source File: DefaultRequestProcessorTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #5
Source File: DefaultRequestProcessor.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
public RemotingCommand putKVConfig(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final PutKVConfigRequestHeader requestHeader = (PutKVConfigRequestHeader) request.decodeCommandCustomHeader(PutKVConfigRequestHeader.class);

    this.namesrvController.getKvConfigManager().putKVConfig(
        requestHeader.getNamespace(),
        requestHeader.getKey(),
        requestHeader.getValue()
    );

    /*
     * 返回ok
     */
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #6
Source File: DefaultRequestProcessorTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #7
Source File: DefaultRequestProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #8
Source File: DefaultRequestProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public RemotingCommand putKVConfig(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final PutKVConfigRequestHeader requestHeader =
        (PutKVConfigRequestHeader) request.decodeCommandCustomHeader(PutKVConfigRequestHeader.class);

    this.namesrvController.getKvConfigManager().putKVConfig(
        requestHeader.getNamespace(),
        requestHeader.getKey(),
        requestHeader.getValue()
    );

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #9
Source File: DefaultRequestProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #10
Source File: DefaultRequestProcessorTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #11
Source File: DefaultRequestProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
public RemotingCommand putKVConfig(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final PutKVConfigRequestHeader requestHeader =
        (PutKVConfigRequestHeader) request.decodeCommandCustomHeader(PutKVConfigRequestHeader.class);

    this.namesrvController.getKvConfigManager().putKVConfig(
        requestHeader.getNamespace(),
        requestHeader.getKey(),
        requestHeader.getValue()
    );

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
 
Example #12
Source File: DefaultRequestProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessRequest_PutKVConfig() throws RemotingCommandException {
    PutKVConfigRequestHeader header = new PutKVConfigRequestHeader();
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PUT_KV_CONFIG,
        header);
    request.addExtField("namespace", "namespace");
    request.addExtField("key", "key");
    request.addExtField("value", "value");

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

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

    assertThat(namesrvController.getKvConfigManager().getKVConfig("namespace", "key"))
        .isEqualTo("value");
}
 
Example #13
Source File: DefaultRequestProcessor.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public RemotingCommand putKVConfig(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final PutKVConfigRequestHeader requestHeader =
        (PutKVConfigRequestHeader) request.decodeCommandCustomHeader(PutKVConfigRequestHeader.class);

    this.namesrvController.getKvConfigManager().putKVConfig(
        requestHeader.getNamespace(),
        requestHeader.getKey(),
        requestHeader.getValue()
    );

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}