KAFKA-8586: Fail source tasks when producers fail to send records (#6993)
Changed Connect's `WorkerSourceTask` to capture non-retriable exceptions from the `producer.send(...)` (e.g., authentication or authorization errors) and to fail the connector task when such an error is encountered. Modified the existing unit tests to verify this functionality.
Note that most producer errors are retriable, and Connect will (by default) set up each producer with 1 max in-flight message and infinite retries. This change only affects non-retriable errors.
@ -542,6 +544,21 @@ public class WorkerSourceTaskTest extends ThreadedTest {
@@ -542,6 +544,21 @@ public class WorkerSourceTaskTest extends ThreadedTest {
@ -711,16 +728,24 @@ public class WorkerSourceTaskTest extends ThreadedTest {
@@ -711,16 +728,24 @@ public class WorkerSourceTaskTest extends ThreadedTest {
@ -737,15 +762,19 @@ public class WorkerSourceTaskTest extends ThreadedTest {
@@ -737,15 +762,19 @@ public class WorkerSourceTaskTest extends ThreadedTest {
// 2. Converted data passed to the producer, which will need callbacks invoked for flush to work
@ -757,8 +786,10 @@ public class WorkerSourceTaskTest extends ThreadedTest {
@@ -757,8 +786,10 @@ public class WorkerSourceTaskTest extends ThreadedTest {
else
expect.andAnswer(expectResponse);
// 3. As a result of a successful producer send callback, we'll notify the source task of the record commit
expectTaskCommitRecord(anyTimes,succeed);
if(sendSuccess){
// 3. As a result of a successful producer send callback, we'll notify the source task of the record commit