use of org.apache.kafka.common.message.InitProducerIdResponseData in project kafka by apache.
the class TransactionManagerTest method prepareInitPidResponse.
private void prepareInitPidResponse(Errors error, boolean shouldDisconnect, long producerId, short producerEpoch) {
InitProducerIdResponseData responseData = new InitProducerIdResponseData().setErrorCode(error.code()).setProducerEpoch(producerEpoch).setProducerId(producerId).setThrottleTimeMs(0);
client.prepareResponse(body -> {
InitProducerIdRequest initProducerIdRequest = (InitProducerIdRequest) body;
assertEquals(transactionalId, initProducerIdRequest.data().transactionalId());
assertEquals(transactionTimeoutMs, initProducerIdRequest.data().transactionTimeoutMs());
return true;
}, new InitProducerIdResponse(responseData), shouldDisconnect);
}
use of org.apache.kafka.common.message.InitProducerIdResponseData in project kafka by apache.
the class TransactionManagerTest method initializeIdempotentProducerId.
private void initializeIdempotentProducerId(long producerId, short epoch) {
InitProducerIdResponseData responseData = new InitProducerIdResponseData().setErrorCode(Errors.NONE.code()).setProducerEpoch(epoch).setProducerId(producerId).setThrottleTimeMs(0);
client.prepareResponse(body -> {
InitProducerIdRequest initProducerIdRequest = (InitProducerIdRequest) body;
assertNull(initProducerIdRequest.data().transactionalId());
return true;
}, new InitProducerIdResponse(responseData), false);
runUntil(transactionManager::hasProducerId);
}
Aggregations