diff --git a/build.gradle b/build.gradle index a7e6e78b..49a00600 100644 --- a/build.gradle +++ b/build.gradle @@ -11,11 +11,11 @@ buildscript { } plugins { - id 'org.sonarqube' version '2.6.2' id 'base' id 'project-report' id 'idea' - id 'org.asciidoctor.convert' version '1.5.9.2' + id "org.sonarqube" version '2.7' + id 'org.asciidoctor.convert' version '1.5.10' id 'org.ajoberstar.grgit' version '3.0.0' } @@ -69,7 +69,7 @@ subprojects { subproject -> } ext { - assertjVersion = '3.11.1' + assertjVersion = '3.12.0' googleJsr305Version = '3.0.2' hamcrestVersion = '1.3' hibernateValidationVersion = '6.0.14.Final' @@ -93,7 +93,7 @@ subprojects { subproject -> eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature' jacoco { - toolVersion = '0.8.1' + toolVersion = '0.8.2' } // dependencies that are common across all java projects @@ -174,7 +174,7 @@ subprojects { subproject -> } } - processResources.dependsOn updateCopyrights + compileKotlin.dependsOn updateCopyrights task sourcesJar(type: Jar) { classifier = 'sources' @@ -362,12 +362,12 @@ task docsZip(type: Zip, dependsOn: [reference]) { } from ('build/asciidoc/html5') { - into 'reference' + into 'reference/html' } from ('build/asciidoc/pdf') { include 'index.pdf' - into 'reference' + into 'reference/pdf' } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 29953ea1..87b738cb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d..44e7c4d1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d5..af6708ff 100755 --- a/gradlew +++ b/gradlew @@ -28,7 +28,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index e95643d6..6d57edc7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/reference/asciidoc/changes-since-1.0.adoc b/src/reference/asciidoc/changes-since-1.0.adoc index c828de9a..3213bd52 100644 --- a/src/reference/asciidoc/changes-since-1.0.adoc +++ b/src/reference/asciidoc/changes-since-1.0.adoc @@ -1,6 +1,118 @@ [[migration]] +=== Changes between 2.1 and 2.2 + +[[kafka-client-2.0]] +==== Kafka Client Version + +This version requires the 2.0.0 `kafka-clients` or higher. + +==== Class and Package Changes + +The `ContainerProperties` class has been moved from `org.springframework.kafka.listener.config` to `org.springframework.kafka.listener`. + +The `AckMode` enum has been moved from `AbstractMessageListenerContainer` to `ContainerProperties`. + +The `setBatchErrorHandler()` and `setErrorHandler()` methods have been moved from `ContainerProperties` to both `AbstractMessageListenerContainer` and `AbstractKafkaListenerContainerFactory`. + +==== After Rollback Processing + +A new `AfterRollbackProcessor` strategy is provided. +See <> for more information. + +==== `ConcurrentKafkaListenerContainerFactory` Changes + +You can now use the `ConcurrentKafkaListenerContainerFactory` to create and configure any `ConcurrentMessageListenerContainer`, not only those for `@KafkaListener` annotations. +See <> for more information. + +==== Listener Container Changes + +A new container property (`missingTopicsFatal`) has been added. +See <> for more information. + +A `ConsumerStoppedEvent` is now emitted when a consumer terminates. +See <> for more information. + +Batch listeners can optionally receive the complete `ConsumerRecords` object instead of a `List`. +See <> for more information. + +The `DefaultAfterRollbackProcessor` and `SeekToCurrentErrorHandler` can now recover (skip) records that keep failing, and, by default, does so after 10 failures. +They can be configured to publish failed records to a dead-letter topic. + +Starting with version 2.2.4, the consumer's group ID can be used while selecting the dead letter topic name. + +See <>, <>, and <> for more information. + +The `ConsumerStoppingEvent` has been added. +See <> for more information. + +The `SeekToCurrentErrorHandler` can now be configured to commit the offset of a recovered record when the container is configured with `AckMode.MANUAL_IMMEDIATE` (since 2.2.4). +See <> for more information. + +==== @KafkaListener Changes + +You can now override the `concurrency` and `autoStartup` properties of the listener container factory by setting properties on the annotation. +You can now add configuration to determine which headers (if any) are copied to a reply message. +See <> for more information. + +You can now use `@KafkaListener` as a meta-annotation on your own annotations. +See <> for more information. + +It is now easier to configure a `Validator` for `@Payload` validation. +See <> for more information. + +You can now specify kafka consumer properties directly on the annotation; these will override any properties with the same name defined in the consumer factory (since version 2.2.4). +See <> for more information. + +==== Header Mapping Changes + +Headers of type `MimeType` and `MediaType` are now mapped as simple strings in the `RecordHeader` value. +Previously, they were mapped as JSON and only `MimeType` was decoded. +`MediaType` could not be decoded. +They are now simple strings for interoperability. + +Also, the `DefaultKafkaHeaderMapper` has a new `addToStringClasses` method, allowing the specification of types that should be mapped by using `toString()` instead of JSON. +See <> for more information. + +==== Embedded Kafka Changes + +The `KafkaEmbedded` class and its `KafkaRule` interface have been deprecated in favor of the `EmbeddedKafkaBroker` and its JUnit 4 `EmbeddedKafkaRule` wrapper. +The `@EmbeddedKafka` annotation now populates an `EmbeddedKafkaBroker` bean instead of the deprecated `KafkaEmbedded`. +This change allows the use of `@EmbeddedKafka` in JUnit 5 tests. +The `@EmbeddedKafka` annotation now has the attribute `ports` to specify the port that populates the `EmbeddedKafkaBroker`. +See <> for more information. + +==== JsonSerializer/Deserializer Enhancements + +You can now provide type mapping information by using producer and consumer properties. + +New constructors are available on the deserializer to allow overriding the type header information with the supplied target type. + +The `JsonDeserializer` now removes any type information headers by default. + +You can now configure the `JsonDeserializer` to ignore type information headers by using a Kafka property (since 2.2.3). + +See <> for more information. + +==== Kafka Streams Changes + +The streams configuration bean must now be a `KafkaStreamsConfiguration` object instead of a `StreamsConfig` object. + +The `StreamsBuilderFactoryBean` has been moved from package `...core` to `...config`. + +The `KafkaStreamBrancher` has been introduced for better end-user experience when conditional branches are built on top of `KStream` instance. + +See <> and <> for more information. + + +==== Transactional ID + +When a transaction is started by the listener container, the `transactional.id` is now the `transactionIdPrefix` appended with `..`. +This change allows proper fencing of zombies, https://www.confluent.io/blog/transactions-apache-kafka/[as described here]. + + === Changes between 2.0 and 2.1 +[[kafka-client-1.0]] ==== Kafka Client Version This version requires the 1.0.0 `kafka-clients` or higher. diff --git a/src/reference/asciidoc/docinfo.html b/src/reference/asciidoc/docinfo.html new file mode 100644 index 00000000..19e2462b --- /dev/null +++ b/src/reference/asciidoc/docinfo.html @@ -0,0 +1,5 @@ + diff --git a/src/reference/asciidoc/index.adoc b/src/reference/asciidoc/index.adoc index 554df934..495d804d 100644 --- a/src/reference/asciidoc/index.adoc +++ b/src/reference/asciidoc/index.adoc @@ -7,7 +7,9 @@ :hide-uri-scheme: Gary Russell; Artem Bilan; Biju Kunjummen; Jay Bryant +ifdef::backend-html5[] *{project-version}* +endif::[] (C) 2016 - 2019 by Pivotal Software, Inc. diff --git a/src/reference/asciidoc/whats-new.adoc b/src/reference/asciidoc/whats-new.adoc index 9a2cebff..770c932f 100644 --- a/src/reference/asciidoc/whats-new.adoc +++ b/src/reference/asciidoc/whats-new.adoc @@ -1,110 +1,10 @@ -=== What's New in 2.2 Since 2.1 +=== What's New in 2.3 Since 2.2 -This section covers the changes made from version 2.1 to version 2.2. +This section covers the changes made from version 2.2 to version 2.3. +[[kafka-client-2.1]] ==== Kafka Client Version -This version requires the 2.0.0 `kafka-clients` or higher. - -==== Class and Package Changes - -The `ContainerProperties` class has been moved from `org.springframework.kafka.listener.config` to `org.springframework.kafka.listener`. - -The `AckMode` enum has been moved from `AbstractMessageListenerContainer` to `ContainerProperties`. - -The `setBatchErrorHandler()` and `setErrorHandler()` methods have been moved from `ContainerProperties` to both `AbstractMessageListenerContainer` and `AbstractKafkaListenerContainerFactory`. - -==== After Rollback Processing - -A new `AfterRollbackProcessor` strategy is provided. -See <> for more information. - -==== `ConcurrentKafkaListenerContainerFactory` Changes - -You can now use the `ConcurrentKafkaListenerContainerFactory` to create and configure any `ConcurrentMessageListenerContainer`, not only those for `@KafkaListener` annotations. -See <> for more information. - -==== Listener Container Changes - -A new container property (`missingTopicsFatal`) has been added. -See <> for more information. - -A `ConsumerStoppedEvent` is now emitted when a consumer terminates. -See <> for more information. - -Batch listeners can optionally receive the complete `ConsumerRecords` object instead of a `List`. -See <> for more information. - -The `DefaultAfterRollbackProcessor` and `SeekToCurrentErrorHandler` can now recover (skip) records that keep failing, and, by default, does so after 10 failures. -They can be configured to publish failed records to a dead-letter topic. - -Starting with version 2.2.4, the consumer's group ID can be used while selecting the dead letter topic name. - -See <>, <>, and <> for more information. - -The `ConsumerStoppingEvent` has been added. -See <> for more information. - -The `SeekToCurrentErrorHandler` can now be configured to commit the offset of a recovered record when the container is configured with `AckMode.MANUAL_IMMEDIATE` (since 2.2.4). -See <> for more information. - -==== @KafkaListener Changes - -You can now override the `concurrency` and `autoStartup` properties of the listener container factory by setting properties on the annotation. -You can now add configuration to determine which headers (if any) are copied to a reply message. -See <> for more information. - -You can now use `@KafkaListener` as a meta-annotation on your own annotations. -See <> for more information. - -It is now easier to configure a `Validator` for `@Payload` validation. -See <> for more information. - -You can now specify kafka consumer properties directly on the annotation; these will override any properties with the same name defined in the consumer factory (since version 2.2.4). -See <> for more information. - -==== Header Mapping Changes - -Headers of type `MimeType` and `MediaType` are now mapped as simple strings in the `RecordHeader` value. -Previously, they were mapped as JSON and only `MimeType` was decoded. -`MediaType` could not be decoded. -They are now simple strings for interoperability. - -Also, the `DefaultKafkaHeaderMapper` has a new `addToStringClasses` method, allowing the specification of types that should be mapped by using `toString()` instead of JSON. -See <> for more information. - -==== Embedded Kafka Changes - -The `KafkaEmbedded` class and its `KafkaRule` interface have been deprecated in favor of the `EmbeddedKafkaBroker` and its JUnit 4 `EmbeddedKafkaRule` wrapper. -The `@EmbeddedKafka` annotation now populates an `EmbeddedKafkaBroker` bean instead of the deprecated `KafkaEmbedded`. -This change allows the use of `@EmbeddedKafka` in JUnit 5 tests. -The `@EmbeddedKafka` annotation now has the attribute `ports` to specify the port that populates the `EmbeddedKafkaBroker`. -See <> for more information. - -==== JsonSerializer/Deserializer Enhancements - -You can now provide type mapping information by using producer and consumer properties. - -New constructors are available on the deserializer to allow overriding the type header information with the supplied target type. - -The `JsonDeserializer` now removes any type information headers by default. - -You can now configure the `JsonDeserializer` to ignore type information headers by using a Kafka property (since 2.2.3). - -See <> for more information. - -==== Kafka Streams Changes - -The streams configuration bean must now be a `KafkaStreamsConfiguration` object instead of a `StreamsConfig` object. - -The `StreamsBuilderFactoryBean` has been moved from package `...core` to `...config`. - -The `KafkaStreamBrancher` has been introduced for better end-user experience when conditional branches are built on top of `KStream` instance. - -See <> and <> for more information. +This version requires the 2.1.0 `kafka-clients` or higher. -==== Transactional ID - -When a transaction is started by the listener container, the `transactional.id` is now the `transactionIdPrefix` appended with `..`. -This change allows proper fencing of zombies, https://www.confluent.io/blog/transactions-apache-kafka/[as described here].