Search in sources :

Example 6 with TxnOffsetCommitRequest

use of org.apache.kafka.common.requests.TxnOffsetCommitRequest in project kafka by apache.

the class TransactionManagerTest method prepareTxnOffsetCommitResponse.

private void prepareTxnOffsetCommitResponse(final String consumerGroupId, final long producerId, final short producerEpoch, Map<TopicPartition, Errors> txnOffsetCommitResponse) {
    client.prepareResponse(request -> {
        TxnOffsetCommitRequest txnOffsetCommitRequest = (TxnOffsetCommitRequest) request;
        assertEquals(consumerGroupId, txnOffsetCommitRequest.data().groupId());
        assertEquals(producerId, txnOffsetCommitRequest.data().producerId());
        assertEquals(producerEpoch, txnOffsetCommitRequest.data().producerEpoch());
        return true;
    }, new TxnOffsetCommitResponse(0, txnOffsetCommitResponse));
}
Also used : TxnOffsetCommitResponse(org.apache.kafka.common.requests.TxnOffsetCommitResponse) TxnOffsetCommitRequest(org.apache.kafka.common.requests.TxnOffsetCommitRequest)

Aggregations

TxnOffsetCommitRequest (org.apache.kafka.common.requests.TxnOffsetCommitRequest)6 TxnOffsetCommitResponse (org.apache.kafka.common.requests.TxnOffsetCommitResponse)5 ConsumerGroupMetadata (org.apache.kafka.clients.consumer.ConsumerGroupMetadata)4 TopicPartition (org.apache.kafka.common.TopicPartition)4 Test (org.junit.jupiter.api.Test)4 OffsetAndMetadata (org.apache.kafka.clients.consumer.OffsetAndMetadata)3 CommitFailedException (org.apache.kafka.clients.consumer.CommitFailedException)2 HashMap (java.util.HashMap)1 MockClient (org.apache.kafka.clients.MockClient)1 ProducerMetadata (org.apache.kafka.clients.producer.internals.ProducerMetadata)1 Node (org.apache.kafka.common.Node)1 FencedInstanceIdException (org.apache.kafka.common.errors.FencedInstanceIdException)1 TxnOffsetCommitRequestData (org.apache.kafka.common.message.TxnOffsetCommitRequestData)1 MetadataResponse (org.apache.kafka.common.requests.MetadataResponse)1 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)1 MockTime (org.apache.kafka.common.utils.MockTime)1 Time (org.apache.kafka.common.utils.Time)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1