Skip to content
Bluetape4k docs1.11

Failures, testing, operations, and ecosystem

Latest stable Based on Bluetape4k release 1.11.0

At minimum, distinguish:

  • serialization, deserialization, and type-allowlist failures;
  • local producer timeouts, broker rejection, and unknown delivery results;
  • consumer poll/rebalance and offset-commit failures;
  • coroutine cancellation and application shutdown;
  • Streams processing, state-store, and restoration failures.

One retry policy across all of them can create duplicates, poison-pill loops, or worse rebalances. Define retry eligibility, idempotency, and DLQ handling per class.

A successful suspendSend means a broker acknowledgment was received; it does not commit a database transaction. Use an outbox when database changes and event publication must be coordinated. Classify timeout and cancellation as an unknown result, not proof that no send occurred.

Committing before processing can lose records after failure. Committing after processing can repeat work, so handlers should be idempotent. Exactly-once APIs do not automatically include external HTTP or database side effects in the Kafka transaction.

The following areas run without a broker:

  • TopicPartitionSupportTest for parsing and invalid input;
  • codec tests for byte/string round trips, allowlists, and poison pills;
  • coroutine producer mocks for callback failures and future cancellation;
  • listener-adapter delegation tests;
  • KStreamDslTest for Streams parameter factories.
Terminal window
./gradlew :bluetape4k-kafka:test \
--tests "io.bluetape4k.kafka.TopicPartitionSupportTest" \
--tests "io.bluetape4k.kafka.codec.*" \
--tests "io.bluetape4k.kafka.streams.kstream.KStreamDslTest" \
--no-configuration-cache

Producer/consumer, Spring template, and actual Flow tests use the KafkaServer.Launcher.kafka Testcontainer. Run heavyweight infrastructure tests sequentially.

  1. Cross-test stored records with old and new codecs.
  2. Verify duplicate handling and idempotency under retry and timeout.
  3. Test processing/commit ordering and graceful shutdown during rebalance.
  4. Test TLS/SASL, ACLs, and credential rotation with production-equivalent settings.
  5. Measure Streams topology upgrades and state restoration.
  6. Ensure DLQ replay does not recreate the same poison-pill loop.

Separate producer errors/retries/request latency/buffers, consumer lag/rebalance/poll/commit, DLQ and codec rejection, and Streams task/state restoration. Bound topic and group labels; never use record keys, exception messages, or payloads as metric labels.

NeedArtifactBoundary
Kafka 3.9.x, Spring Kafka 3.x, Jackson 2bluetape4k-kafkaThis manual
Kafka 4.2.x, Spring Kafka 4.x, Jackson 3bluetape4k-kafka4Same packages; choose one line
Export Logback events to Kafkabluetape4k-kafka-logbackAppender/exporter only, not a general producer replacement
Coroutine and Flow foundationsbluetape4k-coroutinesKafka delivery semantics remain here
Shared Kafka Testcontainers supportbluetape4k-testcontainersCaller owns application fixtures/lifecycle

After the release, Kafka tests gained per-module temporary directories, and consumer-template close gained warnings for non-AutoCloseable receivers plus logged/suppressed close failures. This manual uses the 1.11.0 contract: conditional close, no warning, and direct close-exception propagation.