use of org.apache.kafka.common.errors.UnsupportedForMessageFormatException in project kafka by apache.
the class TransactionManagerTest method testUnsupportedForMessageFormatInTxnOffsetCommit.
@Test
public void testUnsupportedForMessageFormatInTxnOffsetCommit() {
final TopicPartition tp = new TopicPartition("foo", 0);
doInitTransactions();
transactionManager.beginTransaction();
TransactionalRequestResult sendOffsetsResult = transactionManager.sendOffsetsToTransaction(singletonMap(tp, new OffsetAndMetadata(39L)), new ConsumerGroupMetadata(consumerGroupId));
prepareAddOffsetsToTxnResponse(Errors.NONE, consumerGroupId, producerId, epoch);
prepareFindCoordinatorResponse(Errors.NONE, false, CoordinatorType.GROUP, consumerGroupId);
prepareTxnOffsetCommitResponse(consumerGroupId, producerId, epoch, singletonMap(tp, Errors.UNSUPPORTED_FOR_MESSAGE_FORMAT));
runUntil(transactionManager::hasError);
assertTrue(transactionManager.lastError() instanceof UnsupportedForMessageFormatException);
assertTrue(sendOffsetsResult.isCompleted());
assertFalse(sendOffsetsResult.isSuccessful());
assertTrue(sendOffsetsResult.error() instanceof UnsupportedForMessageFormatException);
assertFatalError(UnsupportedForMessageFormatException.class);
}
use of org.apache.kafka.common.errors.UnsupportedForMessageFormatException in project apache-kafka-on-k8s by banzaicloud.
the class TransactionManagerTest method testUnsupportedForMessageFormatInTxnOffsetCommit.
@Test
public void testUnsupportedForMessageFormatInTxnOffsetCommit() {
final String consumerGroupId = "consumer";
final long pid = 13131L;
final short epoch = 1;
final TopicPartition tp = new TopicPartition("foo", 0);
doInitTransactions(pid, epoch);
transactionManager.beginTransaction();
TransactionalRequestResult sendOffsetsResult = transactionManager.sendOffsetsToTransaction(singletonMap(tp, new OffsetAndMetadata(39L)), consumerGroupId);
prepareAddOffsetsToTxnResponse(Errors.NONE, consumerGroupId, pid, epoch);
// AddOffsetsToTxn Handled, TxnOffsetCommit Enqueued
sender.run(time.milliseconds());
// FindCoordinator Enqueued
sender.run(time.milliseconds());
prepareFindCoordinatorResponse(Errors.NONE, false, CoordinatorType.GROUP, consumerGroupId);
// FindCoordinator Returned
sender.run(time.milliseconds());
prepareTxnOffsetCommitResponse(consumerGroupId, pid, epoch, singletonMap(tp, Errors.UNSUPPORTED_FOR_MESSAGE_FORMAT));
// TxnOffsetCommit Handled
sender.run(time.milliseconds());
assertTrue(transactionManager.hasError());
assertTrue(transactionManager.lastError() instanceof UnsupportedForMessageFormatException);
assertTrue(sendOffsetsResult.isCompleted());
assertFalse(sendOffsetsResult.isSuccessful());
assertTrue(sendOffsetsResult.error() instanceof UnsupportedForMessageFormatException);
assertFatalError(UnsupportedForMessageFormatException.class);
}
Aggregations