use of com.yahoo.pulsar.common.api.proto.PulsarApi.CommandSuccess in project pulsar by yahoo.
the class ServerCnxTest method testAckCommand.
@Test(timeOut = 30000)
public void testAckCommand() throws Exception {
resetChannel();
setChannelConnected();
ByteBuf clientCommand = Commands.newSubscribe(successTopicName, successSubName, 1, /* consumer id */
1, /*
* request id
*/
SubType.Exclusive, 0, "test");
channel.writeInbound(clientCommand);
assertTrue(getResponse() instanceof CommandSuccess);
PositionImpl pos = new PositionImpl(0, 0);
clientCommand = Commands.newAck(1, /* consumer id */
pos.getLedgerId(), pos.getEntryId(), AckType.Individual, null);
channel.writeInbound(clientCommand);
// verify nothing is sent out on the wire after ack
assertNull(channel.outboundMessages().peek());
channel.finish();
}
use of com.yahoo.pulsar.common.api.proto.PulsarApi.CommandSuccess in project pulsar by yahoo.
the class Commands method newSuccess.
public static ByteBuf newSuccess(long requestId) {
CommandSuccess.Builder successBuilder = CommandSuccess.newBuilder();
successBuilder.setRequestId(requestId);
CommandSuccess success = successBuilder.build();
ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.SUCCESS).setSuccess(success));
successBuilder.recycle();
success.recycle();
return res;
}
Aggregations