Resolves https://github.com/spring-projects/spring-kafka/issues/1259
Previously if the recoverer in a `SeekToCurrentErrorHandler` or
`DefaultAfterRollbackProcessor` failed to recover a record, the
record could be lost; the `FailedRecordTracker` simply logged
the exception.
Change the `SeekUtils` to detect a failure in the recoverer (actually
any failure when determining if the failed record should be recovered)
and include the failed record in the seeks.
In this way the recovery will be attempted once more on each delivery
attempt.
**cherry-pick to 2.2.x**
# Conflicts:
# spring-kafka/src/main/java/org/springframework/kafka/listener/FailedRecordTracker.java
# spring-kafka/src/main/java/org/springframework/kafka/support/SeekUtils.java
# src/reference/asciidoc/kafka.adoc
Fixes https://github.com/spring-projects/spring-kafka/issues/1125
Main ideas:
* It does not enforces one single function to be set,
it simply makes the new one to take precedence.
* When setting the function/supplier via configuration,
one single configuration key/value pair is enough.
It tries to fit in any of the two possible options, otherwise, raises errors.
* I'd personally rename `private BiFunction<byte[], Headers, T> failedDeserializationFunction;`
to `failedDeserializationBiFunction`, respecting the name at setter level.
However i read about avoiding sugar refactoring as rule of thumb.
* Simplify and unify setFailedDeserializationFunction
& recoverFromSupplier methods from ErrorHandlingDeserializer2
* deprecated since was in the wrong place
* Javadocs for ErrorHandlingDeserializer2 and adocs syntax's amends.
* Correct FailedDeserializationInfo & ErrorHandlingDeserializer2 copyright years
* Correct FailedDeserializationInfo this invocation
& ErrorHandlingDeserializer2 java docs headers
*Polishing code style
**Cherry-pick to 2.2.x**
# Conflicts:
# spring-kafka/src/main/java/org/springframework/kafka/support/serializer/ErrorHandlingDeserializer2.java
# src/reference/asciidoc/whats-new.adoc
Resolves https://github.com/spring-projects/spring-kafka/issues/990
Provide a mechanism to start a new transaction within which to invoke
the processor, so if it recovers the failed record, its offset can
be sent to the transaction.
**cherry-pick to 2.2.x**
# Conflicts:
# spring-kafka/src/main/java/org/springframework/kafka/listener/DeadLetterPublishingRecoverer.java
Resolves https://github.com/spring-projects/spring-kafka/issues/970
- allow retrieval of the `group.id`, even if not set on the container properties
- also add `getAllListenerContainers` to the `RLERegistry` as a convenience
- also add `getListenerId` to return the id or bean name of the container
* GH-960: Seek-to-Current - commit recovered offset
Resolves https://github.com/spring-projects/spring-kafka/issues/960
When the container is configured with `AckMode.MANUAL_IMMEDIATE`, the
`SeekToCurrentErrorHandler` can be configured to commit the offset of
a recovered record.
* Polishing - PR Comments
This commit throws out Docbook and gives us the modern
look and feel for the docs.
It uses Asciidoctor to generate the PDF.
* Polishing for `build.gradle` in regards to asciidoc
* Upgrade to the latest Asciidoc and its plugins
* Combine Asciidoc backends into a single Gradle task
* Fix issues with section levels, duplicated ids and project version in
the docs
* Remove obsolete files: not used by Asciidoc
I edited for clarity, punctuation, grammar, spelling, usage, and corporate voice.
I also added a few links (mostly to Javadoc).
Further changes to account for changes made while I was working
Someone made changes to a few paragraphs, so I edited the changed material, too.
* Fix "One Sentence per Line" violations
Resolves https://github.com/spring-projects/spring-kafka/issues/948
For example, this can be used by the `DeadLetterPublishingRecoverer`'s
destination resolver to choose a topic based on the group in addition
to the information in the consumer record.
* Polishing - @Nullable on getGroupId().
Fixes spring-projects/spring-kafka#917
Added ports attribute to EmbeddedKafka annotation.
It has a default value of 0 to be consistent with the count attribute.
* #917: Added Tests and update adoc files
Created a unit test similarly to the EmbeddedKafkaBroker test for validating the system properties created with the EmbeddedKafka bean creation.
Updated copyright and author/since in relevant files.
Updated .adoc files to reflect the new attribute.
* #917 Corrected since annotations and Unit tests
- Corrected since annotations from last commit
- Moved unit test of EmbeddedKafka annotation from spring-kafka to spring-kafka-test. Refactored unit test to avoid bean initialization and broker creation.
* #917 Corrected white space trailling errors
* #917 Corrected style for spring-kafka-test
* #917 Corrected checkstyle
Only remove the headers for the object being deserialized.
Previously, it removed all type headers, with explicit reference to the key
headers. This happened to work ok because the key was deserialized first.
If this ever changes, the key headers would be removed when the value is
deserialized and would not be available for key deserialization.
* `JsonDeserializer`: add `spring.json.use.type.headers` configuration property
Resolves https://github.com/spring-projects/spring-kafka/issues/853
Since a `null` key is common, we only check for the exception header
if we detect that the error handling deserializer is configured.
* Polishing; add failedDeserializationFunction