diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100755 index 000000000..fa4f7b499 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,110 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar old mode 100644 new mode 100755 index 5fd4d5023..01e679973 Binary files a/.mvn/wrapper/maven-wrapper.jar and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties old mode 100644 new mode 100755 index eb9194764..00d32aab1 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip \ No newline at end of file +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip \ No newline at end of file diff --git a/mvnw b/mvnw index 0a7dac221..5551fde8e 100755 --- a/mvnw +++ b/mvnw @@ -54,38 +54,16 @@ case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true - # - # Look for the Apple JDKs first to preserve the existing behaviour, and then look - # for the new JDKs provided by Oracle. - # - if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then - # - # Apple JDKs - # - export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home - fi - - if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then - # - # Apple JDKs - # - export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home - fi - - if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then - # - # Oracle JDKs - # - export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home - fi - - if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then - # - # Apple JDKs - # - export JAVA_HOME=`/usr/libexec/java_home` - fi - ;; + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; esac if [ -z "$JAVA_HOME" ] ; then @@ -130,7 +108,7 @@ if $cygwin ; then CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi -# For Migwn, ensure paths are in UNIX format before anything is touched +# For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" @@ -184,27 +162,28 @@ fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` -fi - # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { - local basedir=$(pwd) - local wdir=$(pwd) + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi - wdir=$(cd "$wdir/.."; pwd) + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround done echo "${basedir}" } @@ -216,30 +195,92 @@ concat_lines() { fi } -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -echo "Running version check" -VERSION=$( sed '\!//' -e 's!.*$!!' ) -echo "The found version is [${VERSION}]" - -if echo $VERSION | egrep -q 'M|RC'; then - echo Activating \"milestone\" profile for version=\"$VERSION\" - echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone" -else - echo Deactivating \"milestone\" profile for version=\"$VERSION\" - echo $MAVEN_ARGS | grep -q milestone && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pmilestone//') -fi - exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} ${MAVEN_ARGS} "$@" + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd old mode 100644 new mode 100755 index b0dc0e7e9..48363fa60 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,145 +1,161 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index 8351a07fa..4601c93c7 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,9 @@ 3.1.0.RELEASE 2.0.0 2.2.0.BUILD-SNAPSHOT + true + true + true spring-cloud-stream-binder-kafka @@ -142,35 +145,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-checkstyle-plugin + + + io.spring.javaformat + spring-javaformat-maven-plugin + @@ -237,4 +219,12 @@ + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/JaasLoginModuleConfiguration.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/JaasLoginModuleConfiguration.java index e249a1868..63fa68b56 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/JaasLoginModuleConfiguration.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/JaasLoginModuleConfiguration.java @@ -54,7 +54,8 @@ public class JaasLoginModuleConfiguration { public void setControlFlag(String controlFlag) { Assert.notNull(controlFlag, "cannot be null"); - this.controlFlag = KafkaJaasLoginModuleInitializer.ControlFlag.valueOf(controlFlag.toUpperCase()); + this.controlFlag = KafkaJaasLoginModuleInitializer.ControlFlag + .valueOf(controlFlag.toUpperCase()); } public Map getOptions() { @@ -64,4 +65,5 @@ public class JaasLoginModuleConfiguration { public void setOptions(Map options) { this.options = options; } + } diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaAdminProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaAdminProperties.java index 0cf2e40e1..afd4984fb 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaAdminProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaAdminProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ import java.util.Map; * * @author Gary Russell * @since 2.0 - * * @deprecated in favor of {@link KafkaTopicProperties} */ @Deprecated diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBinderConfigurationProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBinderConfigurationProperties.java index cfe2f974b..d90b1dd09 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBinderConfigurationProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBinderConfigurationProperties.java @@ -40,8 +40,8 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** - * Configuration properties for the Kafka binder. - * The properties in this class are prefixed with spring.cloud.stream.kafka.binder. + * Configuration properties for the Kafka binder. The properties in this class are + * prefixed with spring.cloud.stream.kafka.binder. * * @author David Turanski * @author Ilayaperumal Gopinathan @@ -127,11 +127,11 @@ public class KafkaBinderConfigurationProperties { private JaasLoginModuleConfiguration jaas; /** - * The bean name of a custom header mapper to use instead of a {@link org.springframework.kafka.support.DefaultKafkaHeaderMapper}. + * The bean name of a custom header mapper to use instead of a + * {@link org.springframework.kafka.support.DefaultKafkaHeaderMapper}. */ private String headerMapperBeanName; - public KafkaBinderConfigurationProperties(KafkaProperties kafkaProperties) { Assert.notNull(kafkaProperties, "'kafkaProperties' cannot be null"); this.kafkaProperties = kafkaProperties; @@ -328,9 +328,8 @@ public class KafkaBinderConfigurationProperties { } /** - * Converts an array of host values to a comma-separated String. - * It will append the default port value, if not already specified. - * + * Converts an array of host values to a comma-separated String. It will append the + * default port value, if not already specified. * @param hosts host string * @param defaultPort port * @return formatted connection string @@ -526,15 +525,18 @@ public class KafkaBinderConfigurationProperties { Map consumerConfiguration = new HashMap<>(); consumerConfiguration.putAll(this.kafkaProperties.buildConsumerProperties()); // Copy configured binder properties that apply to consumers - for (Map.Entry configurationEntry : this.configuration.entrySet()) { + for (Map.Entry configurationEntry : this.configuration + .entrySet()) { if (ConsumerConfig.configNames().contains(configurationEntry.getKey())) { - consumerConfiguration.put(configurationEntry.getKey(), configurationEntry.getValue()); + consumerConfiguration.put(configurationEntry.getKey(), + configurationEntry.getValue()); } } consumerConfiguration.putAll(this.consumerProperties); // Override Spring Boot bootstrap server setting if left to default with the value // configured in the binder - return getConfigurationWithBootstrapServer(consumerConfiguration, ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG); + return getConfigurationWithBootstrapServer(consumerConfiguration, + ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG); } /** @@ -547,18 +549,22 @@ public class KafkaBinderConfigurationProperties { Map producerConfiguration = new HashMap<>(); producerConfiguration.putAll(this.kafkaProperties.buildProducerProperties()); // Copy configured binder properties that apply to producers - for (Map.Entry configurationEntry : this.configuration.entrySet()) { + for (Map.Entry configurationEntry : this.configuration + .entrySet()) { if (ProducerConfig.configNames().contains(configurationEntry.getKey())) { - producerConfiguration.put(configurationEntry.getKey(), configurationEntry.getValue()); + producerConfiguration.put(configurationEntry.getKey(), + configurationEntry.getValue()); } } producerConfiguration.putAll(this.producerProperties); // Override Spring Boot bootstrap server setting if left to default with the value // configured in the binder - return getConfigurationWithBootstrapServer(producerConfiguration, ProducerConfig.BOOTSTRAP_SERVERS_CONFIG); + return getConfigurationWithBootstrapServer(producerConfiguration, + ProducerConfig.BOOTSTRAP_SERVERS_CONFIG); } - private Map getConfigurationWithBootstrapServer(Map configuration, String bootstrapServersConfig) { + private Map getConfigurationWithBootstrapServer( + Map configuration, String bootstrapServersConfig) { if (ObjectUtils.isEmpty(configuration.get(bootstrapServersConfig))) { configuration.put(bootstrapServersConfig, getKafkaConnectionString()); } @@ -568,7 +574,8 @@ public class KafkaBinderConfigurationProperties { @SuppressWarnings("unchecked") List bootStrapServers = (List) configuration .get(bootstrapServersConfig); - if (bootStrapServers.size() == 1 && bootStrapServers.get(0).equals("localhost:9092")) { + if (bootStrapServers.size() == 1 + && bootStrapServers.get(0).equals("localhost:9092")) { configuration.put(bootstrapServersConfig, getKafkaConnectionString()); } } @@ -616,9 +623,10 @@ public class KafkaBinderConfigurationProperties { } /** - * An combination of {@link ProducerProperties} and {@link KafkaProducerProperties} - * so that common and kafka-specific properties can be set for the transactional + * An combination of {@link ProducerProperties} and {@link KafkaProducerProperties} so + * that common and kafka-specific properties can be set for the transactional * producer. + * * @since 2.1 */ public static class CombinedProducerProperties { @@ -643,8 +651,10 @@ public class KafkaBinderConfigurationProperties { return this.producerProperties.getPartitionSelectorExpression(); } - public void setPartitionSelectorExpression(Expression partitionSelectorExpression) { - this.producerProperties.setPartitionSelectorExpression(partitionSelectorExpression); + public void setPartitionSelectorExpression( + Expression partitionSelectorExpression) { + this.producerProperties + .setPartitionSelectorExpression(partitionSelectorExpression); } public @Min(value = 1, message = "Partition count should be greater than zero.") int getPartitionCount() { @@ -663,11 +673,13 @@ public class KafkaBinderConfigurationProperties { this.producerProperties.setRequiredGroups(requiredGroups); } - public @AssertTrue(message = "Partition key expression and partition key extractor class properties are mutually exclusive.") boolean isValidPartitionKeyProperty() { + public @AssertTrue(message = "Partition key expression and partition key extractor class properties " + + "are mutually exclusive.") boolean isValidPartitionKeyProperty() { return this.producerProperties.isValidPartitionKeyProperty(); } - public @AssertTrue(message = "Partition selector class and partition selector expression properties are mutually exclusive.") boolean isValidPartitionSelectorProperty() { + public @AssertTrue(message = "Partition selector class and partition selector expression " + + "properties are mutually exclusive.") boolean isValidPartitionSelectorProperty() { return this.producerProperties.isValidPartitionSelectorProperty(); } @@ -700,7 +712,8 @@ public class KafkaBinderConfigurationProperties { } public void setPartitionKeyExtractorName(String partitionKeyExtractorName) { - this.producerProperties.setPartitionKeyExtractorName(partitionKeyExtractorName); + this.producerProperties + .setPartitionKeyExtractorName(partitionKeyExtractorName); } public String getPartitionSelectorName() { @@ -788,6 +801,7 @@ public class KafkaBinderConfigurationProperties { public KafkaProducerProperties getExtension() { return this.kafkaProducerProperties; } + } } diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBindingProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBindingProperties.java index 121b4612b..8dbb7e782 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBindingProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaBindingProperties.java @@ -45,4 +45,5 @@ public class KafkaBindingProperties implements BinderSpecificPropertiesProvider public void setProducer(KafkaProducerProperties producer) { this.producer = producer; } + } diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java index b1f0ff010..94abdb7cd 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java @@ -40,6 +40,7 @@ public class KafkaConsumerProperties { * Enumeration for starting consumer offset. */ public enum StartOffset { + /** * Starting from earliest offset. */ @@ -58,12 +59,14 @@ public class KafkaConsumerProperties { public long getReferencePoint() { return this.referencePoint; } + } /** * Standard headers for the message. */ public enum StandardHeaders { + /** * No headers. */ @@ -80,6 +83,7 @@ public class KafkaConsumerProperties { * Indicating both ID and timestamp headers. */ both + } private boolean ackEachRecord; @@ -223,6 +227,7 @@ public class KafkaConsumerProperties { public void setDlqProducerProperties(KafkaProducerProperties dlqProducerProperties) { this.dlqProducerProperties = dlqProducerProperties; } + public StandardHeaders getStandardHeaders() { return this.standardHeaders; } diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaExtendedBindingProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaExtendedBindingProperties.java index c1ef8daf8..41ba1697b 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaExtendedBindingProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaExtendedBindingProperties.java @@ -21,7 +21,8 @@ import org.springframework.cloud.stream.binder.AbstractExtendedBindingProperties import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider; /** - * Kafka specific extended binding properties class that extends from {@link AbstractExtendedBindingProperties}. + * Kafka specific extended binding properties class that extends from + * {@link AbstractExtendedBindingProperties}. * * @author Marius Bogoevici * @author Gary Russell @@ -29,8 +30,8 @@ import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider; * @author Oleg Zhurakousky */ @ConfigurationProperties("spring.cloud.stream.kafka") -public class KafkaExtendedBindingProperties - extends AbstractExtendedBindingProperties { +public class KafkaExtendedBindingProperties extends + AbstractExtendedBindingProperties { private static final String DEFAULTS_PREFIX = "spring.cloud.stream.kafka.default"; @@ -43,4 +44,5 @@ public class KafkaExtendedBindingProperties public Class getExtendedPropertiesEntryClass() { return KafkaBindingProperties.class; } + } diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaProducerProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaProducerProperties.java index c930f6ced..26ab0a031 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaProducerProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaProducerProperties.java @@ -159,14 +159,15 @@ public class KafkaProducerProperties { snappy, /** - * lz4 compression + * lz4 compression. */ lz4, - // /** // TODO: uncomment and fix docs when kafka-clients 2.1.0 or newer is the default - // * zstd compression - // */ - // zstd + // /** // TODO: uncomment and fix docs when kafka-clients 2.1.0 or newer is the + // default + // * zstd compression + // */ + // zstd } diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaTopicProperties.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaTopicProperties.java index 1124ca797..65a591b0f 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaTopicProperties.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaTopicProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisioner.java b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisioner.java index be2ab30e7..88a127c0f 100644 --- a/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisioner.java +++ b/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisioner.java @@ -75,8 +75,11 @@ import org.springframework.util.StringUtils; * @author Oleg Zhurakousky * @author Aldo Sinanaj */ -public class KafkaTopicProvisioner implements ProvisioningProvider, - ExtendedProducerProperties>, InitializingBean { +public class KafkaTopicProvisioner implements + // @checkstyle:off + ProvisioningProvider, ExtendedProducerProperties>, + // @checkstyle:on + InitializingBean { private static final int DEFAULT_OPERATION_TIMEOUT = 30; @@ -90,17 +93,18 @@ public class KafkaTopicProvisioner implements ProvisioningProvider> all = describeTopicsResult.all(); + DescribeTopicsResult describeTopicsResult = adminClient + .describeTopics(Collections.singletonList(name)); + KafkaFuture> all = describeTopicsResult + .all(); Map topicDescriptions = null; try { topicDescriptions = all.get(this.operationTimeout, TimeUnit.SECONDS); } catch (Exception ex) { - throw new ProvisioningException("Problems encountered with partitions finding", ex); + throw new ProvisioningException( + "Problems encountered with partitions finding", ex); } TopicDescription topicDescription = topicDescriptions.get(name); partitions = topicDescription.partitions().size(); @@ -155,7 +163,8 @@ public class KafkaTopicProvisioner implements ProvisioningProvider properties) { if (!properties.isMultiplex()) { return doProvisionConsumerDestination(name, group, properties); @@ -169,7 +178,8 @@ public class KafkaTopicProvisioner implements ProvisioningProvider properties) { if (properties.getExtension().isDestinationIsPattern()) { @@ -191,18 +201,24 @@ public class KafkaTopicProvisioner implements ProvisioningProvider> all = describeTopicsResult.all(); + DescribeTopicsResult describeTopicsResult = adminClient + .describeTopics(Collections.singletonList(name)); + KafkaFuture> all = describeTopicsResult + .all(); try { - Map topicDescriptions = all.get(this.operationTimeout, TimeUnit.SECONDS); + Map topicDescriptions = all + .get(this.operationTimeout, TimeUnit.SECONDS); TopicDescription topicDescription = topicDescriptions.get(name); int partitions = topicDescription.partitions().size(); - consumerDestination = createDlqIfNeedBe(adminClient, name, group, properties, anonymous, partitions); + consumerDestination = createDlqIfNeedBe(adminClient, name, group, + properties, anonymous, partitions); if (consumerDestination == null) { - consumerDestination = new KafkaConsumerDestination(name, partitions); + consumerDestination = new KafkaConsumerDestination(name, + partitions); } } catch (Exception ex) { @@ -218,22 +234,24 @@ public class KafkaTopicProvisioner implements ProvisioningProvider adminProps, KafkaProperties bootProps, - KafkaBinderConfigurationProperties binderProps) { + private void normalalizeBootPropsWithBinder(Map adminProps, + KafkaProperties bootProps, KafkaBinderConfigurationProperties binderProps) { // First deal with the outlier String kafkaConnectionString = binderProps.getKafkaConnectionString(); - if (ObjectUtils.isEmpty(adminProps.get(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG)) - || !kafkaConnectionString.equals(binderProps.getDefaultKafkaConnectionString())) { - adminProps.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaConnectionString); + if (ObjectUtils + .isEmpty(adminProps.get(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG)) + || !kafkaConnectionString + .equals(binderProps.getDefaultKafkaConnectionString())) { + adminProps.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, + kafkaConnectionString); } // Now override any boot values with binder values Map binderProperties = binderProps.getConfiguration(); @@ -246,21 +264,24 @@ public class KafkaTopicProvisioner implements ProvisioningProvider properties, - boolean anonymous, int partitions) { + private ConsumerDestination createDlqIfNeedBe(AdminClient adminClient, String name, + String group, ExtendedConsumerProperties properties, + boolean anonymous, int partitions) { if (properties.getExtension().isEnableDlq() && !anonymous) { - String dlqTopic = StringUtils.hasText(properties.getExtension().getDlqName()) ? - properties.getExtension().getDlqName() : "error." + name + "." + group; + String dlqTopic = StringUtils.hasText(properties.getExtension().getDlqName()) + ? properties.getExtension().getDlqName() + : "error." + name + "." + group; try { createTopicAndPartitions(adminClient, dlqTopic, partitions, - properties.getExtension().isAutoRebalanceEnabled(), properties.getExtension().getTopic()); + properties.getExtension().isAutoRebalanceEnabled(), + properties.getExtension().getTopic()); } catch (Throwable throwable) { if (throwable instanceof Error) { @@ -275,29 +296,34 @@ public class KafkaTopicProvisioner implements ProvisioningProvider> namesFutures = listTopicsResult.names(); @@ -323,54 +351,71 @@ public class KafkaTopicProvisioner implements ProvisioningProvider names = namesFutures.get(this.operationTimeout, TimeUnit.SECONDS); if (names.contains(topicName)) { // only consider minPartitionCount for resizing if autoAddPartitions is true - int effectivePartitionCount = this.configurationProperties.isAutoAddPartitions() - ? Math.max(this.configurationProperties.getMinPartitionCount(), partitionCount) - : partitionCount; - DescribeTopicsResult describeTopicsResult = adminClient.describeTopics(Collections.singletonList(topicName)); - KafkaFuture> topicDescriptionsFuture = describeTopicsResult.all(); - Map topicDescriptions = topicDescriptionsFuture.get(this.operationTimeout, TimeUnit.SECONDS); + int effectivePartitionCount = this.configurationProperties + .isAutoAddPartitions() + ? Math.max( + this.configurationProperties.getMinPartitionCount(), + partitionCount) + : partitionCount; + DescribeTopicsResult describeTopicsResult = adminClient + .describeTopics(Collections.singletonList(topicName)); + KafkaFuture> topicDescriptionsFuture = describeTopicsResult + .all(); + Map topicDescriptions = topicDescriptionsFuture + .get(this.operationTimeout, TimeUnit.SECONDS); TopicDescription topicDescription = topicDescriptions.get(topicName); int partitionSize = topicDescription.partitions().size(); if (partitionSize < effectivePartitionCount) { if (this.configurationProperties.isAutoAddPartitions()) { - CreatePartitionsResult partitions = adminClient.createPartitions( - Collections.singletonMap(topicName, NewPartitions.increaseTo(effectivePartitionCount))); + CreatePartitionsResult partitions = adminClient + .createPartitions(Collections.singletonMap(topicName, + NewPartitions.increaseTo(effectivePartitionCount))); partitions.all().get(this.operationTimeout, TimeUnit.SECONDS); } else if (tolerateLowerPartitionsOnBroker) { - this.logger.warn("The number of expected partitions was: " + partitionCount + ", but " - + partitionSize + (partitionSize > 1 ? " have " : " has ") + "been found instead." - + "There will be " + (effectivePartitionCount - partitionSize) + " idle consumers"); + this.logger.warn("The number of expected partitions was: " + + partitionCount + ", but " + partitionSize + + (partitionSize > 1 ? " have " : " has ") + + "been found instead." + "There will be " + + (effectivePartitionCount - partitionSize) + + " idle consumers"); } else { - throw new ProvisioningException("The number of expected partitions was: " + partitionCount + ", but " - + partitionSize + (partitionSize > 1 ? " have " : " has ") + "been found instead." - + "Consider either increasing the partition count of the topic or enabling " + - "`autoAddPartitions`"); + throw new ProvisioningException( + "The number of expected partitions was: " + partitionCount + + ", but " + partitionSize + + (partitionSize > 1 ? " have " : " has ") + + "been found instead." + + "Consider either increasing the partition count of the topic or enabling " + + "`autoAddPartitions`"); } } } else { // always consider minPartitionCount for topic creation - final int effectivePartitionCount = Math.max(this.configurationProperties.getMinPartitionCount(), - partitionCount); + final int effectivePartitionCount = Math.max( + this.configurationProperties.getMinPartitionCount(), partitionCount); this.metadataRetryOperations.execute((context) -> { NewTopic newTopic; - Map> replicasAssignments = topicProperties.getReplicasAssignments(); - if (replicasAssignments != null && replicasAssignments.size() > 0) { - newTopic = new NewTopic(topicName, topicProperties.getReplicasAssignments()); + Map> replicasAssignments = topicProperties + .getReplicasAssignments(); + if (replicasAssignments != null && replicasAssignments.size() > 0) { + newTopic = new NewTopic(topicName, + topicProperties.getReplicasAssignments()); } else { newTopic = new NewTopic(topicName, effectivePartitionCount, topicProperties.getReplicationFactor() != null ? topicProperties.getReplicationFactor() - : this.configurationProperties.getReplicationFactor()); + : this.configurationProperties + .getReplicationFactor()); } if (topicProperties.getProperties().size() > 0) { newTopic.configs(topicProperties.getProperties()); } - CreateTopicsResult createTopicsResult = adminClient.createTopics(Collections.singletonList(newTopic)); + CreateTopicsResult createTopicsResult = adminClient + .createTopics(Collections.singletonList(newTopic)); try { createTopicsResult.all().get(this.operationTimeout, TimeUnit.SECONDS); } @@ -378,7 +423,8 @@ public class KafkaTopicProvisioner implements ProvisioningProvider getPartitionsForTopic(final int partitionCount, - final boolean tolerateLowerPartitionsOnBroker, - final Callable> callable, - final String topicName) { + final boolean tolerateLowerPartitionsOnBroker, + final Callable> callable, final String topicName) { try { - return this.metadataRetryOperations - .execute((context) -> { - Collection partitions = Collections.emptyList(); + return this.metadataRetryOperations.execute((context) -> { + Collection partitions = Collections.emptyList(); - try { - //This call may return null or throw an exception. - partitions = callable.call(); + try { + // This call may return null or throw an exception. + partitions = callable.call(); + } + catch (Exception ex) { + // The above call can potentially throw exceptions such as timeout. If + // we can determine + // that the exception was due to an unknown topic on the broker, just + // simply rethrow that. + if (ex instanceof UnknownTopicOrPartitionException) { + throw ex; + } + this.logger.error("Failed to obtain partition information", ex); + } + if (CollectionUtils.isEmpty(partitions)) { + final AdminClient adminClient = AdminClient + .create(this.adminClientProperties); + final DescribeTopicsResult describeTopicsResult = adminClient + .describeTopics(Collections.singletonList(topicName)); + try { + describeTopicsResult.all().get(); + } + catch (ExecutionException ex) { + if (ex.getCause() instanceof UnknownTopicOrPartitionException) { + throw (UnknownTopicOrPartitionException) ex.getCause(); } - catch (Exception ex) { - //The above call can potentially throw exceptions such as timeout. If we can determine - //that the exception was due to an unknown topic on the broker, just simply rethrow that. - if (ex instanceof UnknownTopicOrPartitionException) { - throw ex; - } - this.logger.error("Failed to obtain partition information", ex); + else { + logger.warn("No partitions have been retrieved for the topic " + + "(" + topicName + + "). This will affect the health check."); } - if (CollectionUtils.isEmpty(partitions)) { - final AdminClient adminClient = AdminClient.create(this.adminClientProperties); - final DescribeTopicsResult describeTopicsResult = adminClient.describeTopics(Collections.singletonList(topicName)); - try { - describeTopicsResult.all().get(); - } - catch (ExecutionException ex) { - if (ex.getCause() instanceof UnknownTopicOrPartitionException) { - throw (UnknownTopicOrPartitionException)ex.getCause(); - } else { - logger.warn("No partitions have been retrieved for the topic (" + topicName + "). This will affect the health check."); - } - } - } - // do a sanity check on the partition set - int partitionSize = partitions.size(); - if (partitionSize < partitionCount) { - if (tolerateLowerPartitionsOnBroker) { - this.logger.warn("The number of expected partitions was: " + partitionCount + ", but " - + partitionSize + (partitionSize > 1 ? " have " : " has ") + "been found instead." - + "There will be " + (partitionCount - partitionSize) + " idle consumers"); - } - else { - throw new IllegalStateException("The number of expected partitions was: " - + partitionCount + ", but " + partitionSize - + (partitionSize > 1 ? " have " : " has ") + "been found instead"); - } - } - return partitions; - }); + } + } + // do a sanity check on the partition set + int partitionSize = partitions.size(); + if (partitionSize < partitionCount) { + if (tolerateLowerPartitionsOnBroker) { + this.logger.warn("The number of expected partitions was: " + + partitionCount + ", but " + partitionSize + + (partitionSize > 1 ? " have " : " has ") + + "been found instead." + "There will be " + + (partitionCount - partitionSize) + " idle consumers"); + } + else { + throw new IllegalStateException( + "The number of expected partitions was: " + partitionCount + + ", but " + partitionSize + + (partitionSize > 1 ? " have " : " has ") + + "been found instead"); + } + } + return partitions; + }); } catch (Exception ex) { this.logger.error("Cannot initialize Binder", ex); @@ -477,11 +532,10 @@ public class KafkaTopicProvisioner implements ProvisioningProvider= 'a') && (b <= 'z') || (b >= 'A') && (b <= 'Z') || (b >= '0') && (b <= '9') || (b == '.') - || (b == '-') || (b == '_'))) { + if (!((b >= 'a') && (b <= 'z') || (b >= 'A') && (b <= 'Z') + || (b >= '0') && (b <= '9') || (b == '.') || (b == '-') + || (b == '_'))) { throw new IllegalArgumentException( - "Topic name can only have ASCII alphanumerics, '.', '_' and '-', but was: '" + topicName - + "'"); + "Topic name can only have ASCII alphanumerics, '.', '_' and '-', but was: '" + + topicName + "'"); } } } @@ -51,4 +50,5 @@ public final class KafkaTopicUtils { throw new AssertionError(ex); // Can't happen } } + } diff --git a/spring-cloud-stream-binder-kafka-core/src/test/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisionerTests.java b/spring-cloud-stream-binder-kafka-core/src/test/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisionerTests.java index 335c9c31d..d4e8c4c90 100644 --- a/spring-cloud-stream-binder-kafka-core/src/test/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisionerTests.java +++ b/spring-cloud-stream-binder-kafka-core/src/test/java/org/springframework/cloud/stream/binder/kafka/provisioning/KafkaTopicProvisionerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,6 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; - /** * @author Gary Russell * @since 2.0 @@ -47,18 +46,27 @@ public class KafkaTopicProvisionerTests { @Test public void bootPropertiesOverriddenExceptServers() throws Exception { KafkaProperties bootConfig = new KafkaProperties(); - bootConfig.getProperties().put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "PLAINTEXT"); + bootConfig.getProperties().put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, + "PLAINTEXT"); bootConfig.setBootstrapServers(Collections.singletonList("localhost:1234")); - KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties(bootConfig); - binderConfig.getConfiguration().put(AdminClientConfig.SECURITY_PROTOCOL_CONFIG, "SSL"); + KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties( + bootConfig); + binderConfig.getConfiguration().put(AdminClientConfig.SECURITY_PROTOCOL_CONFIG, + "SSL"); ClassPathResource ts = new ClassPathResource("test.truststore.ks"); - binderConfig.getConfiguration().put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, ts.getFile().getAbsolutePath()); + binderConfig.getConfiguration().put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, + ts.getFile().getAbsolutePath()); binderConfig.setBrokers("localhost:9092"); - KafkaTopicProvisioner provisioner = new KafkaTopicProvisioner(binderConfig, bootConfig); + KafkaTopicProvisioner provisioner = new KafkaTopicProvisioner(binderConfig, + bootConfig); AdminClient adminClient = provisioner.createAdminClient(); - assertThat(KafkaTestUtils.getPropertyValue(adminClient, "client.selector.channelBuilder")).isInstanceOf(SslChannelBuilder.class); - Map configs = KafkaTestUtils.getPropertyValue(adminClient, "client.selector.channelBuilder.configs", Map.class); - assertThat(((List) configs.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)).get(0)).isEqualTo("localhost:1234"); + assertThat(KafkaTestUtils.getPropertyValue(adminClient, + "client.selector.channelBuilder")).isInstanceOf(SslChannelBuilder.class); + Map configs = KafkaTestUtils.getPropertyValue(adminClient, + "client.selector.channelBuilder.configs", Map.class); + assertThat( + ((List) configs.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)).get(0)) + .isEqualTo("localhost:1234"); adminClient.close(); } @@ -66,33 +74,44 @@ public class KafkaTopicProvisionerTests { @Test public void bootPropertiesOverriddenIncludingServers() throws Exception { KafkaProperties bootConfig = new KafkaProperties(); - bootConfig.getProperties().put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "PLAINTEXT"); + bootConfig.getProperties().put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, + "PLAINTEXT"); bootConfig.setBootstrapServers(Collections.singletonList("localhost:9092")); - KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties(bootConfig); - binderConfig.getConfiguration().put(AdminClientConfig.SECURITY_PROTOCOL_CONFIG, "SSL"); + KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties( + bootConfig); + binderConfig.getConfiguration().put(AdminClientConfig.SECURITY_PROTOCOL_CONFIG, + "SSL"); ClassPathResource ts = new ClassPathResource("test.truststore.ks"); - binderConfig.getConfiguration().put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, ts.getFile().getAbsolutePath()); + binderConfig.getConfiguration().put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, + ts.getFile().getAbsolutePath()); binderConfig.setBrokers("localhost:1234"); - KafkaTopicProvisioner provisioner = new KafkaTopicProvisioner(binderConfig, bootConfig); + KafkaTopicProvisioner provisioner = new KafkaTopicProvisioner(binderConfig, + bootConfig); AdminClient adminClient = provisioner.createAdminClient(); - assertThat(KafkaTestUtils.getPropertyValue(adminClient, "client.selector.channelBuilder")).isInstanceOf(SslChannelBuilder.class); - Map configs = KafkaTestUtils.getPropertyValue(adminClient, "client.selector.channelBuilder.configs", Map.class); - assertThat(((List) configs.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)).get(0)).isEqualTo("localhost:1234"); + assertThat(KafkaTestUtils.getPropertyValue(adminClient, + "client.selector.channelBuilder")).isInstanceOf(SslChannelBuilder.class); + Map configs = KafkaTestUtils.getPropertyValue(adminClient, + "client.selector.channelBuilder.configs", Map.class); + assertThat( + ((List) configs.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)).get(0)) + .isEqualTo("localhost:1234"); adminClient.close(); } @Test public void brokersInvalid() throws Exception { KafkaProperties bootConfig = new KafkaProperties(); - KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties(bootConfig); - binderConfig.getConfiguration().put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, "localhost:1234"); + KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties( + bootConfig); + binderConfig.getConfiguration().put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, + "localhost:1234"); try { new KafkaTopicProvisioner(binderConfig, bootConfig); fail("Expected illegal state"); } catch (IllegalStateException e) { - assertThat(e.getMessage()) - .isEqualTo("Set binder bootstrap servers via the 'brokers' property, not 'configuration'"); + assertThat(e.getMessage()).isEqualTo( + "Set binder bootstrap servers via the 'brokers' property, not 'configuration'"); } } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinder.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinder.java index ab2a07c3e..444e5e8fd 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinder.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,27 +36,35 @@ import org.springframework.util.StringUtils; /** * An {@link AbstractBinder} implementation for {@link GlobalKTable}. - * - * Provides only consumer binding for the bound {@link GlobalKTable}. - * Output bindings are not allowed on this binder. + *

+ * Provides only consumer binding for the bound {@link GlobalKTable}. Output bindings are + * not allowed on this binder. * * @author Soby Chacko * @since 2.1.0 */ public class GlobalKTableBinder extends + // @checkstyle:off AbstractBinder, ExtendedConsumerProperties, ExtendedProducerProperties> - implements ExtendedPropertiesBinder, KafkaStreamsConsumerProperties, KafkaStreamsProducerProperties> { + implements + ExtendedPropertiesBinder, KafkaStreamsConsumerProperties, KafkaStreamsProducerProperties> { + // @checkstyle:on private final KafkaStreamsBinderConfigurationProperties binderConfigurationProperties; private final KafkaTopicProvisioner kafkaTopicProvisioner; private final Map kafkaStreamsDlqDispatchers; + // @checkstyle:off private KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties = new KafkaStreamsExtendedBindingProperties(); - public GlobalKTableBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, KafkaTopicProvisioner kafkaTopicProvisioner, - Map kafkaStreamsDlqDispatchers) { + // @checkstyle:on + + public GlobalKTableBinder( + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, + KafkaTopicProvisioner kafkaTopicProvisioner, + Map kafkaStreamsDlqDispatchers) { this.binderConfigurationProperties = binderConfigurationProperties; this.kafkaTopicProvisioner = kafkaTopicProvisioner; this.kafkaStreamsDlqDispatchers = kafkaStreamsDlqDispatchers; @@ -64,31 +72,39 @@ public class GlobalKTableBinder extends @Override @SuppressWarnings("unchecked") - protected Binding> doBindConsumer(String name, String group, GlobalKTable inputTarget, - ExtendedConsumerProperties properties) { + protected Binding> doBindConsumer(String name, + String group, GlobalKTable inputTarget, + ExtendedConsumerProperties properties) { if (!StringUtils.hasText(group)) { group = this.binderConfigurationProperties.getApplicationId(); } - KafkaStreamsBinderUtils.prepareConsumerBinding(name, group, getApplicationContext(), - this.kafkaTopicProvisioner, - this.binderConfigurationProperties, properties, this.kafkaStreamsDlqDispatchers); + KafkaStreamsBinderUtils.prepareConsumerBinding(name, group, + getApplicationContext(), this.kafkaTopicProvisioner, + this.binderConfigurationProperties, properties, + this.kafkaStreamsDlqDispatchers); return new DefaultBinding<>(name, group, inputTarget, null); } @Override - protected Binding> doBindProducer(String name, GlobalKTable outboundBindTarget, - ExtendedProducerProperties properties) { - throw new UnsupportedOperationException("No producer level binding is allowed for GlobalKTable"); + protected Binding> doBindProducer(String name, + GlobalKTable outboundBindTarget, + ExtendedProducerProperties properties) { + throw new UnsupportedOperationException( + "No producer level binding is allowed for GlobalKTable"); } @Override - public KafkaStreamsConsumerProperties getExtendedConsumerProperties(String channelName) { - return this.kafkaStreamsExtendedBindingProperties.getExtendedConsumerProperties(channelName); + public KafkaStreamsConsumerProperties getExtendedConsumerProperties( + String channelName) { + return this.kafkaStreamsExtendedBindingProperties + .getExtendedConsumerProperties(channelName); } @Override - public KafkaStreamsProducerProperties getExtendedProducerProperties(String channelName) { - throw new UnsupportedOperationException("No producer binding is allowed and therefore no properties"); + public KafkaStreamsProducerProperties getExtendedProducerProperties( + String channelName) { + throw new UnsupportedOperationException( + "No producer binding is allowed and therefore no properties"); } @Override @@ -98,7 +114,8 @@ public class GlobalKTableBinder extends @Override public Class getExtendedPropertiesEntryClass() { - return this.kafkaStreamsExtendedBindingProperties.getExtendedPropertiesEntryClass(); + return this.kafkaStreamsExtendedBindingProperties + .getExtendedPropertiesEntryClass(); } } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinderConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinderConfiguration.java index 8db2bd5af..60555c316 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinderConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBinderConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,26 +42,35 @@ public class GlobalKTableBinderConfiguration { @ConditionalOnBean(name = "outerContext") public static BeanFactoryPostProcessor outerContextBeanFactoryPostProcessor() { return (beanFactory) -> { - // It is safe to call getBean("outerContext") here, because this bean is registered as first + // It is safe to call getBean("outerContext") here, because this bean is + // registered as first // and as independent from the parent context. - ApplicationContext outerContext = (ApplicationContext) beanFactory.getBean("outerContext"); - beanFactory.registerSingleton(KafkaStreamsBinderConfigurationProperties.class.getSimpleName(), outerContext - .getBean(KafkaStreamsBinderConfigurationProperties.class)); - beanFactory.registerSingleton(KafkaStreamsBindingInformationCatalogue.class.getSimpleName(), outerContext - .getBean(KafkaStreamsBindingInformationCatalogue.class)); + ApplicationContext outerContext = (ApplicationContext) beanFactory + .getBean("outerContext"); + beanFactory.registerSingleton( + KafkaStreamsBinderConfigurationProperties.class.getSimpleName(), + outerContext + .getBean(KafkaStreamsBinderConfigurationProperties.class)); + beanFactory.registerSingleton( + KafkaStreamsBindingInformationCatalogue.class.getSimpleName(), + outerContext.getBean(KafkaStreamsBindingInformationCatalogue.class)); }; } @Bean - public KafkaTopicProvisioner provisioningProvider(KafkaBinderConfigurationProperties binderConfigurationProperties, - KafkaProperties kafkaProperties) { + public KafkaTopicProvisioner provisioningProvider( + KafkaBinderConfigurationProperties binderConfigurationProperties, + KafkaProperties kafkaProperties) { return new KafkaTopicProvisioner(binderConfigurationProperties, kafkaProperties); } @Bean - public GlobalKTableBinder GlobalKTableBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - KafkaTopicProvisioner kafkaTopicProvisioner, - @Qualifier("kafkaStreamsDlqDispatchers") Map kafkaStreamsDlqDispatchers) { - return new GlobalKTableBinder(binderConfigurationProperties, kafkaTopicProvisioner, kafkaStreamsDlqDispatchers); + public GlobalKTableBinder GlobalKTableBinder( + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, + KafkaTopicProvisioner kafkaTopicProvisioner, + @Qualifier("kafkaStreamsDlqDispatchers") Map kafkaStreamsDlqDispatchers) { + return new GlobalKTableBinder(binderConfigurationProperties, + kafkaTopicProvisioner, kafkaStreamsDlqDispatchers); } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBoundElementFactory.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBoundElementFactory.java index f68a98da7..9219422a2 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBoundElementFactory.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/GlobalKTableBoundElementFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,14 +27,16 @@ import org.springframework.cloud.stream.config.BindingServiceProperties; import org.springframework.util.Assert; /** - * {@link org.springframework.cloud.stream.binding.BindingTargetFactory} for {@link GlobalKTable} + * {@link org.springframework.cloud.stream.binding.BindingTargetFactory} for + * {@link GlobalKTable} * * Input bindings are only created as output bindings on GlobalKTable are not allowed. * * @author Soby Chacko * @since 2.1.0 */ -public class GlobalKTableBoundElementFactory extends AbstractBindingTargetFactory { +public class GlobalKTableBoundElementFactory + extends AbstractBindingTargetFactory { private final BindingServiceProperties bindingServiceProperties; @@ -45,12 +47,17 @@ public class GlobalKTableBoundElementFactory extends AbstractBindingTargetFactor @Override public GlobalKTable createInput(String name) { - ConsumerProperties consumerProperties = this.bindingServiceProperties.getConsumerProperties(name); - //Always set multiplex to true in the kafka streams binder + ConsumerProperties consumerProperties = this.bindingServiceProperties + .getConsumerProperties(name); + // Always set multiplex to true in the kafka streams binder consumerProperties.setMultiplex(true); + // @checkstyle:off GlobalKTableBoundElementFactory.GlobalKTableWrapperHandler wrapper = new GlobalKTableBoundElementFactory.GlobalKTableWrapperHandler(); - ProxyFactory proxyFactory = new ProxyFactory(GlobalKTableBoundElementFactory.GlobalKTableWrapper.class, GlobalKTable.class); + // @checkstyle:on + ProxyFactory proxyFactory = new ProxyFactory( + GlobalKTableBoundElementFactory.GlobalKTableWrapper.class, + GlobalKTable.class); proxyFactory.addAdvice(wrapper); return (GlobalKTable) proxyFactory.getProxy(); @@ -58,17 +65,21 @@ public class GlobalKTableBoundElementFactory extends AbstractBindingTargetFactor @Override public GlobalKTable createOutput(String name) { - throw new UnsupportedOperationException("Outbound operations are not allowed on target type GlobalKTable"); + throw new UnsupportedOperationException( + "Outbound operations are not allowed on target type GlobalKTable"); } /** * Wrapper for GlobalKTable proxy. */ public interface GlobalKTableWrapper { + void wrap(GlobalKTable delegate); + } - private static class GlobalKTableWrapperHandler implements GlobalKTableBoundElementFactory.GlobalKTableWrapper, MethodInterceptor { + private static class GlobalKTableWrapperHandler implements + GlobalKTableBoundElementFactory.GlobalKTableWrapper, MethodInterceptor { private GlobalKTable delegate; @@ -80,17 +91,25 @@ public class GlobalKTableBoundElementFactory extends AbstractBindingTargetFactor @Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { - if (methodInvocation.getMethod().getDeclaringClass().equals(GlobalKTable.class)) { - Assert.notNull(this.delegate, "Trying to prepareConsumerBinding " + methodInvocation - .getMethod() + " but no delegate has been set."); - return methodInvocation.getMethod().invoke(this.delegate, methodInvocation.getArguments()); + if (methodInvocation.getMethod().getDeclaringClass() + .equals(GlobalKTable.class)) { + Assert.notNull(this.delegate, + "Trying to prepareConsumerBinding " + methodInvocation.getMethod() + + " but no delegate has been set."); + return methodInvocation.getMethod().invoke(this.delegate, + methodInvocation.getArguments()); } - else if (methodInvocation.getMethod().getDeclaringClass().equals(GlobalKTableBoundElementFactory.GlobalKTableWrapper.class)) { - return methodInvocation.getMethod().invoke(this, methodInvocation.getArguments()); + else if (methodInvocation.getMethod().getDeclaringClass() + .equals(GlobalKTableBoundElementFactory.GlobalKTableWrapper.class)) { + return methodInvocation.getMethod().invoke(this, + methodInvocation.getArguments()); } else { - throw new IllegalStateException("Only GlobalKTable method invocations are permitted"); + throw new IllegalStateException( + "Only GlobalKTable method invocations are permitted"); } } + } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/InteractiveQueryService.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/InteractiveQueryService.java index 3be5d0da3..1cdd325cc 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/InteractiveQueryService.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/InteractiveQueryService.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ import org.springframework.cloud.stream.binder.kafka.streams.properties.KafkaStr import org.springframework.util.StringUtils; /** - * Services pertinent to the interactive query capabilities of Kafka Streams. This class provides - * services such as querying for a particular store, which instance is hosting a particular store etc. - * This is part of the public API of the kafka streams binder and the users can inject this service in their - * applications to make use of it. + * Services pertinent to the interactive query capabilities of Kafka Streams. This class + * provides services such as querying for a particular store, which instance is hosting a + * particular store etc. This is part of the public API of the kafka streams binder and + * the users can inject this service in their applications to make use of it. * * @author Soby Chacko * @author Renwei Han @@ -42,23 +42,22 @@ import org.springframework.util.StringUtils; public class InteractiveQueryService { private final KafkaStreamsRegistry kafkaStreamsRegistry; + private final KafkaStreamsBinderConfigurationProperties binderConfigurationProperties; /** * Constructor for InteractiveQueryService. - * * @param kafkaStreamsRegistry holding {@link KafkaStreamsRegistry} * @param binderConfigurationProperties kafka Streams binder configuration properties */ public InteractiveQueryService(KafkaStreamsRegistry kafkaStreamsRegistry, - KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { this.kafkaStreamsRegistry = kafkaStreamsRegistry; this.binderConfigurationProperties = binderConfigurationProperties; } /** * Retrieve and return a queryable store by name created in the application. - * * @param storeName name of the queryable store * @param storeType type of the queryable store * @param generic queryable store @@ -73,22 +72,24 @@ public class InteractiveQueryService { } } catch (InvalidStateStoreException ignored) { - //pass through + // pass through } } return null; } /** - * Gets the current {@link HostInfo} that the calling kafka streams application is running on. - * - * Note that the end user applications must provide `applicaiton.server` as a configuration property - * when calling this method. If this is not available, then null is returned. + * Gets the current {@link HostInfo} that the calling kafka streams application is + * running on. * + * Note that the end user applications must provide `applicaiton.server` as a + * configuration property when calling this method. If this is not available, then + * null is returned. * @return the current {@link HostInfo} */ public HostInfo getCurrentHostInfo() { - Map configuration = this.binderConfigurationProperties.getConfiguration(); + Map configuration = this.binderConfigurationProperties + .getConfiguration(); if (configuration.containsKey("application.server")) { String applicationServer = configuration.get("application.server"); @@ -100,27 +101,27 @@ public class InteractiveQueryService { } /** - * Gets the {@link HostInfo} where the provided store and key are hosted on. This may not be the - * current host that is running the application. Kafka Streams will look through all the consumer instances - * under the same application id and retrieves the proper host. - * - * Note that the end user applications must provide `applicaiton.server` as a configuration property - * for all the application instances when calling this method. If this is not available, then null maybe returned. + * Gets the {@link HostInfo} where the provided store and key are hosted on. This may + * not be the current host that is running the application. Kafka Streams will look + * through all the consumer instances under the same application id and retrieves the + * proper host. * + * Note that the end user applications must provide `applicaiton.server` as a + * configuration property for all the application instances when calling this method. + * If this is not available, then null maybe returned. * @param generic type for key * @param store store name * @param key key to look for * @param serializer {@link Serializer} for the key - * @return the {@link HostInfo} where the key for the provided store is hosted currently + * @return the {@link HostInfo} where the key for the provided store is hosted + * currently */ public HostInfo getHostInfo(String store, K key, Serializer serializer) { StreamsMetadata streamsMetadata = this.kafkaStreamsRegistry.getKafkaStreams() .stream() .map((k) -> Optional.ofNullable(k.metadataForKey(store, key, serializer))) - .filter(Optional::isPresent) - .map(Optional::get) - .findFirst() - .orElse(null); + .filter(Optional::isPresent).map(Optional::get).findFirst().orElse(null); return streamsMetadata != null ? streamsMetadata.hostInfo() : null; } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinder.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinder.java index 8327045e1..8b1609119 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinder.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinder.java @@ -40,8 +40,8 @@ import org.springframework.cloud.stream.binder.kafka.streams.properties.KafkaStr import org.springframework.util.StringUtils; /** - * {@link org.springframework.cloud.stream.binder.Binder} implementation for {@link KStream}. - * This implemenation extends from the {@link AbstractBinder} directly. + * {@link org.springframework.cloud.stream.binder.Binder} implementation for + * {@link KStream}. This implemenation extends from the {@link AbstractBinder} directly. *

* Provides both producer and consumer bindings for the bound KStream. * @@ -49,15 +49,22 @@ import org.springframework.util.StringUtils; * @author Soby Chacko */ class KStreamBinder extends + // @checkstyle:off AbstractBinder, ExtendedConsumerProperties, ExtendedProducerProperties> - implements ExtendedPropertiesBinder, KafkaStreamsConsumerProperties, KafkaStreamsProducerProperties> { + implements + ExtendedPropertiesBinder, KafkaStreamsConsumerProperties, KafkaStreamsProducerProperties> { + + // @checkstyle:on private static final Log LOG = LogFactory.getLog(KStreamBinder.class); private final KafkaTopicProvisioner kafkaTopicProvisioner; + // @checkstyle:off private KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties = new KafkaStreamsExtendedBindingProperties(); + // @checkstyle:on + private final KafkaStreamsBinderConfigurationProperties binderConfigurationProperties; private final KafkaStreamsMessageConversionDelegate kafkaStreamsMessageConversionDelegate; @@ -69,11 +76,11 @@ class KStreamBinder extends private final Map kafkaStreamsDlqDispatchers; KStreamBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - KafkaTopicProvisioner kafkaTopicProvisioner, - KafkaStreamsMessageConversionDelegate kafkaStreamsMessageConversionDelegate, - KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, - KeyValueSerdeResolver keyValueSerdeResolver, - Map kafkaStreamsDlqDispatchers) { + KafkaTopicProvisioner kafkaTopicProvisioner, + KafkaStreamsMessageConversionDelegate kafkaStreamsMessageConversionDelegate, + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, + KeyValueSerdeResolver keyValueSerdeResolver, + Map kafkaStreamsDlqDispatchers) { this.binderConfigurationProperties = binderConfigurationProperties; this.kafkaTopicProvisioner = kafkaTopicProvisioner; this.kafkaStreamsMessageConversionDelegate = kafkaStreamsMessageConversionDelegate; @@ -84,57 +91,77 @@ class KStreamBinder extends @Override protected Binding> doBindConsumer(String name, String group, - KStream inputTarget, - ExtendedConsumerProperties properties) { - this.kafkaStreamsBindingInformationCatalogue.registerConsumerProperties(inputTarget, properties.getExtension()); + KStream inputTarget, + // @checkstyle:off + ExtendedConsumerProperties properties) { + // @checkstyle:on + this.kafkaStreamsBindingInformationCatalogue + .registerConsumerProperties(inputTarget, properties.getExtension()); if (!StringUtils.hasText(group)) { group = this.binderConfigurationProperties.getApplicationId(); } - KafkaStreamsBinderUtils.prepareConsumerBinding(name, group, getApplicationContext(), - this.kafkaTopicProvisioner, - this.binderConfigurationProperties, properties, this.kafkaStreamsDlqDispatchers); + KafkaStreamsBinderUtils.prepareConsumerBinding(name, group, + getApplicationContext(), this.kafkaTopicProvisioner, + this.binderConfigurationProperties, properties, + this.kafkaStreamsDlqDispatchers); return new DefaultBinding<>(name, group, inputTarget, null); } @Override @SuppressWarnings("unchecked") - protected Binding> doBindProducer(String name, KStream outboundBindTarget, - ExtendedProducerProperties properties) { + protected Binding> doBindProducer(String name, + KStream outboundBindTarget, + // @checkstyle:off + ExtendedProducerProperties properties) { + // @checkstyle:on ExtendedProducerProperties extendedProducerProperties = new ExtendedProducerProperties<>( new KafkaProducerProperties()); - this.kafkaTopicProvisioner.provisionProducerDestination(name, extendedProducerProperties); - Serde keySerde = this.keyValueSerdeResolver.getOuboundKeySerde(properties.getExtension()); - Serde valueSerde = this.keyValueSerdeResolver.getOutboundValueSerde(properties, properties.getExtension()); - to(properties.isUseNativeEncoding(), name, outboundBindTarget, (Serde) keySerde, (Serde) valueSerde); + this.kafkaTopicProvisioner.provisionProducerDestination(name, + extendedProducerProperties); + Serde keySerde = this.keyValueSerdeResolver + .getOuboundKeySerde(properties.getExtension()); + Serde valueSerde = this.keyValueSerdeResolver.getOutboundValueSerde(properties, + properties.getExtension()); + to(properties.isUseNativeEncoding(), name, outboundBindTarget, + (Serde) keySerde, (Serde) valueSerde); return new DefaultBinding<>(name, null, outboundBindTarget, null); } @SuppressWarnings("unchecked") - private void to(boolean isNativeEncoding, String name, KStream outboundBindTarget, - Serde keySerde, Serde valueSerde) { + private void to(boolean isNativeEncoding, String name, + KStream outboundBindTarget, Serde keySerde, + Serde valueSerde) { if (!isNativeEncoding) { - LOG.info("Native encoding is disabled for " + name + ". Outbound message conversion done by Spring Cloud Stream."); - this.kafkaStreamsMessageConversionDelegate.serializeOnOutbound(outboundBindTarget) + LOG.info("Native encoding is disabled for " + name + + ". Outbound message conversion done by Spring Cloud Stream."); + this.kafkaStreamsMessageConversionDelegate + .serializeOnOutbound(outboundBindTarget) .to(name, Produced.with(keySerde, valueSerde)); } else { - LOG.info("Native encoding is enabled for " + name + ". Outbound serialization done at the broker."); + LOG.info("Native encoding is enabled for " + name + + ". Outbound serialization done at the broker."); outboundBindTarget.to(name, Produced.with(keySerde, valueSerde)); } } @Override - public KafkaStreamsConsumerProperties getExtendedConsumerProperties(String channelName) { - return this.kafkaStreamsExtendedBindingProperties.getExtendedConsumerProperties(channelName); + public KafkaStreamsConsumerProperties getExtendedConsumerProperties( + String channelName) { + return this.kafkaStreamsExtendedBindingProperties + .getExtendedConsumerProperties(channelName); } @Override - public KafkaStreamsProducerProperties getExtendedProducerProperties(String channelName) { - return this.kafkaStreamsExtendedBindingProperties.getExtendedProducerProperties(channelName); + public KafkaStreamsProducerProperties getExtendedProducerProperties( + String channelName) { + return this.kafkaStreamsExtendedBindingProperties + .getExtendedProducerProperties(channelName); } - public void setKafkaStreamsExtendedBindingProperties(KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties) { + public void setKafkaStreamsExtendedBindingProperties( + KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties) { this.kafkaStreamsExtendedBindingProperties = kafkaStreamsExtendedBindingProperties; } @@ -145,6 +172,8 @@ class KStreamBinder extends @Override public Class getExtendedPropertiesEntryClass() { - return this.kafkaStreamsExtendedBindingProperties.getExtendedPropertiesEntryClass(); + return this.kafkaStreamsExtendedBindingProperties + .getExtendedPropertiesEntryClass(); } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinderConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinderConfiguration.java index 22da43c59..fdc1c24f3 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinderConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBinderConfiguration.java @@ -39,28 +39,32 @@ import org.springframework.context.annotation.Import; * @author Soby Chacko */ @Configuration -@Import({KafkaAutoConfiguration.class}) +@Import({ KafkaAutoConfiguration.class }) public class KStreamBinderConfiguration { - @Bean - public KafkaTopicProvisioner provisioningProvider(KafkaStreamsBinderConfigurationProperties kafkaStreamsBinderConfigurationProperties, - KafkaProperties kafkaProperties) { - return new KafkaTopicProvisioner(kafkaStreamsBinderConfigurationProperties, kafkaProperties); + public KafkaTopicProvisioner provisioningProvider( + KafkaStreamsBinderConfigurationProperties kafkaStreamsBinderConfigurationProperties, + KafkaProperties kafkaProperties) { + return new KafkaTopicProvisioner(kafkaStreamsBinderConfigurationProperties, + kafkaProperties); } @Bean - public KStreamBinder kStreamBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - KafkaTopicProvisioner kafkaTopicProvisioner, - KafkaStreamsMessageConversionDelegate KafkaStreamsMessageConversionDelegate, - KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, - KeyValueSerdeResolver keyValueSerdeResolver, - KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties, - @Qualifier("kafkaStreamsDlqDispatchers") Map kafkaStreamsDlqDispatchers) { - KStreamBinder kStreamBinder = new KStreamBinder(binderConfigurationProperties, kafkaTopicProvisioner, - KafkaStreamsMessageConversionDelegate, KafkaStreamsBindingInformationCatalogue, - keyValueSerdeResolver, kafkaStreamsDlqDispatchers); - kStreamBinder.setKafkaStreamsExtendedBindingProperties(kafkaStreamsExtendedBindingProperties); + public KStreamBinder kStreamBinder( + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, + KafkaTopicProvisioner kafkaTopicProvisioner, + KafkaStreamsMessageConversionDelegate KafkaStreamsMessageConversionDelegate, + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, + KeyValueSerdeResolver keyValueSerdeResolver, + KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties, + @Qualifier("kafkaStreamsDlqDispatchers") Map kafkaStreamsDlqDispatchers) { + KStreamBinder kStreamBinder = new KStreamBinder(binderConfigurationProperties, + kafkaTopicProvisioner, KafkaStreamsMessageConversionDelegate, + KafkaStreamsBindingInformationCatalogue, keyValueSerdeResolver, + kafkaStreamsDlqDispatchers); + kStreamBinder.setKafkaStreamsExtendedBindingProperties( + kafkaStreamsExtendedBindingProperties); return kStreamBinder; } @@ -69,19 +73,26 @@ public class KStreamBinderConfiguration { public static BeanFactoryPostProcessor outerContextBeanFactoryPostProcessor() { return beanFactory -> { - // It is safe to call getBean("outerContext") here, because this bean is registered as first + // It is safe to call getBean("outerContext") here, because this bean is + // registered as first // and as independent from the parent context. - ApplicationContext outerContext = (ApplicationContext) beanFactory.getBean("outerContext"); - beanFactory.registerSingleton(KafkaStreamsBinderConfigurationProperties.class.getSimpleName(), outerContext - .getBean(KafkaStreamsBinderConfigurationProperties.class)); - beanFactory.registerSingleton(KafkaStreamsMessageConversionDelegate.class.getSimpleName(), outerContext - .getBean(KafkaStreamsMessageConversionDelegate.class)); - beanFactory.registerSingleton(KafkaStreamsBindingInformationCatalogue.class.getSimpleName(), outerContext - .getBean(KafkaStreamsBindingInformationCatalogue.class)); - beanFactory.registerSingleton(KeyValueSerdeResolver.class.getSimpleName(), outerContext - .getBean(KeyValueSerdeResolver.class)); - beanFactory.registerSingleton(KafkaStreamsExtendedBindingProperties.class.getSimpleName(), outerContext - .getBean(KafkaStreamsExtendedBindingProperties.class)); + ApplicationContext outerContext = (ApplicationContext) beanFactory + .getBean("outerContext"); + beanFactory.registerSingleton( + KafkaStreamsBinderConfigurationProperties.class.getSimpleName(), + outerContext + .getBean(KafkaStreamsBinderConfigurationProperties.class)); + beanFactory.registerSingleton( + KafkaStreamsMessageConversionDelegate.class.getSimpleName(), + outerContext.getBean(KafkaStreamsMessageConversionDelegate.class)); + beanFactory.registerSingleton( + KafkaStreamsBindingInformationCatalogue.class.getSimpleName(), + outerContext.getBean(KafkaStreamsBindingInformationCatalogue.class)); + beanFactory.registerSingleton(KeyValueSerdeResolver.class.getSimpleName(), + outerContext.getBean(KeyValueSerdeResolver.class)); + beanFactory.registerSingleton( + KafkaStreamsExtendedBindingProperties.class.getSimpleName(), + outerContext.getBean(KafkaStreamsExtendedBindingProperties.class)); }; } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBoundElementFactory.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBoundElementFactory.java index 18cfa740c..14b8afccf 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBoundElementFactory.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamBoundElementFactory.java @@ -28,10 +28,11 @@ import org.springframework.cloud.stream.config.BindingServiceProperties; import org.springframework.util.Assert; /** - * {@link org.springframework.cloud.stream.binding.BindingTargetFactory} for{@link KStream}. + * {@link org.springframework.cloud.stream.binding.BindingTargetFactory} + * for{@link KStream}. * - * The implementation creates proxies for both input and output binding. - * The actual target will be created downstream through further binding process. + * The implementation creates proxies for both input and output binding. The actual target + * will be created downstream through further binding process. * * @author Marius Bogoevici * @author Soby Chacko @@ -43,7 +44,7 @@ class KStreamBoundElementFactory extends AbstractBindingTargetFactory { private final KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue; KStreamBoundElementFactory(BindingServiceProperties bindingServiceProperties, - KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { super(KStream.class); this.bindingServiceProperties = bindingServiceProperties; this.kafkaStreamsBindingInformationCatalogue = KafkaStreamsBindingInformationCatalogue; @@ -51,8 +52,9 @@ class KStreamBoundElementFactory extends AbstractBindingTargetFactory { @Override public KStream createInput(String name) { - ConsumerProperties consumerProperties = this.bindingServiceProperties.getConsumerProperties(name); - //Always set multiplex to true in the kafka streams binder + ConsumerProperties consumerProperties = this.bindingServiceProperties + .getConsumerProperties(name); + // Always set multiplex to true in the kafka streams binder consumerProperties.setMultiplex(true); return createProxyForKStream(name); } @@ -70,9 +72,12 @@ class KStreamBoundElementFactory extends AbstractBindingTargetFactory { KStream proxy = (KStream) proxyFactory.getProxy(); - //Add the binding properties to the catalogue for later retrieval during further binding steps downstream. - BindingProperties bindingProperties = this.bindingServiceProperties.getBindingProperties(name); - this.kafkaStreamsBindingInformationCatalogue.registerBindingProperties(proxy, bindingProperties); + // Add the binding properties to the catalogue for later retrieval during further + // binding steps downstream. + BindingProperties bindingProperties = this.bindingServiceProperties + .getBindingProperties(name); + this.kafkaStreamsBindingInformationCatalogue.registerBindingProperties(proxy, + bindingProperties); return proxy; } @@ -85,7 +90,8 @@ class KStreamBoundElementFactory extends AbstractBindingTargetFactory { } - private static class KStreamWrapperHandler implements KStreamWrapper, MethodInterceptor { + private static class KStreamWrapperHandler + implements KStreamWrapper, MethodInterceptor { private KStream delegate; @@ -98,16 +104,23 @@ class KStreamBoundElementFactory extends AbstractBindingTargetFactory { @Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { if (methodInvocation.getMethod().getDeclaringClass().equals(KStream.class)) { - Assert.notNull(this.delegate, "Trying to prepareConsumerBinding " + methodInvocation - .getMethod() + " but no delegate has been set."); - return methodInvocation.getMethod().invoke(this.delegate, methodInvocation.getArguments()); + Assert.notNull(this.delegate, + "Trying to prepareConsumerBinding " + methodInvocation.getMethod() + + " but no delegate has been set."); + return methodInvocation.getMethod().invoke(this.delegate, + methodInvocation.getArguments()); } - else if (methodInvocation.getMethod().getDeclaringClass().equals(KStreamWrapper.class)) { - return methodInvocation.getMethod().invoke(this, methodInvocation.getArguments()); + else if (methodInvocation.getMethod().getDeclaringClass() + .equals(KStreamWrapper.class)) { + return methodInvocation.getMethod().invoke(this, + methodInvocation.getArguments()); } else { - throw new IllegalStateException("Only KStream method invocations are permitted"); + throw new IllegalStateException( + "Only KStream method invocations are permitted"); } } + } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerParameterAdapter.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerParameterAdapter.java index 3ba721c19..5d93c8197 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerParameterAdapter.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerParameterAdapter.java @@ -28,13 +28,16 @@ import org.springframework.core.ResolvableType; * @author Marius Bogoevici * @author Soby Chacko */ -class KStreamStreamListenerParameterAdapter implements StreamListenerParameterAdapter, KStream> { +class KStreamStreamListenerParameterAdapter + implements StreamListenerParameterAdapter, KStream> { private final KafkaStreamsMessageConversionDelegate kafkaStreamsMessageConversionDelegate; + private final KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue; - KStreamStreamListenerParameterAdapter(KafkaStreamsMessageConversionDelegate kafkaStreamsMessageConversionDelegate, - KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { + KStreamStreamListenerParameterAdapter( + KafkaStreamsMessageConversionDelegate kafkaStreamsMessageConversionDelegate, + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { this.kafkaStreamsMessageConversionDelegate = kafkaStreamsMessageConversionDelegate; this.KafkaStreamsBindingInformationCatalogue = KafkaStreamsBindingInformationCatalogue; } @@ -51,11 +54,14 @@ class KStreamStreamListenerParameterAdapter implements StreamListenerParameterAd ResolvableType resolvableType = ResolvableType.forMethodParameter(parameter); final Class valueClass = (resolvableType.getGeneric(1).getRawClass() != null) ? (resolvableType.getGeneric(1).getRawClass()) : Object.class; - if (this.KafkaStreamsBindingInformationCatalogue.isUseNativeDecoding(bindingTarget)) { + if (this.KafkaStreamsBindingInformationCatalogue + .isUseNativeDecoding(bindingTarget)) { return bindingTarget; } else { - return this.kafkaStreamsMessageConversionDelegate.deserializeOnInbound(valueClass, bindingTarget); + return this.kafkaStreamsMessageConversionDelegate + .deserializeOnInbound(valueClass, bindingTarget); } } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerResultAdapter.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerResultAdapter.java index 1fdb98949..78d32a33f 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerResultAdapter.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KStreamStreamListenerResultAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,16 +29,19 @@ import org.springframework.cloud.stream.binding.StreamListenerResultAdapter; * @author Marius Bogoevici * @author Soby Chacko */ -class KStreamStreamListenerResultAdapter implements StreamListenerResultAdapter { +class KStreamStreamListenerResultAdapter implements + StreamListenerResultAdapter { @Override public boolean supports(Class resultType, Class boundElement) { - return KStream.class.isAssignableFrom(resultType) && KStream.class.isAssignableFrom(boundElement); + return KStream.class.isAssignableFrom(resultType) + && KStream.class.isAssignableFrom(boundElement); } @Override @SuppressWarnings("unchecked") - public Closeable adapt(KStream streamListenerResult, KStreamBoundElementFactory.KStreamWrapper boundElement) { + public Closeable adapt(KStream streamListenerResult, + KStreamBoundElementFactory.KStreamWrapper boundElement) { boundElement.wrap(streamListenerResult); return new NoOpCloseable(); } @@ -51,4 +54,5 @@ class KStreamStreamListenerResultAdapter implements StreamListenerResultAdapter< } } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinder.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinder.java index 35a2b47b1..b2ef06c97 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinder.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,16 +35,21 @@ import org.springframework.cloud.stream.binder.kafka.streams.properties.KafkaStr import org.springframework.util.StringUtils; /** - * {@link org.springframework.cloud.stream.binder.Binder} implementation for {@link KTable}. - * This implemenation extends from the {@link AbstractBinder} directly. + * {@link org.springframework.cloud.stream.binder.Binder} implementation for + * {@link KTable}. This implemenation extends from the {@link AbstractBinder} directly. * - * Provides only consumer binding for the bound KTable as output bindings are not allowed on it. + * Provides only consumer binding for the bound KTable as output bindings are not allowed + * on it. * * @author Soby Chacko */ class KTableBinder extends + // @checkstyle:off AbstractBinder, ExtendedConsumerProperties, ExtendedProducerProperties> - implements ExtendedPropertiesBinder, KafkaStreamsConsumerProperties, KafkaStreamsProducerProperties> { + implements + ExtendedPropertiesBinder, KafkaStreamsConsumerProperties, KafkaStreamsProducerProperties> { + + // @checkstyle:on private final KafkaStreamsBinderConfigurationProperties binderConfigurationProperties; @@ -52,10 +57,14 @@ class KTableBinder extends private Map kafkaStreamsDlqDispatchers; + // @checkstyle:off private KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties = new KafkaStreamsExtendedBindingProperties(); - KTableBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, KafkaTopicProvisioner kafkaTopicProvisioner, - Map kafkaStreamsDlqDispatchers) { + // @checkstyle:on + + KTableBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, + KafkaTopicProvisioner kafkaTopicProvisioner, + Map kafkaStreamsDlqDispatchers) { this.binderConfigurationProperties = binderConfigurationProperties; this.kafkaTopicProvisioner = kafkaTopicProvisioner; this.kafkaStreamsDlqDispatchers = kafkaStreamsDlqDispatchers; @@ -63,31 +72,43 @@ class KTableBinder extends @Override @SuppressWarnings("unchecked") - protected Binding> doBindConsumer(String name, String group, KTable inputTarget, - ExtendedConsumerProperties properties) { + protected Binding> doBindConsumer(String name, String group, + KTable inputTarget, + // @checkstyle:off + ExtendedConsumerProperties properties) { + // @checkstyle:on if (!StringUtils.hasText(group)) { group = this.binderConfigurationProperties.getApplicationId(); } - KafkaStreamsBinderUtils.prepareConsumerBinding(name, group, getApplicationContext(), - this.kafkaTopicProvisioner, - this.binderConfigurationProperties, properties, this.kafkaStreamsDlqDispatchers); + KafkaStreamsBinderUtils.prepareConsumerBinding(name, group, + getApplicationContext(), this.kafkaTopicProvisioner, + this.binderConfigurationProperties, properties, + this.kafkaStreamsDlqDispatchers); return new DefaultBinding<>(name, group, inputTarget, null); } @Override - protected Binding> doBindProducer(String name, KTable outboundBindTarget, - ExtendedProducerProperties properties) { - throw new UnsupportedOperationException("No producer level binding is allowed for KTable"); + protected Binding> doBindProducer(String name, + KTable outboundBindTarget, + // @checkstyle:off + ExtendedProducerProperties properties) { + // @checkstyle:on + throw new UnsupportedOperationException( + "No producer level binding is allowed for KTable"); } @Override - public KafkaStreamsConsumerProperties getExtendedConsumerProperties(String channelName) { - return this.kafkaStreamsExtendedBindingProperties.getExtendedConsumerProperties(channelName); + public KafkaStreamsConsumerProperties getExtendedConsumerProperties( + String channelName) { + return this.kafkaStreamsExtendedBindingProperties + .getExtendedConsumerProperties(channelName); } @Override - public KafkaStreamsProducerProperties getExtendedProducerProperties(String channelName) { - return this.kafkaStreamsExtendedBindingProperties.getExtendedProducerProperties(channelName); + public KafkaStreamsProducerProperties getExtendedProducerProperties( + String channelName) { + return this.kafkaStreamsExtendedBindingProperties + .getExtendedProducerProperties(channelName); } @Override @@ -97,6 +118,8 @@ class KTableBinder extends @Override public Class getExtendedPropertiesEntryClass() { - return this.kafkaStreamsExtendedBindingProperties.getExtendedPropertiesEntryClass(); + return this.kafkaStreamsExtendedBindingProperties + .getExtendedPropertiesEntryClass(); } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinderConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinderConfiguration.java index effd90cbc..b09f284ee 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinderConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBinderConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,27 +42,36 @@ public class KTableBinderConfiguration { @ConditionalOnBean(name = "outerContext") public static BeanFactoryPostProcessor outerContextBeanFactoryPostProcessor() { return (beanFactory) -> { - // It is safe to call getBean("outerContext") here, because this bean is registered as first + // It is safe to call getBean("outerContext") here, because this bean is + // registered as first // and as independent from the parent context. - ApplicationContext outerContext = (ApplicationContext) beanFactory.getBean("outerContext"); - beanFactory.registerSingleton(KafkaStreamsBinderConfigurationProperties.class.getSimpleName(), outerContext - .getBean(KafkaStreamsBinderConfigurationProperties.class)); - beanFactory.registerSingleton(KafkaStreamsBindingInformationCatalogue.class.getSimpleName(), outerContext - .getBean(KafkaStreamsBindingInformationCatalogue.class)); + ApplicationContext outerContext = (ApplicationContext) beanFactory + .getBean("outerContext"); + beanFactory.registerSingleton( + KafkaStreamsBinderConfigurationProperties.class.getSimpleName(), + outerContext + .getBean(KafkaStreamsBinderConfigurationProperties.class)); + beanFactory.registerSingleton( + KafkaStreamsBindingInformationCatalogue.class.getSimpleName(), + outerContext.getBean(KafkaStreamsBindingInformationCatalogue.class)); }; } @Bean - public KafkaTopicProvisioner provisioningProvider(KafkaBinderConfigurationProperties binderConfigurationProperties, - KafkaProperties kafkaProperties) { + public KafkaTopicProvisioner provisioningProvider( + KafkaBinderConfigurationProperties binderConfigurationProperties, + KafkaProperties kafkaProperties) { return new KafkaTopicProvisioner(binderConfigurationProperties, kafkaProperties); } @Bean - public KTableBinder kTableBinder(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - KafkaTopicProvisioner kafkaTopicProvisioner, - @Qualifier("kafkaStreamsDlqDispatchers") Map kafkaStreamsDlqDispatchers) { - KTableBinder kStreamBinder = new KTableBinder(binderConfigurationProperties, kafkaTopicProvisioner, kafkaStreamsDlqDispatchers); + public KTableBinder kTableBinder( + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, + KafkaTopicProvisioner kafkaTopicProvisioner, + @Qualifier("kafkaStreamsDlqDispatchers") Map kafkaStreamsDlqDispatchers) { + KTableBinder kStreamBinder = new KTableBinder(binderConfigurationProperties, + kafkaTopicProvisioner, kafkaStreamsDlqDispatchers); return kStreamBinder; } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBoundElementFactory.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBoundElementFactory.java index aa917021f..611294a24 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBoundElementFactory.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KTableBoundElementFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,8 @@ import org.springframework.cloud.stream.config.BindingServiceProperties; import org.springframework.util.Assert; /** - * {@link org.springframework.cloud.stream.binding.BindingTargetFactory} for {@link KTable} + * {@link org.springframework.cloud.stream.binding.BindingTargetFactory} for + * {@link KTable} * * Input bindings are only created as output bindings on KTable are not allowed. * @@ -44,12 +45,14 @@ class KTableBoundElementFactory extends AbstractBindingTargetFactory { @Override public KTable createInput(String name) { - ConsumerProperties consumerProperties = this.bindingServiceProperties.getConsumerProperties(name); - //Always set multiplex to true in the kafka streams binder + ConsumerProperties consumerProperties = this.bindingServiceProperties + .getConsumerProperties(name); + // Always set multiplex to true in the kafka streams binder consumerProperties.setMultiplex(true); KTableBoundElementFactory.KTableWrapperHandler wrapper = new KTableBoundElementFactory.KTableWrapperHandler(); - ProxyFactory proxyFactory = new ProxyFactory(KTableBoundElementFactory.KTableWrapper.class, KTable.class); + ProxyFactory proxyFactory = new ProxyFactory( + KTableBoundElementFactory.KTableWrapper.class, KTable.class); proxyFactory.addAdvice(wrapper); return (KTable) proxyFactory.getProxy(); @@ -58,17 +61,21 @@ class KTableBoundElementFactory extends AbstractBindingTargetFactory { @Override @SuppressWarnings("unchecked") public KTable createOutput(final String name) { - throw new UnsupportedOperationException("Outbound operations are not allowed on target type KTable"); + throw new UnsupportedOperationException( + "Outbound operations are not allowed on target type KTable"); } /** * Wrapper for KTable proxy. */ public interface KTableWrapper { + void wrap(KTable delegate); + } - private static class KTableWrapperHandler implements KTableBoundElementFactory.KTableWrapper, MethodInterceptor { + private static class KTableWrapperHandler + implements KTableBoundElementFactory.KTableWrapper, MethodInterceptor { private KTable delegate; @@ -81,16 +88,23 @@ class KTableBoundElementFactory extends AbstractBindingTargetFactory { @Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { if (methodInvocation.getMethod().getDeclaringClass().equals(KTable.class)) { - Assert.notNull(this.delegate, "Trying to prepareConsumerBinding " + methodInvocation - .getMethod() + " but no delegate has been set."); - return methodInvocation.getMethod().invoke(this.delegate, methodInvocation.getArguments()); + Assert.notNull(this.delegate, + "Trying to prepareConsumerBinding " + methodInvocation.getMethod() + + " but no delegate has been set."); + return methodInvocation.getMethod().invoke(this.delegate, + methodInvocation.getArguments()); } - else if (methodInvocation.getMethod().getDeclaringClass().equals(KTableBoundElementFactory.KTableWrapper.class)) { - return methodInvocation.getMethod().invoke(this, methodInvocation.getArguments()); + else if (methodInvocation.getMethod().getDeclaringClass() + .equals(KTableBoundElementFactory.KTableWrapper.class)) { + return methodInvocation.getMethod().invoke(this, + methodInvocation.getArguments()); } else { - throw new IllegalStateException("Only KTable method invocations are permitted"); + throw new IllegalStateException( + "Only KTable method invocations are permitted"); } } + } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsApplicationSupportAutoConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsApplicationSupportAutoConfiguration.java index 7d681a8da..ec07ce051 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsApplicationSupportAutoConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsApplicationSupportAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,9 +35,12 @@ public class KafkaStreamsApplicationSupportAutoConfiguration { @Bean @ConditionalOnProperty("spring.cloud.stream.kafka.streams.timeWindow.length") - public TimeWindows configuredTimeWindow(KafkaStreamsApplicationSupportProperties processorProperties) { + public TimeWindows configuredTimeWindow( + KafkaStreamsApplicationSupportProperties processorProperties) { return processorProperties.getTimeWindow().getAdvanceBy() > 0 - ? TimeWindows.of(processorProperties.getTimeWindow().getLength()).advanceBy(processorProperties.getTimeWindow().getAdvanceBy()) + ? TimeWindows.of(processorProperties.getTimeWindow().getLength()) + .advanceBy(processorProperties.getTimeWindow().getAdvanceBy()) : TimeWindows.of(processorProperties.getTimeWindow().getLength()); } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderSupportAutoConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderSupportAutoConfiguration.java index 49651ee34..968fc9e87 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderSupportAutoConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderSupportAutoConfiguration.java @@ -66,50 +66,61 @@ import org.springframework.util.StringUtils; public class KafkaStreamsBinderSupportAutoConfiguration { private static final String KSTREAM_BINDER_TYPE = "kstream"; + private static final String KTABLE_BINDER_TYPE = "ktable"; + private static final String GLOBALKTABLE_BINDER_TYPE = "globalktable"; @Bean @ConfigurationProperties(prefix = "spring.cloud.stream.kafka.streams.binder") - public KafkaStreamsBinderConfigurationProperties binderConfigurationProperties(KafkaProperties kafkaProperties, - ConfigurableEnvironment environment, - BindingServiceProperties bindingServiceProperties) { - final Map binderConfigurations = getBinderConfigurations(bindingServiceProperties); - for (Map.Entry entry : binderConfigurations.entrySet()) { + public KafkaStreamsBinderConfigurationProperties binderConfigurationProperties( + KafkaProperties kafkaProperties, ConfigurableEnvironment environment, + BindingServiceProperties properties) { + final Map binderConfigurations = getBinderConfigurations( + properties); + for (Map.Entry entry : binderConfigurations + .entrySet()) { final BinderConfiguration binderConfiguration = entry.getValue(); final String binderType = binderConfiguration.getBinderType(); - if (binderType != null && (binderType.equals(KSTREAM_BINDER_TYPE) || - binderType.equals(KTABLE_BINDER_TYPE) || - binderType.equals(GLOBALKTABLE_BINDER_TYPE))) { + if (binderType != null && (binderType.equals(KSTREAM_BINDER_TYPE) + || binderType.equals(KTABLE_BINDER_TYPE) + || binderType.equals(GLOBALKTABLE_BINDER_TYPE))) { Map binderProperties = new HashMap<>(); this.flatten(null, binderConfiguration.getProperties(), binderProperties); - environment.getPropertySources().addFirst(new MapPropertySource("kafkaStreamsBinderEnv", binderProperties)); + environment.getPropertySources().addFirst( + new MapPropertySource("kafkaStreamsBinderEnv", binderProperties)); } } return new KafkaStreamsBinderConfigurationProperties(kafkaProperties); } - //TODO: Lifted from core - good candidate for exposing as a utility method in core. - private static Map getBinderConfigurations(BindingServiceProperties bindingServiceProperties) { + // TODO: Lifted from core - good candidate for exposing as a utility method in core. + private static Map getBinderConfigurations( + BindingServiceProperties properties) { Map binderConfigurations = new HashMap<>(); - Map declaredBinders = bindingServiceProperties.getBinders(); + Map declaredBinders = properties.getBinders(); - for (Map.Entry binderEntry : declaredBinders.entrySet()) { + for (Map.Entry binderEntry : declaredBinders + .entrySet()) { BinderProperties binderProperties = binderEntry.getValue(); binderConfigurations.put(binderEntry.getKey(), - new BinderConfiguration(binderProperties.getType(), binderProperties.getEnvironment(), - binderProperties.isInheritEnvironment(), binderProperties.isDefaultCandidate())); + new BinderConfiguration(binderProperties.getType(), + binderProperties.getEnvironment(), + binderProperties.isInheritEnvironment(), + binderProperties.isDefaultCandidate())); } return binderConfigurations; } - //TODO: Lifted from core - good candidate for exposing as a utility method in core. + // TODO: Lifted from core - good candidate for exposing as a utility method in core. @SuppressWarnings("unchecked") - private void flatten(String propertyName, Object value, Map flattenedProperties) { + private void flatten(String propertyName, Object value, + Map flattenedProperties) { if (value instanceof Map) { - ((Map) value) - .forEach((k, v) -> flatten((propertyName != null ? propertyName + "." : "") + k, v, flattenedProperties)); + ((Map) value).forEach((k, v) -> flatten( + (propertyName != null ? propertyName + "." : "") + k, v, + flattenedProperties)); } else { flattenedProperties.put(propertyName, value.toString()); @@ -117,64 +128,79 @@ public class KafkaStreamsBinderSupportAutoConfiguration { } @Bean - public KafkaStreamsConfiguration kafkaStreamsConfiguration(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - Environment environment) { - KafkaProperties kafkaProperties = binderConfigurationProperties.getKafkaProperties(); + public KafkaStreamsConfiguration kafkaStreamsConfiguration( + KafkaStreamsBinderConfigurationProperties properties, + Environment environment) { + KafkaProperties kafkaProperties = properties.getKafkaProperties(); Map streamsProperties = kafkaProperties.buildStreamsProperties(); if (kafkaProperties.getStreams().getApplicationId() == null) { String applicationName = environment.getProperty("spring.application.name"); if (applicationName != null) { - streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, applicationName); + streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, + applicationName); } } return new KafkaStreamsConfiguration(streamsProperties); } @Bean("streamConfigGlobalProperties") - public Map streamConfigGlobalProperties(KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - KafkaStreamsConfiguration kafkaStreamsConfiguration) { + public Map streamConfigGlobalProperties( + KafkaStreamsBinderConfigurationProperties configProperties, + KafkaStreamsConfiguration kafkaStreamsConfiguration) { Properties properties = kafkaStreamsConfiguration.asProperties(); // Override Spring Boot bootstrap server setting if left to default with the value // configured in the binder if (ObjectUtils.isEmpty(properties.get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG))) { - properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, binderConfigurationProperties.getKafkaConnectionString()); + properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, + configProperties.getKafkaConnectionString()); } else { - Object bootstrapServerConfig = properties.get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG); + Object bootstrapServerConfig = properties + .get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG); if (bootstrapServerConfig instanceof String) { @SuppressWarnings("unchecked") String bootStrapServers = (String) properties .get(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG); if (bootStrapServers.equals("localhost:9092")) { - properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, binderConfigurationProperties.getKafkaConnectionString()); + properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, + configProperties.getKafkaConnectionString()); } } } - String binderProvidedApplicationId = binderConfigurationProperties.getApplicationId(); + String binderProvidedApplicationId = configProperties.getApplicationId(); if (StringUtils.hasText(binderProvidedApplicationId)) { - properties.put(StreamsConfig.APPLICATION_ID_CONFIG, binderProvidedApplicationId); + properties.put(StreamsConfig.APPLICATION_ID_CONFIG, + binderProvidedApplicationId); } - properties.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.ByteArraySerde.class.getName()); - properties.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.ByteArraySerde.class.getName()); + properties.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, + Serdes.ByteArraySerde.class.getName()); + properties.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, + Serdes.ByteArraySerde.class.getName()); - if (binderConfigurationProperties.getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndContinue) { - properties.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, + if (configProperties + .getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndContinue) { + properties.put( + StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, LogAndContinueExceptionHandler.class.getName()); } - else if (binderConfigurationProperties.getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndFail) { - properties.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, + else if (configProperties + .getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndFail) { + properties.put( + StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, LogAndFailExceptionHandler.class.getName()); } - else if (binderConfigurationProperties.getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.sendToDlq) { - properties.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, + else if (configProperties + .getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.sendToDlq) { + properties.put( + StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, SendToDlqAndContinue.class.getName()); } - if (!ObjectUtils.isEmpty(binderConfigurationProperties.getConfiguration())) { - properties.putAll(binderConfigurationProperties.getConfiguration()); + if (!ObjectUtils.isEmpty(configProperties.getConfiguration())) { + properties.putAll(configProperties.getConfiguration()); } return properties.entrySet().stream().collect( Collectors.toMap((e) -> String.valueOf(e.getKey()), Map.Entry::getValue)); @@ -187,8 +213,11 @@ public class KafkaStreamsBinderSupportAutoConfiguration { @Bean public KStreamStreamListenerParameterAdapter kstreamStreamListenerParameterAdapter( - KafkaStreamsMessageConversionDelegate kstreamBoundMessageConversionDelegate, KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { - return new KStreamStreamListenerParameterAdapter(kstreamBoundMessageConversionDelegate, KafkaStreamsBindingInformationCatalogue); + KafkaStreamsMessageConversionDelegate kstreamBoundMessageConversionDelegate, + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { + return new KStreamStreamListenerParameterAdapter( + kstreamBoundMessageConversionDelegate, + KafkaStreamsBindingInformationCatalogue); } @Bean @@ -200,41 +229,48 @@ public class KafkaStreamsBinderSupportAutoConfiguration { KStreamStreamListenerParameterAdapter kafkaStreamListenerParameterAdapter, Collection streamListenerResultAdapters, ObjectProvider cleanupConfig) { - return new KafkaStreamsStreamListenerSetupMethodOrchestrator(bindingServiceProperties, - kafkaStreamsExtendedBindingProperties, keyValueSerdeResolver, kafkaStreamsBindingInformationCatalogue, + return new KafkaStreamsStreamListenerSetupMethodOrchestrator( + bindingServiceProperties, kafkaStreamsExtendedBindingProperties, + keyValueSerdeResolver, kafkaStreamsBindingInformationCatalogue, kafkaStreamListenerParameterAdapter, streamListenerResultAdapters, cleanupConfig.getIfUnique()); } @Bean - public KafkaStreamsMessageConversionDelegate messageConversionDelegate(CompositeMessageConverterFactory compositeMessageConverterFactory, - SendToDlqAndContinue sendToDlqAndContinue, - KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, - KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { - return new KafkaStreamsMessageConversionDelegate(compositeMessageConverterFactory, sendToDlqAndContinue, - KafkaStreamsBindingInformationCatalogue, binderConfigurationProperties); + public KafkaStreamsMessageConversionDelegate messageConversionDelegate( + CompositeMessageConverterFactory compositeMessageConverterFactory, + SendToDlqAndContinue sendToDlqAndContinue, + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue, + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { + return new KafkaStreamsMessageConversionDelegate(compositeMessageConverterFactory, + sendToDlqAndContinue, KafkaStreamsBindingInformationCatalogue, + binderConfigurationProperties); } @Bean - public CompositeNonNativeSerde compositeNonNativeSerde(CompositeMessageConverterFactory compositeMessageConverterFactory) { + public CompositeNonNativeSerde compositeNonNativeSerde( + CompositeMessageConverterFactory compositeMessageConverterFactory) { return new CompositeNonNativeSerde(compositeMessageConverterFactory); } @Bean - public KStreamBoundElementFactory kStreamBoundElementFactory(BindingServiceProperties bindingServiceProperties, - KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { + public KStreamBoundElementFactory kStreamBoundElementFactory( + BindingServiceProperties bindingServiceProperties, + KafkaStreamsBindingInformationCatalogue KafkaStreamsBindingInformationCatalogue) { return new KStreamBoundElementFactory(bindingServiceProperties, KafkaStreamsBindingInformationCatalogue); } @Bean - public KTableBoundElementFactory kTableBoundElementFactory(BindingServiceProperties bindingServiceProperties) { + public KTableBoundElementFactory kTableBoundElementFactory( + BindingServiceProperties bindingServiceProperties) { return new KTableBoundElementFactory(bindingServiceProperties); } @Bean - public GlobalKTableBoundElementFactory globalKTableBoundElementFactory(BindingServiceProperties bindingServiceProperties) { - return new GlobalKTableBoundElementFactory(bindingServiceProperties); + public GlobalKTableBoundElementFactory globalKTableBoundElementFactory( + BindingServiceProperties properties) { + return new GlobalKTableBoundElementFactory(properties); } @Bean @@ -249,20 +285,24 @@ public class KafkaStreamsBinderSupportAutoConfiguration { @Bean @SuppressWarnings("unchecked") - public KeyValueSerdeResolver keyValueSerdeResolver(@Qualifier("streamConfigGlobalProperties") Object streamConfigGlobalProperties, - KafkaStreamsBinderConfigurationProperties kafkaStreamsBinderConfigurationProperties) { - return new KeyValueSerdeResolver((Map) streamConfigGlobalProperties, kafkaStreamsBinderConfigurationProperties); + public KeyValueSerdeResolver keyValueSerdeResolver( + @Qualifier("streamConfigGlobalProperties") Object streamConfigGlobalProperties, + KafkaStreamsBinderConfigurationProperties properties) { + return new KeyValueSerdeResolver( + (Map) streamConfigGlobalProperties, properties); } @Bean - public QueryableStoreRegistry queryableStoreTypeRegistry(KafkaStreamsRegistry kafkaStreamsRegistry) { + public QueryableStoreRegistry queryableStoreTypeRegistry( + KafkaStreamsRegistry kafkaStreamsRegistry) { return new QueryableStoreRegistry(kafkaStreamsRegistry); } @Bean - public InteractiveQueryService interactiveQueryServices(KafkaStreamsRegistry kafkaStreamsRegistry, - KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { - return new InteractiveQueryService(kafkaStreamsRegistry, binderConfigurationProperties); + public InteractiveQueryService interactiveQueryServices( + KafkaStreamsRegistry kafkaStreamsRegistry, + KafkaStreamsBinderConfigurationProperties properties) { + return new InteractiveQueryService(kafkaStreamsRegistry, properties); } @Bean @@ -271,9 +311,10 @@ public class KafkaStreamsBinderSupportAutoConfiguration { } @Bean - public StreamsBuilderFactoryManager streamsBuilderFactoryManager(KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue, - KafkaStreamsRegistry kafkaStreamsRegistry) { - return new StreamsBuilderFactoryManager(kafkaStreamsBindingInformationCatalogue, kafkaStreamsRegistry); + public StreamsBuilderFactoryManager streamsBuilderFactoryManager( + KafkaStreamsBindingInformationCatalogue catalogue, + KafkaStreamsRegistry kafkaStreamsRegistry) { + return new StreamsBuilderFactoryManager(catalogue, kafkaStreamsRegistry); } @Bean("kafkaStreamsDlqDispatchers") diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderUtils.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderUtils.java index 0621d0ba8..16c5f907a 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderUtils.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,35 +37,46 @@ final class KafkaStreamsBinderUtils { } - static void prepareConsumerBinding(String name, String group, ApplicationContext context, - KafkaTopicProvisioner kafkaTopicProvisioner, - KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, - ExtendedConsumerProperties properties, - Map kafkaStreamsDlqDispatchers) { + static void prepareConsumerBinding(String name, String group, + ApplicationContext context, KafkaTopicProvisioner kafkaTopicProvisioner, + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties, + ExtendedConsumerProperties properties, + Map kafkaStreamsDlqDispatchers) { ExtendedConsumerProperties extendedConsumerProperties = new ExtendedConsumerProperties<>( properties.getExtension()); - if (binderConfigurationProperties.getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.sendToDlq) { + if (binderConfigurationProperties + .getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.sendToDlq) { extendedConsumerProperties.getExtension().setEnableDlq(true); } String[] inputTopics = StringUtils.commaDelimitedListToStringArray(name); for (String inputTopic : inputTopics) { - kafkaTopicProvisioner.provisionConsumerDestination(inputTopic, group, extendedConsumerProperties); + kafkaTopicProvisioner.provisionConsumerDestination(inputTopic, group, + extendedConsumerProperties); } if (extendedConsumerProperties.getExtension().isEnableDlq()) { - KafkaStreamsDlqDispatch kafkaStreamsDlqDispatch = !StringUtils.isEmpty(extendedConsumerProperties.getExtension().getDlqName()) ? - new KafkaStreamsDlqDispatch(extendedConsumerProperties.getExtension().getDlqName(), binderConfigurationProperties, - extendedConsumerProperties.getExtension()) : null; + KafkaStreamsDlqDispatch kafkaStreamsDlqDispatch = !StringUtils + .isEmpty(extendedConsumerProperties.getExtension().getDlqName()) + ? new KafkaStreamsDlqDispatch( + extendedConsumerProperties.getExtension() + .getDlqName(), + binderConfigurationProperties, + extendedConsumerProperties.getExtension()) + : null; for (String inputTopic : inputTopics) { - if (StringUtils.isEmpty(extendedConsumerProperties.getExtension().getDlqName())) { + if (StringUtils.isEmpty( + extendedConsumerProperties.getExtension().getDlqName())) { String dlqName = "error." + inputTopic + "." + group; - kafkaStreamsDlqDispatch = new KafkaStreamsDlqDispatch(dlqName, binderConfigurationProperties, + kafkaStreamsDlqDispatch = new KafkaStreamsDlqDispatch(dlqName, + binderConfigurationProperties, extendedConsumerProperties.getExtension()); } - SendToDlqAndContinue sendToDlqAndContinue = context.getBean(SendToDlqAndContinue.class); - sendToDlqAndContinue.addKStreamDlqDispatch(inputTopic, kafkaStreamsDlqDispatch); + SendToDlqAndContinue sendToDlqAndContinue = context + .getBean(SendToDlqAndContinue.class); + sendToDlqAndContinue.addKStreamDlqDispatch(inputTopic, + kafkaStreamsDlqDispatch); kafkaStreamsDlqDispatchers.put(inputTopic, kafkaStreamsDlqDispatch); } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBindingInformationCatalogue.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBindingInformationCatalogue.java index 46cfa918a..e402bb374 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBindingInformationCatalogue.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBindingInformationCatalogue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,11 @@ import org.springframework.cloud.stream.config.BindingProperties; import org.springframework.kafka.config.StreamsBuilderFactoryBean; /** - * A catalogue that provides binding information for Kafka Streams target types such as KStream. - * It also keeps a catalogue for the underlying {@link StreamsBuilderFactoryBean} and - * {@link StreamsConfig} associated with various {@link org.springframework.cloud.stream.annotation.StreamListener} - * methods in the {@link org.springframework.context.ApplicationContext}. + * A catalogue that provides binding information for Kafka Streams target types such as + * KStream. It also keeps a catalogue for the underlying {@link StreamsBuilderFactoryBean} + * and {@link StreamsConfig} associated with various + * {@link org.springframework.cloud.stream.annotation.StreamListener} methods in the + * {@link org.springframework.context.ApplicationContext}. * * @author Soby Chacko */ @@ -46,9 +47,8 @@ class KafkaStreamsBindingInformationCatalogue { private final Set streamsBuilderFactoryBeans = new HashSet<>(); /** - * For a given bounded {@link KStream}, retrieve it's corresponding destination - * on the broker. - * + * For a given bounded {@link KStream}, retrieve it's corresponding destination on the + * broker. * @param bindingTarget binding target for KStream * @return destination topic on Kafka */ @@ -59,7 +59,6 @@ class KafkaStreamsBindingInformationCatalogue { /** * Is native decoding is enabled on this {@link KStream}. - * * @param bindingTarget binding target for KStream * @return true if native decoding is enabled, fasle otherwise. */ @@ -73,7 +72,6 @@ class KafkaStreamsBindingInformationCatalogue { /** * Is DLQ enabled for this {@link KStream}. - * * @param bindingTarget binding target for KStream * @return true if DLQ is enabled, false otherwise. */ @@ -83,7 +81,6 @@ class KafkaStreamsBindingInformationCatalogue { /** * Retrieve the content type associated with a given {@link KStream}. - * * @param bindingTarget binding target for KStream * @return content Type associated. */ @@ -94,28 +91,28 @@ class KafkaStreamsBindingInformationCatalogue { /** * Register a cache for bounded KStream -> {@link BindingProperties}. - * * @param bindingTarget binding target for KStream * @param bindingProperties {@link BindingProperties} for this KStream */ - void registerBindingProperties(KStream bindingTarget, BindingProperties bindingProperties) { + void registerBindingProperties(KStream bindingTarget, + BindingProperties bindingProperties) { this.bindingProperties.put(bindingTarget, bindingProperties); } /** * Register a cache for bounded KStream -> {@link KafkaStreamsConsumerProperties}. - * * @param bindingTarget binding target for KStream * @param kafkaStreamsConsumerProperties consumer properties for this KStream */ - void registerConsumerProperties(KStream bindingTarget, KafkaStreamsConsumerProperties kafkaStreamsConsumerProperties) { + void registerConsumerProperties(KStream bindingTarget, + KafkaStreamsConsumerProperties kafkaStreamsConsumerProperties) { this.consumerProperties.put(bindingTarget, kafkaStreamsConsumerProperties); } /** * Adds a mapping for KStream -> {@link StreamsBuilderFactoryBean}. - * - * @param streamsBuilderFactoryBean provides the {@link StreamsBuilderFactoryBean} mapped to the KStream + * @param streamsBuilderFactoryBean provides the {@link StreamsBuilderFactoryBean} + * mapped to the KStream */ void addStreamBuilderFactory(StreamsBuilderFactoryBean streamsBuilderFactoryBean) { this.streamsBuilderFactoryBeans.add(streamsBuilderFactoryBean); @@ -124,4 +121,5 @@ class KafkaStreamsBindingInformationCatalogue { Set getStreamsBuilderFactoryBeans() { return this.streamsBuilderFactoryBeans; } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsDlqDispatch.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsDlqDispatch.java index a625761b9..e3ab3b103 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsDlqDispatch.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsDlqDispatch.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,10 +53,11 @@ class KafkaStreamsDlqDispatch { private final String dlqName; KafkaStreamsDlqDispatch(String dlqName, - KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties, - KafkaConsumerProperties kafkaConsumerProperties) { + KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties, + KafkaConsumerProperties kafkaConsumerProperties) { ProducerFactory producerFactory = getProducerFactory( - new ExtendedProducerProperties<>(kafkaConsumerProperties.getDlqProducerProperties()), + new ExtendedProducerProperties<>( + kafkaConsumerProperties.getDlqProducerProperties()), kafkaBinderConfigurationProperties); this.kafkaTemplate = new KafkaTemplate<>(producerFactory); @@ -65,55 +66,58 @@ class KafkaStreamsDlqDispatch { @SuppressWarnings("unchecked") public void sendToDlq(byte[] key, byte[] value, int partittion) { - ProducerRecord producerRecord = new ProducerRecord<>(this.dlqName, partittion, - key, value, null); + ProducerRecord producerRecord = new ProducerRecord<>(this.dlqName, + partittion, key, value, null); StringBuilder sb = new StringBuilder().append(" a message with key='") .append(toDisplayString(ObjectUtils.nullSafeToString(key))).append("'") .append(" and payload='") - .append(toDisplayString(ObjectUtils.nullSafeToString(value))) - .append("'").append(" received from ") - .append(partittion); + .append(toDisplayString(ObjectUtils.nullSafeToString(value))).append("'") + .append(" received from ").append(partittion); ListenableFuture> sentDlq = null; try { sentDlq = this.kafkaTemplate.send(producerRecord); - sentDlq.addCallback(new ListenableFutureCallback>() { + sentDlq.addCallback( + new ListenableFutureCallback>() { - @Override - public void onFailure(Throwable ex) { - KafkaStreamsDlqDispatch.this.logger.error( - "Error sending to DLQ " + sb.toString(), ex); - } + @Override + public void onFailure(Throwable ex) { + KafkaStreamsDlqDispatch.this.logger + .error("Error sending to DLQ " + sb.toString(), ex); + } - @Override - public void onSuccess(SendResult result) { - if (KafkaStreamsDlqDispatch.this.logger.isDebugEnabled()) { - KafkaStreamsDlqDispatch.this.logger.debug( - "Sent to DLQ " + sb.toString()); - } - } - }); + @Override + public void onSuccess(SendResult result) { + if (KafkaStreamsDlqDispatch.this.logger.isDebugEnabled()) { + KafkaStreamsDlqDispatch.this.logger + .debug("Sent to DLQ " + sb.toString()); + } + } + }); } catch (Exception ex) { if (sentDlq == null) { - KafkaStreamsDlqDispatch.this.logger.error( - "Error sending to DLQ " + sb.toString(), ex); + KafkaStreamsDlqDispatch.this.logger + .error("Error sending to DLQ " + sb.toString(), ex); } } } - private DefaultKafkaProducerFactory getProducerFactory(ExtendedProducerProperties producerProperties, - KafkaBinderConfigurationProperties configurationProperties) { + private DefaultKafkaProducerFactory getProducerFactory( + ExtendedProducerProperties producerProperties, + KafkaBinderConfigurationProperties configurationProperties) { Map props = new HashMap<>(); props.put(ProducerConfig.RETRIES_CONFIG, 0); props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, 33554432); props.put(ProducerConfig.ACKS_CONFIG, configurationProperties.getRequiredAcks()); - Map mergedConfig = configurationProperties.mergedProducerConfiguration(); + Map mergedConfig = configurationProperties + .mergedProducerConfiguration(); if (!ObjectUtils.isEmpty(mergedConfig)) { props.putAll(mergedConfig); } if (ObjectUtils.isEmpty(props.get(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG))) { - props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, configurationProperties.getKafkaConnectionString()); + props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, + configurationProperties.getKafkaConnectionString()); } if (ObjectUtils.isEmpty(props.get(ProducerConfig.BATCH_SIZE_CONFIG))) { props.put(ProducerConfig.BATCH_SIZE_CONFIG, @@ -130,9 +134,10 @@ class KafkaStreamsDlqDispatch { if (!ObjectUtils.isEmpty(producerProperties.getExtension().getConfiguration())) { props.putAll(producerProperties.getExtension().getConfiguration()); } - //Always send as byte[] on dlq (the same byte[] that the consumer received) + // Always send as byte[] on dlq (the same byte[] that the consumer received) props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class); - props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class); + props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, + ByteArraySerializer.class); return new DefaultKafkaProducerFactory<>(props); } @@ -143,4 +148,5 @@ class KafkaStreamsDlqDispatch { } return original.substring(0, 50) + "..."; } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsMessageConversionDelegate.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsMessageConversionDelegate.java index 302e555ba..d1fb7d4bd 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsMessageConversionDelegate.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsMessageConversionDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,17 +38,18 @@ import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** - * Delegate for handling all framework level message conversions inbound and outbound on {@link KStream}. - * If native encoding is not enabled, then serialization will be performed on outbound messages based - * on a contentType. Similarly, if native decoding is not enabled, deserialization will be performed on - * inbound messages based on a contentType. Based on the contentType, a {@link MessageConverter} will - * be resolved. + * Delegate for handling all framework level message conversions inbound and outbound on + * {@link KStream}. If native encoding is not enabled, then serialization will be + * performed on outbound messages based on a contentType. Similarly, if native decoding is + * not enabled, deserialization will be performed on inbound messages based on a + * contentType. Based on the contentType, a {@link MessageConverter} will be resolved. * * @author Soby Chacko */ public class KafkaStreamsMessageConversionDelegate { - private static final Log LOG = LogFactory.getLog(KafkaStreamsMessageConversionDelegate.class); + private static final Log LOG = LogFactory + .getLog(KafkaStreamsMessageConversionDelegate.class); private static final ThreadLocal> keyValueThreadLocal = new ThreadLocal<>(); @@ -60,10 +61,11 @@ public class KafkaStreamsMessageConversionDelegate { private final KafkaStreamsBinderConfigurationProperties kstreamBinderConfigurationProperties; - KafkaStreamsMessageConversionDelegate(CompositeMessageConverterFactory compositeMessageConverterFactory, - SendToDlqAndContinue sendToDlqAndContinue, - KafkaStreamsBindingInformationCatalogue kstreamBindingInformationCatalogue, - KafkaStreamsBinderConfigurationProperties kstreamBinderConfigurationProperties) { + KafkaStreamsMessageConversionDelegate( + CompositeMessageConverterFactory compositeMessageConverterFactory, + SendToDlqAndContinue sendToDlqAndContinue, + KafkaStreamsBindingInformationCatalogue kstreamBindingInformationCatalogue, + KafkaStreamsBinderConfigurationProperties kstreamBinderConfigurationProperties) { this.compositeMessageConverterFactory = compositeMessageConverterFactory; this.sendToDlqAndContinue = sendToDlqAndContinue; this.kstreamBindingInformationCatalogue = kstreamBindingInformationCatalogue; @@ -72,87 +74,103 @@ public class KafkaStreamsMessageConversionDelegate { /** * Serialize {@link KStream} records on outbound based on contentType. - * * @param outboundBindTarget outbound KStream target * @return serialized KStream */ @SuppressWarnings("rawtypes") public KStream serializeOnOutbound(KStream outboundBindTarget) { - String contentType = this.kstreamBindingInformationCatalogue.getContentType(outboundBindTarget); - MessageConverter messageConverter = this.compositeMessageConverterFactory.getMessageConverterForAllRegistered(); + String contentType = this.kstreamBindingInformationCatalogue + .getContentType(outboundBindTarget); + MessageConverter messageConverter = this.compositeMessageConverterFactory + .getMessageConverterForAllRegistered(); return outboundBindTarget.mapValues((v) -> { - Message message = v instanceof Message ? (Message) v : - MessageBuilder.withPayload(v).build(); + Message message = v instanceof Message ? (Message) v + : MessageBuilder.withPayload(v).build(); Map headers = new HashMap<>(message.getHeaders()); if (!StringUtils.isEmpty(contentType)) { headers.put(MessageHeaders.CONTENT_TYPE, contentType); } MessageHeaders messageHeaders = new MessageHeaders(headers); - return - messageConverter.toMessage(message.getPayload(), - messageHeaders).getPayload(); + return messageConverter.toMessage(message.getPayload(), messageHeaders) + .getPayload(); }); } /** * Deserialize incoming {@link KStream} based on content type. - * * @param valueClass on KStream value * @param bindingTarget inbound KStream target * @return deserialized KStream */ @SuppressWarnings({ "unchecked", "rawtypes" }) - public KStream deserializeOnInbound(Class valueClass, KStream bindingTarget) { - MessageConverter messageConverter = this.compositeMessageConverterFactory.getMessageConverterForAllRegistered(); + public KStream deserializeOnInbound(Class valueClass, + KStream bindingTarget) { + MessageConverter messageConverter = this.compositeMessageConverterFactory + .getMessageConverterForAllRegistered(); final PerRecordContentTypeHolder perRecordContentTypeHolder = new PerRecordContentTypeHolder(); resolvePerRecordContentType(bindingTarget, perRecordContentTypeHolder); - //Deserialize using a branching strategy + // Deserialize using a branching strategy KStream[] branch = bindingTarget.branch( - //First filter where the message is converted and return true if everything went well, return false otherwise. - (o, o2) -> { - boolean isValidRecord = false; + // First filter where the message is converted and return true if + // everything went well, return false otherwise. + (o, o2) -> { + boolean isValidRecord = false; - try { - //if the record is a tombstone, ignore and exit from processing further. - if (o2 != null) { - if (o2 instanceof Message || o2 instanceof String || o2 instanceof byte[]) { - Message m1 = null; - if (o2 instanceof Message) { - m1 = perRecordContentTypeHolder.contentType != null - ? MessageBuilder.fromMessage((Message) o2).setHeader(MessageHeaders.CONTENT_TYPE, - perRecordContentTypeHolder.contentType).build() : (Message) o2; + try { + // if the record is a tombstone, ignore and exit from processing + // further. + if (o2 != null) { + if (o2 instanceof Message || o2 instanceof String + || o2 instanceof byte[]) { + Message m1 = null; + if (o2 instanceof Message) { + m1 = perRecordContentTypeHolder.contentType != null + ? MessageBuilder.fromMessage((Message) o2) + .setHeader( + MessageHeaders.CONTENT_TYPE, + perRecordContentTypeHolder.contentType) + .build() + : (Message) o2; + } + else { + m1 = perRecordContentTypeHolder.contentType != null + ? MessageBuilder.withPayload(o2).setHeader( + MessageHeaders.CONTENT_TYPE, + perRecordContentTypeHolder.contentType) + .build() + : MessageBuilder.withPayload(o2).build(); + } + convertAndSetMessage(o, valueClass, messageConverter, m1); } else { - m1 = perRecordContentTypeHolder.contentType != null ? MessageBuilder.withPayload(o2) - .setHeader(MessageHeaders.CONTENT_TYPE, perRecordContentTypeHolder.contentType).build() : MessageBuilder.withPayload(o2).build(); + keyValueThreadLocal.set(new KeyValue<>(o, o2)); } - convertAndSetMessage(o, valueClass, messageConverter, m1); + isValidRecord = true; } else { - keyValueThreadLocal.set(new KeyValue<>(o, o2)); + LOG.info( + "Received a tombstone record. This will be skipped from further processing."); } - isValidRecord = true; } - else { - LOG.info("Received a tombstone record. This will be skipped from further processing."); + catch (Exception e) { + LOG.warn( + "Deserialization has failed. This will be skipped from further processing.", + e); + // pass through } - } - catch (Exception e) { - LOG.warn("Deserialization has failed. This will be skipped from further processing.", e); - //pass through - } - return isValidRecord; - }, - //second filter that catches any messages for which an exception thrown in the first filter above. - (k, v) -> true - ); - //process errors from the second filter in the branch above. + return isValidRecord; + }, + // second filter that catches any messages for which an exception thrown + // in the first filter above. + (k, v) -> true); + // process errors from the second filter in the branch above. processErrorFromDeserialization(bindingTarget, branch[1]); - //first branch above is the branch where the messages are converted, let it go through further processing. + // first branch above is the branch where the messages are converted, let it go + // through further processing. return branch[0].mapValues((o2) -> { Object objectValue = keyValueThreadLocal.get().value; keyValueThreadLocal.remove(); @@ -161,7 +179,8 @@ public class KafkaStreamsMessageConversionDelegate { } @SuppressWarnings({ "unchecked", "rawtypes" }) - private void resolvePerRecordContentType(KStream outboundBindTarget, PerRecordContentTypeHolder perRecordContentTypeHolder) { + private void resolvePerRecordContentType(KStream outboundBindTarget, + PerRecordContentTypeHolder perRecordContentTypeHolder) { outboundBindTarget.process(() -> new Processor() { ProcessorContext context; @@ -174,11 +193,14 @@ public class KafkaStreamsMessageConversionDelegate { @Override public void process(Object key, Object value) { final Headers headers = this.context.headers(); - final Iterable
contentTypes = headers.headers(MessageHeaders.CONTENT_TYPE); + final Iterable
contentTypes = headers + .headers(MessageHeaders.CONTENT_TYPE); if (contentTypes != null && contentTypes.iterator().hasNext()) { - final String contentType = new String(contentTypes.iterator().next().value()); - //remove leading and trailing quotes - final String cleanContentType = StringUtils.replace(contentType, "\"", ""); + final String contentType = new String( + contentTypes.iterator().next().value()); + // remove leading and trailing quotes + final String cleanContentType = StringUtils.replace(contentType, "\"", + ""); perRecordContentTypeHolder.setContentType(cleanContentType); } } @@ -190,7 +212,8 @@ public class KafkaStreamsMessageConversionDelegate { }); } - private void convertAndSetMessage(Object o, Class valueClass, MessageConverter messageConverter, Message msg) { + private void convertAndSetMessage(Object o, Class valueClass, + MessageConverter messageConverter, Message msg) { Object result = valueClass.isAssignableFrom(msg.getPayload().getClass()) ? msg.getPayload() : messageConverter.fromMessage(msg, valueClass); @@ -200,7 +223,8 @@ public class KafkaStreamsMessageConversionDelegate { } @SuppressWarnings({ "unchecked", "rawtypes" }) - private void processErrorFromDeserialization(KStream bindingTarget, KStream branch) { + private void processErrorFromDeserialization(KStream bindingTarget, + KStream branch) { branch.process(() -> new Processor() { ProcessorContext context; @@ -211,24 +235,35 @@ public class KafkaStreamsMessageConversionDelegate { @Override public void process(Object o, Object o2) { - //Only continue if the record was not a tombstone. + // Only continue if the record was not a tombstone. if (o2 != null) { - if (KafkaStreamsMessageConversionDelegate.this.kstreamBindingInformationCatalogue.isDlqEnabled(bindingTarget)) { + if (KafkaStreamsMessageConversionDelegate.this.kstreamBindingInformationCatalogue + .isDlqEnabled(bindingTarget)) { String destination = this.context.topic(); if (o2 instanceof Message) { Message message = (Message) o2; - KafkaStreamsMessageConversionDelegate.this.sendToDlqAndContinue.sendToDlq(destination, (byte[]) o, (byte[]) message.getPayload(), this.context.partition()); + KafkaStreamsMessageConversionDelegate.this.sendToDlqAndContinue + .sendToDlq(destination, (byte[]) o, + (byte[]) message.getPayload(), + this.context.partition()); } else { - KafkaStreamsMessageConversionDelegate.this.sendToDlqAndContinue.sendToDlq(destination, (byte[]) o, (byte[]) o2, this.context.partition()); + KafkaStreamsMessageConversionDelegate.this.sendToDlqAndContinue + .sendToDlq(destination, (byte[]) o, (byte[]) o2, + this.context.partition()); } } - else if (KafkaStreamsMessageConversionDelegate.this.kstreamBinderConfigurationProperties.getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndFail) { - throw new IllegalStateException("Inbound deserialization failed. Stopping further processing of records."); + else if (KafkaStreamsMessageConversionDelegate.this.kstreamBinderConfigurationProperties + .getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndFail) { + throw new IllegalStateException("Inbound deserialization failed. " + + "Stopping further processing of records."); } - else if (KafkaStreamsMessageConversionDelegate.this.kstreamBinderConfigurationProperties.getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndContinue) { - //quietly passing through. No action needed, this is similar to log and continue. - LOG.error("Inbound deserialization failed. Skipping this record and continuing."); + else if (KafkaStreamsMessageConversionDelegate.this.kstreamBinderConfigurationProperties + .getSerdeError() == KafkaStreamsBinderConfigurationProperties.SerdeError.logAndContinue) { + // quietly passing through. No action needed, this is similar to + // log and continue. + LOG.error( + "Inbound deserialization failed. Skipping this record and continuing."); } } } @@ -247,5 +282,7 @@ public class KafkaStreamsMessageConversionDelegate { void setContentType(String contentType) { this.contentType = contentType; } + } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsRegistry.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsRegistry.java index 4b82ded1c..7e7ce6512 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsRegistry.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,10 +37,10 @@ class KafkaStreamsRegistry { /** * Register the {@link KafkaStreams} object created in the application. - * * @param kafkaStreams {@link KafkaStreams} object created in the application */ void registerKafkaStreams(KafkaStreams kafkaStreams) { this.kafkaStreams.add(kafkaStreams); } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsStreamListenerSetupMethodOrchestrator.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsStreamListenerSetupMethodOrchestrator.java index 10557f754..b451b3f9a 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsStreamListenerSetupMethodOrchestrator.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsStreamListenerSetupMethodOrchestrator.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,17 +81,20 @@ import org.springframework.util.StringUtils; * * The orchestration primarily focus on the following areas: * - * 1. Allow multiple KStream output bindings (KStream branching) by allowing more than one output values on {@link SendTo} - * 2. Allow multiple inbound bindings for multiple KStream and or KTable/GlobalKTable types. - * 3. Each StreamListener method that it orchestrates gets its own {@link StreamsBuilderFactoryBean} and {@link StreamsConfig} + * 1. Allow multiple KStream output bindings (KStream branching) by allowing more than one + * output values on {@link SendTo} 2. Allow multiple inbound bindings for multiple KStream + * and or KTable/GlobalKTable types. 3. Each StreamListener method that it orchestrates + * gets its own {@link StreamsBuilderFactoryBean} and {@link StreamsConfig} * * @author Soby Chacko * @author Lei Chen * @author Gary Russell */ -class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListenerSetupMethodOrchestrator, ApplicationContextAware { +class KafkaStreamsStreamListenerSetupMethodOrchestrator + implements StreamListenerSetupMethodOrchestrator, ApplicationContextAware { - private static final Log LOG = LogFactory.getLog(KafkaStreamsStreamListenerSetupMethodOrchestrator.class); + private static final Log LOG = LogFactory + .getLog(KafkaStreamsStreamListenerSetupMethodOrchestrator.class); private final StreamListenerParameterAdapter streamListenerParameterAdapter; @@ -111,32 +114,33 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene private ConfigurableApplicationContext applicationContext; - KafkaStreamsStreamListenerSetupMethodOrchestrator(BindingServiceProperties bindingServiceProperties, - KafkaStreamsExtendedBindingProperties kafkaStreamsExtendedBindingProperties, - KeyValueSerdeResolver keyValueSerdeResolver, - KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue, - StreamListenerParameterAdapter streamListenerParameterAdapter, - Collection streamListenerResultAdapters, - CleanupConfig cleanupConfig) { + KafkaStreamsStreamListenerSetupMethodOrchestrator( + BindingServiceProperties bindingServiceProperties, + KafkaStreamsExtendedBindingProperties extendedBindingProperties, + KeyValueSerdeResolver keyValueSerdeResolver, + KafkaStreamsBindingInformationCatalogue bindingInformationCatalogue, + StreamListenerParameterAdapter streamListenerParameterAdapter, + Collection listenerResultAdapters, + CleanupConfig cleanupConfig) { this.bindingServiceProperties = bindingServiceProperties; - this.kafkaStreamsExtendedBindingProperties = kafkaStreamsExtendedBindingProperties; + this.kafkaStreamsExtendedBindingProperties = extendedBindingProperties; this.keyValueSerdeResolver = keyValueSerdeResolver; - this.kafkaStreamsBindingInformationCatalogue = kafkaStreamsBindingInformationCatalogue; + this.kafkaStreamsBindingInformationCatalogue = bindingInformationCatalogue; this.streamListenerParameterAdapter = streamListenerParameterAdapter; - this.streamListenerResultAdapters = streamListenerResultAdapters; + this.streamListenerResultAdapters = listenerResultAdapters; this.cleanupConfig = cleanupConfig; } @Override public boolean supports(Method method) { - return methodParameterSupports(method) && - (methodReturnTypeSuppports(method) || Void.TYPE.equals(method.getReturnType())); + return methodParameterSupports(method) && (methodReturnTypeSuppports(method) + || Void.TYPE.equals(method.getReturnType())); } private boolean methodReturnTypeSuppports(Method method) { Class returnType = method.getReturnType(); - if (returnType.equals(KStream.class) || - (returnType.isArray() && returnType.getComponentType().equals(KStream.class))) { + if (returnType.equals(KStream.class) || (returnType.isArray() + && returnType.getComponentType().equals(KStream.class))) { return true; } return false; @@ -156,13 +160,15 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene } @Override - @SuppressWarnings({"rawtypes", "unchecked"}) - public void orchestrateStreamListenerSetupMethod(StreamListener streamListener, Method method, Object bean) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void orchestrateStreamListenerSetupMethod(StreamListener streamListener, + Method method, Object bean) { String[] methodAnnotatedOutboundNames = getOutboundBindingTargetNames(method); - validateStreamListenerMethod(streamListener, method, methodAnnotatedOutboundNames); + validateStreamListenerMethod(streamListener, method, + methodAnnotatedOutboundNames); String methodAnnotatedInboundName = streamListener.value(); - Object[] adaptedInboundArguments = adaptAndRetrieveInboundArguments(method, methodAnnotatedInboundName, - this.applicationContext, + Object[] adaptedInboundArguments = adaptAndRetrieveInboundArguments(method, + methodAnnotatedInboundName, this.applicationContext, this.streamListenerParameterAdapter); try { ReflectionUtils.makeAccessible(method); @@ -173,7 +179,8 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene Object result = method.invoke(bean, adaptedInboundArguments); if (result.getClass().isArray()) { - Assert.isTrue(methodAnnotatedOutboundNames.length == ((Object[]) result).length, + Assert.isTrue( + methodAnnotatedOutboundNames.length == ((Object[]) result).length, "Result does not match with the number of declared outbounds"); } else { @@ -184,19 +191,24 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene Object[] outboundKStreams = (Object[]) result; int i = 0; for (Object outboundKStream : outboundKStreams) { - Object targetBean = this.applicationContext.getBean(methodAnnotatedOutboundNames[i++]); + Object targetBean = this.applicationContext + .getBean(methodAnnotatedOutboundNames[i++]); for (StreamListenerResultAdapter streamListenerResultAdapter : this.streamListenerResultAdapters) { - if (streamListenerResultAdapter.supports(outboundKStream.getClass(), targetBean.getClass())) { - streamListenerResultAdapter.adapt(outboundKStream, targetBean); + if (streamListenerResultAdapter.supports( + outboundKStream.getClass(), targetBean.getClass())) { + streamListenerResultAdapter.adapt(outboundKStream, + targetBean); break; } } } } else { - Object targetBean = this.applicationContext.getBean(methodAnnotatedOutboundNames[0]); + Object targetBean = this.applicationContext + .getBean(methodAnnotatedOutboundNames[0]); for (StreamListenerResultAdapter streamListenerResultAdapter : this.streamListenerResultAdapters) { - if (streamListenerResultAdapter.supports(result.getClass(), targetBean.getClass())) { + if (streamListenerResultAdapter.supports(result.getClass(), + targetBean.getClass())) { streamListenerResultAdapter.adapt(result, targetBean); break; } @@ -205,102 +217,140 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene } } catch (Exception ex) { - throw new BeanInitializationException("Cannot setup StreamListener for " + method, ex); + throw new BeanInitializationException( + "Cannot setup StreamListener for " + method, ex); } } @Override - @SuppressWarnings({"unchecked"}) + @SuppressWarnings({ "unchecked" }) public Object[] adaptAndRetrieveInboundArguments(Method method, String inboundName, - ApplicationContext applicationContext, - StreamListenerParameterAdapter... streamListenerParameterAdapters) { + ApplicationContext applicationContext, + StreamListenerParameterAdapter... adapters) { Object[] arguments = new Object[method.getParameterTypes().length]; for (int parameterIndex = 0; parameterIndex < arguments.length; parameterIndex++) { - MethodParameter methodParameter = MethodParameter.forExecutable(method, parameterIndex); + MethodParameter methodParameter = MethodParameter.forExecutable(method, + parameterIndex); Class parameterType = methodParameter.getParameterType(); Object targetReferenceValue = null; if (methodParameter.hasParameterAnnotation(Input.class)) { - targetReferenceValue = AnnotationUtils.getValue(methodParameter.getParameterAnnotation(Input.class)); - Input methodAnnotation = methodParameter.getParameterAnnotation(Input.class); + targetReferenceValue = AnnotationUtils + .getValue(methodParameter.getParameterAnnotation(Input.class)); + Input methodAnnotation = methodParameter + .getParameterAnnotation(Input.class); inboundName = methodAnnotation.value(); } else if (arguments.length == 1 && StringUtils.hasText(inboundName)) { targetReferenceValue = inboundName; } if (targetReferenceValue != null) { - Assert.isInstanceOf(String.class, targetReferenceValue, "Annotation value must be a String"); - Object targetBean = applicationContext.getBean((String) targetReferenceValue); - BindingProperties bindingProperties = this.bindingServiceProperties.getBindingProperties(inboundName); + Assert.isInstanceOf(String.class, targetReferenceValue, + "Annotation value must be a String"); + Object targetBean = applicationContext + .getBean((String) targetReferenceValue); + BindingProperties bindingProperties = this.bindingServiceProperties + .getBindingProperties(inboundName); enableNativeDecodingForKTableAlways(parameterType, bindingProperties); - //Retrieve the StreamsConfig created for this method if available. - //Otherwise, create the StreamsBuilderFactory and get the underlying config. + // Retrieve the StreamsConfig created for this method if available. + // Otherwise, create the StreamsBuilderFactory and get the underlying + // config. if (!this.methodStreamsBuilderFactoryBeanMap.containsKey(method)) { - buildStreamsBuilderAndRetrieveConfig(method, applicationContext, inboundName); + buildStreamsBuilderAndRetrieveConfig(method, applicationContext, + inboundName); } try { - StreamsBuilderFactoryBean streamsBuilderFactoryBean = this.methodStreamsBuilderFactoryBeanMap.get(method); + StreamsBuilderFactoryBean streamsBuilderFactoryBean = this.methodStreamsBuilderFactoryBeanMap + .get(method); StreamsBuilder streamsBuilder = streamsBuilderFactoryBean.getObject(); - KafkaStreamsConsumerProperties extendedConsumerProperties = this.kafkaStreamsExtendedBindingProperties.getExtendedConsumerProperties(inboundName); - //get state store spec + KafkaStreamsConsumerProperties extendedConsumerProperties = this.kafkaStreamsExtendedBindingProperties + .getExtendedConsumerProperties(inboundName); + // get state store spec KafkaStreamsStateStoreProperties spec = buildStateStoreSpec(method); - Serde keySerde = this.keyValueSerdeResolver.getInboundKeySerde(extendedConsumerProperties); - Serde valueSerde = this.keyValueSerdeResolver.getInboundValueSerde(bindingProperties.getConsumer(), extendedConsumerProperties); + Serde keySerde = this.keyValueSerdeResolver + .getInboundKeySerde(extendedConsumerProperties); + Serde valueSerde = this.keyValueSerdeResolver.getInboundValueSerde( + bindingProperties.getConsumer(), extendedConsumerProperties); - final KafkaConsumerProperties.StartOffset startOffset = extendedConsumerProperties.getStartOffset(); + final KafkaConsumerProperties.StartOffset startOffset = extendedConsumerProperties + .getStartOffset(); Topology.AutoOffsetReset autoOffsetReset = null; if (startOffset != null) { switch (startOffset) { - case earliest : autoOffsetReset = Topology.AutoOffsetReset.EARLIEST; - break; - case latest : autoOffsetReset = Topology.AutoOffsetReset.LATEST; - break; - default: break; + case earliest: + autoOffsetReset = Topology.AutoOffsetReset.EARLIEST; + break; + case latest: + autoOffsetReset = Topology.AutoOffsetReset.LATEST; + break; + default: + break; } } if (extendedConsumerProperties.isResetOffsets()) { - LOG.warn("Detected resetOffsets configured on binding " + inboundName + ". " + LOG.warn("Detected resetOffsets configured on binding " + + inboundName + ". " + "Setting resetOffsets in Kafka Streams binder does not have any effect."); } if (parameterType.isAssignableFrom(KStream.class)) { - KStream stream = getkStream(inboundName, spec, bindingProperties, - streamsBuilder, keySerde, valueSerde, autoOffsetReset); + KStream stream = getkStream(inboundName, spec, + bindingProperties, streamsBuilder, keySerde, valueSerde, + autoOffsetReset); KStreamBoundElementFactory.KStreamWrapper kStreamWrapper = (KStreamBoundElementFactory.KStreamWrapper) targetBean; - //wrap the proxy created during the initial target type binding with real object (KStream) + // wrap the proxy created during the initial target type binding + // with real object (KStream) kStreamWrapper.wrap((KStream) stream); - this.kafkaStreamsBindingInformationCatalogue.addStreamBuilderFactory(streamsBuilderFactoryBean); - for (StreamListenerParameterAdapter streamListenerParameterAdapter : streamListenerParameterAdapters) { - if (streamListenerParameterAdapter.supports(stream.getClass(), methodParameter)) { - arguments[parameterIndex] = streamListenerParameterAdapter.adapt(kStreamWrapper, methodParameter); + this.kafkaStreamsBindingInformationCatalogue + .addStreamBuilderFactory(streamsBuilderFactoryBean); + for (StreamListenerParameterAdapter streamListenerParameterAdapter : adapters) { + if (streamListenerParameterAdapter.supports(stream.getClass(), + methodParameter)) { + arguments[parameterIndex] = streamListenerParameterAdapter + .adapt(kStreamWrapper, methodParameter); break; } } - if (arguments[parameterIndex] == null && parameterType.isAssignableFrom(stream.getClass())) { + if (arguments[parameterIndex] == null + && parameterType.isAssignableFrom(stream.getClass())) { arguments[parameterIndex] = stream; } - Assert.notNull(arguments[parameterIndex], "Cannot convert argument " + parameterIndex + " of " + method - + "from " + stream.getClass() + " to " + parameterType); + Assert.notNull(arguments[parameterIndex], + "Cannot convert argument " + parameterIndex + " of " + + method + "from " + stream.getClass() + " to " + + parameterType); } else if (parameterType.isAssignableFrom(KTable.class)) { - String materializedAs = extendedConsumerProperties.getMaterializedAs(); - String bindingDestination = this.bindingServiceProperties.getBindingDestination(inboundName); - KTable table = getKTable(streamsBuilder, keySerde, valueSerde, materializedAs, - bindingDestination, autoOffsetReset); + String materializedAs = extendedConsumerProperties + .getMaterializedAs(); + String bindingDestination = this.bindingServiceProperties + .getBindingDestination(inboundName); + KTable table = getKTable(streamsBuilder, keySerde, + valueSerde, materializedAs, bindingDestination, + autoOffsetReset); KTableBoundElementFactory.KTableWrapper kTableWrapper = (KTableBoundElementFactory.KTableWrapper) targetBean; - //wrap the proxy created during the initial target type binding with real object (KTable) + // wrap the proxy created during the initial target type binding + // with real object (KTable) kTableWrapper.wrap((KTable) table); - this.kafkaStreamsBindingInformationCatalogue.addStreamBuilderFactory(streamsBuilderFactoryBean); + this.kafkaStreamsBindingInformationCatalogue + .addStreamBuilderFactory(streamsBuilderFactoryBean); arguments[parameterIndex] = table; } else if (parameterType.isAssignableFrom(GlobalKTable.class)) { - String materializedAs = extendedConsumerProperties.getMaterializedAs(); - String bindingDestination = this.bindingServiceProperties.getBindingDestination(inboundName); - GlobalKTable table = getGlobalKTable(streamsBuilder, keySerde, valueSerde, materializedAs, - bindingDestination, autoOffsetReset); + String materializedAs = extendedConsumerProperties + .getMaterializedAs(); + String bindingDestination = this.bindingServiceProperties + .getBindingDestination(inboundName); + GlobalKTable table = getGlobalKTable(streamsBuilder, + keySerde, valueSerde, materializedAs, bindingDestination, + autoOffsetReset); + // @checkstyle:off GlobalKTableBoundElementFactory.GlobalKTableWrapper globalKTableWrapper = (GlobalKTableBoundElementFactory.GlobalKTableWrapper) targetBean; - //wrap the proxy created during the initial target type binding with real object (KTable) + // @checkstyle:on + // wrap the proxy created during the initial target type binding + // with real object (KTable) globalKTableWrapper.wrap((GlobalKTable) table); - this.kafkaStreamsBindingInformationCatalogue.addStreamBuilderFactory(streamsBuilderFactoryBean); + this.kafkaStreamsBindingInformationCatalogue + .addStreamBuilderFactory(streamsBuilderFactoryBean); arguments[parameterIndex] = table; } } @@ -309,67 +359,86 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene } } else { - throw new IllegalStateException(StreamListenerErrorMessages.INVALID_DECLARATIVE_METHOD_PARAMETERS); + throw new IllegalStateException( + StreamListenerErrorMessages.INVALID_DECLARATIVE_METHOD_PARAMETERS); } } return arguments; } - private GlobalKTable getGlobalKTable(StreamsBuilder streamsBuilder, Serde keySerde, Serde valueSerde, String materializedAs, - String bindingDestination, Topology.AutoOffsetReset autoOffsetReset) { - return materializedAs != null ? - materializedAsGlobalKTable(streamsBuilder, bindingDestination, materializedAs, keySerde, valueSerde, autoOffsetReset) : - streamsBuilder.globalTable(bindingDestination, - Consumed.with(keySerde, valueSerde).withOffsetResetPolicy(autoOffsetReset)); + private GlobalKTable getGlobalKTable(StreamsBuilder streamsBuilder, + Serde keySerde, Serde valueSerde, String materializedAs, + String bindingDestination, Topology.AutoOffsetReset autoOffsetReset) { + return materializedAs != null + ? materializedAsGlobalKTable(streamsBuilder, bindingDestination, + materializedAs, keySerde, valueSerde, autoOffsetReset) + : streamsBuilder.globalTable(bindingDestination, + Consumed.with(keySerde, valueSerde) + .withOffsetResetPolicy(autoOffsetReset)); } - private KTable getKTable(StreamsBuilder streamsBuilder, Serde keySerde, Serde valueSerde, String materializedAs, - String bindingDestination, Topology.AutoOffsetReset autoOffsetReset) { - return materializedAs != null ? - materializedAs(streamsBuilder, bindingDestination, materializedAs, keySerde, valueSerde, autoOffsetReset) : - streamsBuilder.table(bindingDestination, - Consumed.with(keySerde, valueSerde).withOffsetResetPolicy(autoOffsetReset)); + private KTable getKTable(StreamsBuilder streamsBuilder, Serde keySerde, + Serde valueSerde, String materializedAs, String bindingDestination, + Topology.AutoOffsetReset autoOffsetReset) { + return materializedAs != null + ? materializedAs(streamsBuilder, bindingDestination, materializedAs, + keySerde, valueSerde, autoOffsetReset) + : streamsBuilder.table(bindingDestination, + Consumed.with(keySerde, valueSerde) + .withOffsetResetPolicy(autoOffsetReset)); } - private KTable materializedAs(StreamsBuilder streamsBuilder, String destination, String storeName, Serde k, Serde v, - Topology.AutoOffsetReset autoOffsetReset) { - return streamsBuilder.table(this.bindingServiceProperties.getBindingDestination(destination), + private KTable materializedAs(StreamsBuilder streamsBuilder, + String destination, String storeName, Serde k, Serde v, + Topology.AutoOffsetReset autoOffsetReset) { + return streamsBuilder.table( + this.bindingServiceProperties.getBindingDestination(destination), Consumed.with(k, v).withOffsetResetPolicy(autoOffsetReset), getMaterialized(storeName, k, v)); } - private GlobalKTable materializedAsGlobalKTable(StreamsBuilder streamsBuilder, String destination, String storeName, Serde k, Serde v, - Topology.AutoOffsetReset autoOffsetReset) { - return streamsBuilder.globalTable(this.bindingServiceProperties.getBindingDestination(destination), + private GlobalKTable materializedAsGlobalKTable( + StreamsBuilder streamsBuilder, String destination, String storeName, + Serde k, Serde v, Topology.AutoOffsetReset autoOffsetReset) { + return streamsBuilder.globalTable( + this.bindingServiceProperties.getBindingDestination(destination), Consumed.with(k, v).withOffsetResetPolicy(autoOffsetReset), getMaterialized(storeName, k, v)); } - private Materialized> getMaterialized(String storeName, Serde k, Serde v) { + private Materialized> getMaterialized( + String storeName, Serde k, Serde v) { return Materialized.>as(storeName) - .withKeySerde(k) - .withValueSerde(v); + .withKeySerde(k).withValueSerde(v); } private StoreBuilder buildStateStore(KafkaStreamsStateStoreProperties spec) { try { - Serde keySerde = this.keyValueSerdeResolver.getStateStoreKeySerde(spec.getKeySerdeString()); - Serde valueSerde = this.keyValueSerdeResolver.getStateStoreValueSerde(spec.getValueSerdeString()); + Serde keySerde = this.keyValueSerdeResolver + .getStateStoreKeySerde(spec.getKeySerdeString()); + Serde valueSerde = this.keyValueSerdeResolver + .getStateStoreValueSerde(spec.getValueSerdeString()); StoreBuilder builder; switch (spec.getType()) { - case KEYVALUE: - builder = Stores.keyValueStoreBuilder(Stores.persistentKeyValueStore(spec.getName()), keySerde, valueSerde); - break; - case WINDOW: - builder = Stores.windowStoreBuilder(Stores.persistentWindowStore(spec.getName(), spec.getRetention(), 3, spec.getLength(), false), - keySerde, - valueSerde); - break; - case SESSION: - builder = Stores.sessionStoreBuilder(Stores.persistentSessionStore(spec.getName(), spec.getRetention()), keySerde, valueSerde); - break; - default: - throw new UnsupportedOperationException("state store type (" + spec.getType() + ") is not supported!"); + case KEYVALUE: + builder = Stores.keyValueStoreBuilder( + Stores.persistentKeyValueStore(spec.getName()), keySerde, + valueSerde); + break; + case WINDOW: + builder = Stores + .windowStoreBuilder( + Stores.persistentWindowStore(spec.getName(), + spec.getRetention(), 3, spec.getLength(), false), + keySerde, valueSerde); + break; + case SESSION: + builder = Stores.sessionStoreBuilder(Stores.persistentSessionStore( + spec.getName(), spec.getRetention()), keySerde, valueSerde); + break; + default: + throw new UnsupportedOperationException( + "state store type (" + spec.getType() + ") is not supported!"); } if (spec.isCacheEnabled()) { builder = builder.withCachingEnabled(); @@ -385,10 +454,11 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene } } - private KStream getkStream(String inboundName, KafkaStreamsStateStoreProperties storeSpec, - BindingProperties bindingProperties, - StreamsBuilder streamsBuilder, - Serde keySerde, Serde valueSerde, Topology.AutoOffsetReset autoOffsetReset) { + private KStream getkStream(String inboundName, + KafkaStreamsStateStoreProperties storeSpec, + BindingProperties bindingProperties, StreamsBuilder streamsBuilder, + Serde keySerde, Serde valueSerde, + Topology.AutoOffsetReset autoOffsetReset) { if (storeSpec != null) { StoreBuilder storeBuilder = buildStateStore(storeSpec); streamsBuilder.addStateStore(storeBuilder); @@ -396,19 +466,21 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene LOG.info("state store " + storeBuilder.name() + " added to topology"); } } - String[] bindingTargets = StringUtils - .commaDelimitedListToStringArray(this.bindingServiceProperties.getBindingDestination(inboundName)); + String[] bindingTargets = StringUtils.commaDelimitedListToStringArray( + this.bindingServiceProperties.getBindingDestination(inboundName)); - KStream stream = - streamsBuilder.stream(Arrays.asList(bindingTargets), - Consumed.with(keySerde, valueSerde) - .withOffsetResetPolicy(autoOffsetReset)); - final boolean nativeDecoding = this.bindingServiceProperties.getConsumerProperties(inboundName).isUseNativeDecoding(); + KStream stream = streamsBuilder.stream(Arrays.asList(bindingTargets), + Consumed.with(keySerde, valueSerde) + .withOffsetResetPolicy(autoOffsetReset)); + final boolean nativeDecoding = this.bindingServiceProperties + .getConsumerProperties(inboundName).isUseNativeDecoding(); if (nativeDecoding) { - LOG.info("Native decoding is enabled for " + inboundName + ". Inbound deserialization done at the broker."); + LOG.info("Native decoding is enabled for " + inboundName + + ". Inbound deserialization done at the broker."); } else { - LOG.info("Native decoding is disabled for " + inboundName + ". Inbound message conversion done by Spring Cloud Stream."); + LOG.info("Native decoding is disabled for " + inboundName + + ". Inbound message conversion done by Spring Cloud Stream."); } stream = stream.mapValues((value) -> { @@ -426,72 +498,93 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene return stream; } - private void enableNativeDecodingForKTableAlways(Class parameterType, BindingProperties bindingProperties) { - if (parameterType.isAssignableFrom(KTable.class) || parameterType.isAssignableFrom(GlobalKTable.class)) { + private void enableNativeDecodingForKTableAlways(Class parameterType, + BindingProperties bindingProperties) { + if (parameterType.isAssignableFrom(KTable.class) + || parameterType.isAssignableFrom(GlobalKTable.class)) { if (bindingProperties.getConsumer() == null) { bindingProperties.setConsumer(new ConsumerProperties()); } - //No framework level message conversion provided for KTable/GlobalKTable, its done by the broker. + // No framework level message conversion provided for KTable/GlobalKTable, its + // done by the broker. bindingProperties.getConsumer().setUseNativeDecoding(true); } } - @SuppressWarnings({"unchecked"}) - private void buildStreamsBuilderAndRetrieveConfig(Method method, ApplicationContext applicationContext, - String inboundName) { - ConfigurableListableBeanFactory beanFactory = this.applicationContext.getBeanFactory(); + @SuppressWarnings({ "unchecked" }) + private void buildStreamsBuilderAndRetrieveConfig(Method method, + ApplicationContext applicationContext, String inboundName) { + ConfigurableListableBeanFactory beanFactory = this.applicationContext + .getBeanFactory(); - Map streamConfigGlobalProperties = applicationContext.getBean("streamConfigGlobalProperties", Map.class); + Map streamConfigGlobalProperties = applicationContext + .getBean("streamConfigGlobalProperties", Map.class); - KafkaStreamsConsumerProperties extendedConsumerProperties = this.kafkaStreamsExtendedBindingProperties.getExtendedConsumerProperties(inboundName); - streamConfigGlobalProperties.putAll(extendedConsumerProperties.getConfiguration()); + KafkaStreamsConsumerProperties extendedConsumerProperties = this.kafkaStreamsExtendedBindingProperties + .getExtendedConsumerProperties(inboundName); + streamConfigGlobalProperties + .putAll(extendedConsumerProperties.getConfiguration()); String applicationId = extendedConsumerProperties.getApplicationId(); - //override application.id if set at the individual binding level. + // override application.id if set at the individual binding level. if (StringUtils.hasText(applicationId)) { - streamConfigGlobalProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, applicationId); + streamConfigGlobalProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, + applicationId); } - int concurrency = this.bindingServiceProperties.getConsumerProperties(inboundName).getConcurrency(); + int concurrency = this.bindingServiceProperties.getConsumerProperties(inboundName) + .getConcurrency(); // override concurrency if set at the individual binding level. if (concurrency > 1) { - streamConfigGlobalProperties.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, concurrency); + streamConfigGlobalProperties.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, + concurrency); } - Map kafkaStreamsDlqDispatchers = applicationContext.getBean("kafkaStreamsDlqDispatchers", Map.class); + Map kafkaStreamsDlqDispatchers = applicationContext + .getBean("kafkaStreamsDlqDispatchers", Map.class); - KafkaStreamsConfiguration kafkaStreamsConfiguration = new KafkaStreamsConfiguration(streamConfigGlobalProperties) { + KafkaStreamsConfiguration kafkaStreamsConfiguration = new KafkaStreamsConfiguration( + streamConfigGlobalProperties) { @Override public Properties asProperties() { Properties properties = super.asProperties(); - properties.put(SendToDlqAndContinue.KAFKA_STREAMS_DLQ_DISPATCHERS, kafkaStreamsDlqDispatchers); + properties.put(SendToDlqAndContinue.KAFKA_STREAMS_DLQ_DISPATCHERS, + kafkaStreamsDlqDispatchers); return properties; } }; StreamsBuilderFactoryBean streamsBuilder = this.cleanupConfig == null ? new StreamsBuilderFactoryBean(kafkaStreamsConfiguration) - : new StreamsBuilderFactoryBean(kafkaStreamsConfiguration, this.cleanupConfig); + : new StreamsBuilderFactoryBean(kafkaStreamsConfiguration, + this.cleanupConfig); streamsBuilder.setAutoStartup(false); - BeanDefinition streamsBuilderBeanDefinition = - BeanDefinitionBuilder.genericBeanDefinition((Class) streamsBuilder.getClass(), () -> streamsBuilder) - .getRawBeanDefinition(); - ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition("stream-builder-" + method.getName(), streamsBuilderBeanDefinition); - StreamsBuilderFactoryBean streamsBuilderX = applicationContext.getBean("&stream-builder-" + method.getName(), StreamsBuilderFactoryBean.class); + BeanDefinition streamsBuilderBeanDefinition = BeanDefinitionBuilder + .genericBeanDefinition( + (Class) streamsBuilder.getClass(), + () -> streamsBuilder) + .getRawBeanDefinition(); + ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition( + "stream-builder-" + method.getName(), streamsBuilderBeanDefinition); + StreamsBuilderFactoryBean streamsBuilderX = applicationContext.getBean( + "&stream-builder-" + method.getName(), StreamsBuilderFactoryBean.class); this.methodStreamsBuilderFactoryBeanMap.put(method, streamsBuilderX); } @Override - public final void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public final void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { this.applicationContext = (ConfigurableApplicationContext) applicationContext; } - private void validateStreamListenerMethod(StreamListener streamListener, Method method, String[] methodAnnotatedOutboundNames) { + private void validateStreamListenerMethod(StreamListener streamListener, + Method method, String[] methodAnnotatedOutboundNames) { String methodAnnotatedInboundName = streamListener.value(); if (methodAnnotatedOutboundNames != null) { for (String s : methodAnnotatedOutboundNames) { if (StringUtils.hasText(s)) { - Assert.isTrue(isDeclarativeOutput(method, s), "Method must be declarative"); + Assert.isTrue(isDeclarativeOutput(method, s), + "Method must be declarative"); } } } @@ -499,8 +592,11 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene int methodArgumentsLength = method.getParameterTypes().length; for (int parameterIndex = 0; parameterIndex < methodArgumentsLength; parameterIndex++) { - MethodParameter methodParameter = MethodParameter.forExecutable(method, parameterIndex); - Assert.isTrue(isDeclarativeInput(methodAnnotatedInboundName, methodParameter), "Method must be declarative"); + MethodParameter methodParameter = MethodParameter.forExecutable(method, + parameterIndex); + Assert.isTrue( + isDeclarativeInput(methodAnnotatedInboundName, methodParameter), + "Method must be declarative"); } } } @@ -512,7 +608,8 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene if (returnType.isArray()) { Class targetBeanClass = this.applicationContext.getType(targetBeanName); declarative = this.streamListenerResultAdapters.stream() - .anyMatch((slpa) -> slpa.supports(returnType.getComponentType(), targetBeanClass)); + .anyMatch((slpa) -> slpa.supports(returnType.getComponentType(), + targetBeanClass)); return declarative; } Class targetBeanClass = this.applicationContext.getType(targetBeanName); @@ -522,10 +619,13 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene } @SuppressWarnings("unchecked") - private boolean isDeclarativeInput(String targetBeanName, MethodParameter methodParameter) { - if (!methodParameter.getParameterType().isAssignableFrom(Object.class) && this.applicationContext.containsBean(targetBeanName)) { + private boolean isDeclarativeInput(String targetBeanName, + MethodParameter methodParameter) { + if (!methodParameter.getParameterType().isAssignableFrom(Object.class) + && this.applicationContext.containsBean(targetBeanName)) { Class targetBeanClass = this.applicationContext.getType(targetBeanName); - return this.streamListenerParameterAdapter.supports(targetBeanClass, methodParameter); + return this.streamListenerParameterAdapter.supports(targetBeanClass, + methodParameter); } return false; } @@ -533,16 +633,19 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene private static String[] getOutboundBindingTargetNames(Method method) { SendTo sendTo = AnnotationUtils.findAnnotation(method, SendTo.class); if (sendTo != null) { - Assert.isTrue(!ObjectUtils.isEmpty(sendTo.value()), StreamListenerErrorMessages.ATLEAST_ONE_OUTPUT); - Assert.isTrue(sendTo.value().length >= 1, "At least one outbound destination need to be provided."); + Assert.isTrue(!ObjectUtils.isEmpty(sendTo.value()), + StreamListenerErrorMessages.ATLEAST_ONE_OUTPUT); + Assert.isTrue(sendTo.value().length >= 1, + "At least one outbound destination need to be provided."); return sendTo.value(); } return null; } - @SuppressWarnings({"unchecked"}) + @SuppressWarnings({ "unchecked" }) private static KafkaStreamsStateStoreProperties buildStateStoreSpec(Method method) { - KafkaStreamsStateStore spec = AnnotationUtils.findAnnotation(method, KafkaStreamsStateStore.class); + KafkaStreamsStateStore spec = AnnotationUtils.findAnnotation(method, + KafkaStreamsStateStore.class); if (spec != null) { Assert.isTrue(!ObjectUtils.isEmpty(spec.name()), "name cannot be empty"); Assert.isTrue(spec.name().length() >= 1, "name cannot be empty."); @@ -559,4 +662,5 @@ class KafkaStreamsStreamListenerSetupMethodOrchestrator implements StreamListene } return null; } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KeyValueSerdeResolver.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KeyValueSerdeResolver.java index 3ce9ac28e..0105def8c 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KeyValueSerdeResolver.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/KeyValueSerdeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,20 +32,23 @@ import org.springframework.util.StringUtils; /** * Resolver for key and value Serde. * - * On the inbound, if native decoding is enabled, then any deserialization on the value is handled by Kafka. - * First, we look for any key/value Serde set on the binding itself, if that is not available then look at the - * common Serde set at the global level. If that fails, it falls back to byte[]. - * If native decoding is disabled, then the binder will do the deserialization on value and ignore any Serde set for value - * and rely on the contentType provided. Keys are always deserialized at the broker. + * On the inbound, if native decoding is enabled, then any deserialization on the value is + * handled by Kafka. First, we look for any key/value Serde set on the binding itself, if + * that is not available then look at the common Serde set at the global level. If that + * fails, it falls back to byte[]. If native decoding is disabled, then the binder will do + * the deserialization on value and ignore any Serde set for value and rely on the + * contentType provided. Keys are always deserialized at the broker. * * - * Same rules apply on the outbound. If native encoding is enabled, then value serialization is done at the broker using - * any binder level Serde for value, if not using common Serde, if not, then byte[]. - * If native encoding is disabled, then the binder will do serialization using a contentType. Keys are always serialized - * by the broker. + * Same rules apply on the outbound. If native encoding is enabled, then value + * serialization is done at the broker using any binder level Serde for value, if not + * using common Serde, if not, then byte[]. If native encoding is disabled, then the + * binder will do serialization using a contentType. Keys are always serialized by the + * broker. * * For state store, use serdes class specified in - * {@link org.springframework.cloud.stream.binder.kafka.streams.annotations.KafkaStreamsStateStore} to create Serde accordingly. + * {@link org.springframework.cloud.stream.binder.kafka.streams.annotations.KafkaStreamsStateStore} + * to create Serde accordingly. * * @author Soby Chacko * @author Lei Chen @@ -57,18 +60,19 @@ class KeyValueSerdeResolver { private final KafkaStreamsBinderConfigurationProperties binderConfigurationProperties; KeyValueSerdeResolver(Map streamConfigGlobalProperties, - KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { + KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) { this.streamConfigGlobalProperties = streamConfigGlobalProperties; this.binderConfigurationProperties = binderConfigurationProperties; } /** * Provide the {@link Serde} for inbound key. - * - * @param extendedConsumerProperties binding level extended {@link KafkaStreamsConsumerProperties} + * @param extendedConsumerProperties binding level extended + * {@link KafkaStreamsConsumerProperties} * @return configurd {@link Serde} for the inbound key. */ - public Serde getInboundKeySerde(KafkaStreamsConsumerProperties extendedConsumerProperties) { + public Serde getInboundKeySerde( + KafkaStreamsConsumerProperties extendedConsumerProperties) { String keySerdeString = extendedConsumerProperties.getKeySerde(); return getKeySerde(keySerdeString); @@ -76,18 +80,18 @@ class KeyValueSerdeResolver { /** * Provide the {@link Serde} for inbound value. - * * @param consumerProperties {@link ConsumerProperties} on binding - * @param extendedConsumerProperties binding level extended {@link KafkaStreamsConsumerProperties} + * @param extendedConsumerProperties binding level extended + * {@link KafkaStreamsConsumerProperties} * @return configurd {@link Serde} for the inbound value. */ - public Serde getInboundValueSerde(ConsumerProperties consumerProperties, KafkaStreamsConsumerProperties extendedConsumerProperties) { + public Serde getInboundValueSerde(ConsumerProperties consumerProperties, + KafkaStreamsConsumerProperties extendedConsumerProperties) { Serde valueSerde; String valueSerdeString = extendedConsumerProperties.getValueSerde(); try { - if (consumerProperties != null && - consumerProperties.isUseNativeDecoding()) { + if (consumerProperties != null && consumerProperties.isUseNativeDecoding()) { valueSerde = getValueSerde(valueSerdeString); } else { @@ -103,7 +107,6 @@ class KeyValueSerdeResolver { /** * Provide the {@link Serde} for outbound key. - * * @param properties binding level extended {@link KafkaStreamsProducerProperties} * @return configurd {@link Serde} for the outbound key. */ @@ -113,16 +116,18 @@ class KeyValueSerdeResolver { /** * Provide the {@link Serde} for outbound value. - * * @param producerProperties {@link ProducerProperties} on binding - * @param kafkaStreamsProducerProperties binding level extended {@link KafkaStreamsProducerProperties} + * @param kafkaStreamsProducerProperties binding level extended + * {@link KafkaStreamsProducerProperties} * @return configurd {@link Serde} for the outbound value. */ - public Serde getOutboundValueSerde(ProducerProperties producerProperties, KafkaStreamsProducerProperties kafkaStreamsProducerProperties) { + public Serde getOutboundValueSerde(ProducerProperties producerProperties, + KafkaStreamsProducerProperties kafkaStreamsProducerProperties) { Serde valueSerde; try { if (producerProperties.isUseNativeEncoding()) { - valueSerde = getValueSerde(kafkaStreamsProducerProperties.getValueSerde()); + valueSerde = getValueSerde( + kafkaStreamsProducerProperties.getValueSerde()); } else { valueSerde = Serdes.ByteArray(); @@ -137,7 +142,6 @@ class KeyValueSerdeResolver { /** * Provide the {@link Serde} for state store. - * * @param keySerdeString serde class used for key * @return {@link Serde} for the state store key. */ @@ -147,7 +151,6 @@ class KeyValueSerdeResolver { /** * Provide the {@link Serde} for state store value. - * * @param valueSerdeString serde class used for value * @return {@link Serde} for the state store value. */ @@ -167,8 +170,12 @@ class KeyValueSerdeResolver { keySerde = Utils.newInstance(keySerdeString, Serde.class); } else { - keySerde = this.binderConfigurationProperties.getConfiguration().containsKey("default.key.serde") ? - Utils.newInstance(this.binderConfigurationProperties.getConfiguration().get("default.key.serde"), Serde.class) : Serdes.ByteArray(); + keySerde = this.binderConfigurationProperties.getConfiguration() + .containsKey("default.key.serde") + ? Utils.newInstance(this.binderConfigurationProperties + .getConfiguration().get("default.key.serde"), + Serde.class) + : Serdes.ByteArray(); } keySerde.configure(this.streamConfigGlobalProperties, true); @@ -179,15 +186,21 @@ class KeyValueSerdeResolver { return keySerde; } - private Serde getValueSerde(String valueSerdeString) throws ClassNotFoundException { + private Serde getValueSerde(String valueSerdeString) + throws ClassNotFoundException { Serde valueSerde; if (StringUtils.hasText(valueSerdeString)) { valueSerde = Utils.newInstance(valueSerdeString, Serde.class); } else { - valueSerde = this.binderConfigurationProperties.getConfiguration().containsKey("default.value.serde") ? - Utils.newInstance(this.binderConfigurationProperties.getConfiguration().get("default.value.serde"), Serde.class) : Serdes.ByteArray(); + valueSerde = this.binderConfigurationProperties.getConfiguration() + .containsKey("default.value.serde") + ? Utils.newInstance(this.binderConfigurationProperties + .getConfiguration().get("default.value.serde"), + Serde.class) + : Serdes.ByteArray(); } return valueSerde; } + } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/QueryableStoreRegistry.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/QueryableStoreRegistry.java index 70f09c81e..a34d65b8e 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/QueryableStoreRegistry.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/QueryableStoreRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ import org.apache.kafka.streams.errors.InvalidStateStoreException; import org.apache.kafka.streams.state.QueryableStoreType; /** - * Registry that contains {@link QueryableStoreType}s those created from - * the user applications. + * Registry that contains {@link QueryableStoreType}s those created from the user + * applications. * * @author Soby Chacko * @author Renwei Han @@ -39,14 +39,15 @@ public class QueryableStoreRegistry { /** * Retrieve and return a queryable store by name created in the application. - * * @param storeName name of the queryable store * @param storeType type of the queryable store - * @param generic queryable store + * @param generic queryable store * @return queryable store. - * @deprecated in favor of {@link InteractiveQueryService#getQueryableStore(String, QueryableStoreType)} + * @deprecated in favor of + * {@link InteractiveQueryService#getQueryableStore(String, QueryableStoreType)} */ - public T getQueryableStoreType(String storeName, QueryableStoreType storeType) { + public T getQueryableStoreType(String storeName, + QueryableStoreType storeType) { for (KafkaStreams kafkaStream : this.kafkaStreamsRegistry.getKafkaStreams()) { try { @@ -56,7 +57,7 @@ public class QueryableStoreRegistry { } } catch (InvalidStateStoreException ignored) { - //pass through + // pass through } } return null; diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/SendToDlqAndContinue.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/SendToDlqAndContinue.java index ed300eafd..ceae494dc 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/SendToDlqAndContinue.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/SendToDlqAndContinue.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,8 @@ import org.apache.kafka.streams.processor.internals.StreamTask; import org.springframework.util.ReflectionUtils; /** - * Custom implementation for {@link DeserializationExceptionHandler} that sends the records - * in error to a DLQ topic, then continue stream processing on new records. + * Custom implementation for {@link DeserializationExceptionHandler} that sends the + * records in error to a DLQ topic, then continue stream processing on new records. * * @author Soby Chacko * @since 2.0.0 @@ -46,14 +46,13 @@ public class SendToDlqAndContinue implements DeserializationExceptionHandler { public static final String KAFKA_STREAMS_DLQ_DISPATCHERS = "spring.cloud.stream.kafka.streams.dlq.dispatchers"; /** - * DLQ dispatcher per topic in the application context. The key here is not the actual DLQ topic - * but the incoming topic that caused the error. + * DLQ dispatcher per topic in the application context. The key here is not the actual + * DLQ topic but the incoming topic that caused the error. */ private Map dlqDispatchers = new HashMap<>(); /** * For a given topic, send the key/value record to DLQ topic. - * * @param topic incoming topic that caused the error * @param key to send * @param value to send @@ -66,16 +65,23 @@ public class SendToDlqAndContinue implements DeserializationExceptionHandler { @Override @SuppressWarnings("unchecked") - public DeserializationHandlerResponse handle(ProcessorContext context, ConsumerRecord record, Exception exception) { - KafkaStreamsDlqDispatch kafkaStreamsDlqDispatch = this.dlqDispatchers.get(record.topic()); - kafkaStreamsDlqDispatch.sendToDlq(record.key(), record.value(), record.partition()); + public DeserializationHandlerResponse handle(ProcessorContext context, + ConsumerRecord record, Exception exception) { + KafkaStreamsDlqDispatch kafkaStreamsDlqDispatch = this.dlqDispatchers + .get(record.topic()); + kafkaStreamsDlqDispatch.sendToDlq(record.key(), record.value(), + record.partition()); context.commit(); - // The following conditional block should be reconsidered when we have a solution for this SO problem: + // The following conditional block should be reconsidered when we have a solution + // for this SO problem: // https://stackoverflow.com/questions/48470899/kafka-streams-deserialization-handler - // Currently it seems like when deserialization error happens, there is no commits happening and the - // following code will use reflection to get access to the underlying KafkaConsumer. - // It works with Kafka 1.0.0, but there is no guarantee it will work in future versions of kafka as + // Currently it seems like when deserialization error happens, there is no commits + // happening and the + // following code will use reflection to get access to the underlying + // KafkaConsumer. + // It works with Kafka 1.0.0, but there is no guarantee it will work in future + // versions of kafka as // we access private fields by name using reflection, but it is a temporary fix. if (context instanceof ProcessorContextImpl) { ProcessorContextImpl processorContextImpl = (ProcessorContextImpl) context; @@ -87,11 +93,13 @@ public class SendToDlqAndContinue implements DeserializationExceptionHandler { StreamTask streamTask = (StreamTask) taskField; Field consumer = ReflectionUtils.findField(StreamTask.class, "consumer"); ReflectionUtils.makeAccessible(consumer); - Object kafkaConsumerField = ReflectionUtils.getField(consumer, streamTask); + Object kafkaConsumerField = ReflectionUtils.getField(consumer, + streamTask); if (kafkaConsumerField.getClass().isAssignableFrom(KafkaConsumer.class)) { KafkaConsumer kafkaConsumer = (KafkaConsumer) kafkaConsumerField; final Map consumedOffsetsAndMetadata = new HashMap<>(); - TopicPartition tp = new TopicPartition(record.topic(), record.partition()); + TopicPartition tp = new TopicPartition(record.topic(), + record.partition()); OffsetAndMetadata oam = new OffsetAndMetadata(record.offset() + 1); consumedOffsetsAndMetadata.put(tp, oam); kafkaConsumer.commitSync(consumedOffsetsAndMetadata); @@ -104,10 +112,12 @@ public class SendToDlqAndContinue implements DeserializationExceptionHandler { @Override @SuppressWarnings("unchecked") public void configure(Map configs) { - this.dlqDispatchers = (Map) configs.get(KAFKA_STREAMS_DLQ_DISPATCHERS); + this.dlqDispatchers = (Map) configs + .get(KAFKA_STREAMS_DLQ_DISPATCHERS); } - void addKStreamDlqDispatch(String topic, KafkaStreamsDlqDispatch kafkaStreamsDlqDispatch) { + void addKStreamDlqDispatch(String topic, + KafkaStreamsDlqDispatch kafkaStreamsDlqDispatch) { this.dlqDispatchers.put(topic, kafkaStreamsDlqDispatch); } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/StreamsBuilderFactoryManager.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/StreamsBuilderFactoryManager.java index f34bfb4cd..528913f68 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/StreamsBuilderFactoryManager.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/StreamsBuilderFactoryManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,13 +23,13 @@ import org.springframework.kafka.KafkaException; import org.springframework.kafka.config.StreamsBuilderFactoryBean; /** - * Iterate through all {@link StreamsBuilderFactoryBean} in the application context - * and start them. As each one completes starting, register the associated KafkaStreams - * object into {@link QueryableStoreRegistry}. + * Iterate through all {@link StreamsBuilderFactoryBean} in the application context and + * start them. As each one completes starting, register the associated KafkaStreams object + * into {@link QueryableStoreRegistry}. * - * This {@link SmartLifecycle} class ensures that the bean created from it is started very late - * through the bootstrap process by setting the phase value closer to Integer.MAX_VALUE. - * This is to guarantee that the {@link StreamsBuilderFactoryBean} on a + * This {@link SmartLifecycle} class ensures that the bean created from it is started very + * late through the bootstrap process by setting the phase value closer to + * Integer.MAX_VALUE. This is to guarantee that the {@link StreamsBuilderFactoryBean} on a * {@link org.springframework.cloud.stream.annotation.StreamListener} method with multiple * bindings is only started after all the binding phases have completed successfully. * @@ -38,12 +38,14 @@ import org.springframework.kafka.config.StreamsBuilderFactoryBean; class StreamsBuilderFactoryManager implements SmartLifecycle { private final KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue; + private final KafkaStreamsRegistry kafkaStreamsRegistry; private volatile boolean running; - StreamsBuilderFactoryManager(KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue, - KafkaStreamsRegistry kafkaStreamsRegistry) { + StreamsBuilderFactoryManager( + KafkaStreamsBindingInformationCatalogue kafkaStreamsBindingInformationCatalogue, + KafkaStreamsRegistry kafkaStreamsRegistry) { this.kafkaStreamsBindingInformationCatalogue = kafkaStreamsBindingInformationCatalogue; this.kafkaStreamsRegistry = kafkaStreamsRegistry; } @@ -65,10 +67,12 @@ class StreamsBuilderFactoryManager implements SmartLifecycle { public synchronized void start() { if (!this.running) { try { - Set streamsBuilderFactoryBeans = this.kafkaStreamsBindingInformationCatalogue.getStreamsBuilderFactoryBeans(); + Set streamsBuilderFactoryBeans = this.kafkaStreamsBindingInformationCatalogue + .getStreamsBuilderFactoryBeans(); for (StreamsBuilderFactoryBean streamsBuilderFactoryBean : streamsBuilderFactoryBeans) { streamsBuilderFactoryBean.start(); - this.kafkaStreamsRegistry.registerKafkaStreams(streamsBuilderFactoryBean.getKafkaStreams()); + this.kafkaStreamsRegistry.registerKafkaStreams( + streamsBuilderFactoryBean.getKafkaStreams()); } this.running = true; } @@ -79,21 +83,22 @@ class StreamsBuilderFactoryManager implements SmartLifecycle { } @Override - public synchronized void stop() { - if (this.running) { - try { - Set streamsBuilderFactoryBeans = this.kafkaStreamsBindingInformationCatalogue.getStreamsBuilderFactoryBeans(); - for (StreamsBuilderFactoryBean streamsBuilderFactoryBean : streamsBuilderFactoryBeans) { - streamsBuilderFactoryBean.stop(); - } - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } - finally { - this.running = false; + public synchronized void stop() { + if (this.running) { + try { + Set streamsBuilderFactoryBeans = this.kafkaStreamsBindingInformationCatalogue + .getStreamsBuilderFactoryBeans(); + for (StreamsBuilderFactoryBean streamsBuilderFactoryBean : streamsBuilderFactoryBeans) { + streamsBuilderFactoryBean.stop(); } } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + finally { + this.running = false; + } + } } @Override diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsProcessor.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsProcessor.java index 43b44de4e..b37c3c517 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsProcessor.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,14 @@ import org.springframework.cloud.stream.annotation.Output; /** * Bindable interface for {@link KStream} input and output. * - * This interface can be used as a bindable interface with {@link org.springframework.cloud.stream.annotation.EnableBinding} - * when both input and output types are single KStream. In other scenarios where multiple types are required, other - * similar bindable interfaces can be created and used. For example, there are cases in which multiple KStreams - * are required on the outbound in the case of KStream branching or multiple input types are required either in the - * form of multiple KStreams and a combination of KStreams and KTables. In those cases, new bindable interfaces compatible - * with the requirements must be created. Here are some examples. + * This interface can be used as a bindable interface with + * {@link org.springframework.cloud.stream.annotation.EnableBinding} when both input and + * output types are single KStream. In other scenarios where multiple types are required, + * other similar bindable interfaces can be created and used. For example, there are cases + * in which multiple KStreams are required on the outbound in the case of KStream + * branching or multiple input types are required either in the form of multiple KStreams + * and a combination of KStreams and KTables. In those cases, new bindable interfaces + * compatible with the requirements must be created. Here are some examples. * *
  *     interface KStreamBranchProcessor {
@@ -73,7 +75,6 @@ public interface KafkaStreamsProcessor {
 
 	/**
 	 * Input binding.
-	 *
 	 * @return {@link Input} binding for {@link KStream} type.
 	 */
 	@Input("input")
@@ -81,9 +82,9 @@ public interface KafkaStreamsProcessor {
 
 	/**
 	 * Output binding.
-	 *
 	 * @return {@link Output} binding for {@link KStream} type.
 	 */
 	@Output("output")
 	KStream output();
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsStateStore.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsStateStore.java
index d6897df3e..1bdf152af 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsStateStore.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/annotations/KafkaStreamsStateStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
 
 package org.springframework.cloud.stream.binder.kafka.streams.annotations;
 
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -27,21 +26,23 @@ import org.springframework.cloud.stream.binder.kafka.streams.properties.KafkaStr
 /**
  * Interface for Kafka Stream state store.
  *
- * This interface can be used to inject a state store specification into KStream building process so
- * that the desired store can be built by StreamBuilder and added to topology for later use by processors.
- * This is particularly useful when need to combine stream DSL with low level processor APIs. In those cases,
- * if a writable state store is desired in processors, it needs to be created using this annotation.
- * Here is the example.
+ * This interface can be used to inject a state store specification into KStream building
+ * process so that the desired store can be built by StreamBuilder and added to topology
+ * for later use by processors. This is particularly useful when need to combine stream
+ * DSL with low level processor APIs. In those cases, if a writable state store is desired
+ * in processors, it needs to be created using this annotation. Here is the example.
  *
  * 
  *     @StreamListener("input")
- *     @KafkaStreamsStateStore(name="mystate", type= KafkaStreamsStateStoreProperties.StoreType.WINDOW, size=300000)
+ *     @KafkaStreamsStateStore(name="mystate", type= KafkaStreamsStateStoreProperties.StoreType.WINDOW,
+ *     								size=300000)
  *	   public void process(KStream<Object, Product> input) {
  *         ......
  *     }
  * 
* - * With that, you should be able to read/write this state store in your processor/transformer code. + * With that, you should be able to read/write this state store in your + * processor/transformer code. * *
  * 		new Processor<Object, Product>() {
@@ -64,57 +65,51 @@ public @interface KafkaStreamsStateStore {
 
 	/**
 	 * Provides name of the state store.
-	 *
 	 * @return name of state store.
 	 */
 	String name() default "";
 
 	/**
 	 * State store type.
-	 *
 	 * @return {@link KafkaStreamsStateStoreProperties.StoreType} of state store.
 	 */
 	KafkaStreamsStateStoreProperties.StoreType type() default KafkaStreamsStateStoreProperties.StoreType.KEYVALUE;
 
 	/**
 	 * Serde used for key.
-	 *
 	 * @return key serde of state store.
 	 */
 	String keySerde() default "org.apache.kafka.common.serialization.Serdes$StringSerde";
 
 	/**
 	 * Serde used for value.
-	 *
 	 * @return value serde of state store.
 	 */
 	String valueSerde() default "org.apache.kafka.common.serialization.Serdes$StringSerde";
 
 	/**
 	 * Length in milli-second of Windowed store window.
-	 *
 	 * @return length in milli-second of window(for windowed store).
 	 */
 	long lengthMs() default 0;
 
 	/**
 	 * Retention period for Windowed store windows.
-	 *
-	 * @return the maximum period of time in milli-second to keep each window in this store(for windowed store).
+	 * @return the maximum period of time in milli-second to keep each window in this
+	 * store(for windowed store).
 	 */
 	long retentionMs() default 0;
 
 	/**
 	 * Whether catching is enabled or not.
-	 *
 	 * @return whether caching should be enabled on the created store.
 	 */
 	boolean cache() default false;
 
 	/**
 	 * Whether logging is enabled or not.
-	 *
 	 * @return whether logging should be enabled on the created store.
 	 */
 	boolean logging() default true;
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsApplicationSupportProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsApplicationSupportProperties.java
index 08296784a..efde606cf 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsApplicationSupportProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsApplicationSupportProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,10 @@ package org.springframework.cloud.stream.binder.kafka.streams.properties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 /**
- * {@link ConfigurationProperties} that can be used by end user Kafka Stream applications. This class provides
- * convenient ways to access the commonly used kafka stream properties from the user application. For example, windowing
- * operations are common use cases in stream processing and one can provide window specific properties at runtime and use
+ * {@link ConfigurationProperties} that can be used by end user Kafka Stream applications.
+ * This class provides convenient ways to access the commonly used kafka stream properties
+ * from the user application. For example, windowing operations are common use cases in
+ * stream processing and one can provide window specific properties at runtime and use
  * those properties in the applications using this class.
  *
  * @author Soby Chacko
@@ -63,5 +64,7 @@ public class KafkaStreamsApplicationSupportProperties {
 		public void setAdvanceBy(int advanceBy) {
 			this.advanceBy = advanceBy;
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBinderConfigurationProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBinderConfigurationProperties.java
index 9a9a235db..a1fd4a832 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBinderConfigurationProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBinderConfigurationProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,7 +25,8 @@ import org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfi
  * @author Soby Chacko
  * @author Gary Russell
  */
-public class KafkaStreamsBinderConfigurationProperties extends KafkaBinderConfigurationProperties {
+public class KafkaStreamsBinderConfigurationProperties
+		extends KafkaBinderConfigurationProperties {
 
 	public KafkaStreamsBinderConfigurationProperties(KafkaProperties kafkaProperties) {
 		super(kafkaProperties);
@@ -35,6 +36,7 @@ public class KafkaStreamsBinderConfigurationProperties extends KafkaBinderConfig
 	 * Enumeration for various Serde errors.
 	 */
 	public enum SerdeError {
+
 		/**
 		 * Deserialization error handler with log and continue.
 		 */
@@ -47,6 +49,7 @@ public class KafkaStreamsBinderConfigurationProperties extends KafkaBinderConfig
 		 * Deserialization error handler with DLQ send.
 		 */
 		sendToDlq
+
 	}
 
 	private String applicationId;
@@ -60,9 +63,10 @@ public class KafkaStreamsBinderConfigurationProperties extends KafkaBinderConfig
 	}
 
 	/**
-	 * {@link org.apache.kafka.streams.errors.DeserializationExceptionHandler} to use
-	 * when there is a Serde error. {@link KafkaStreamsBinderConfigurationProperties.SerdeError}
-	 * values are used to provide the exception handler on consumer binding.
+	 * {@link org.apache.kafka.streams.errors.DeserializationExceptionHandler} to use when
+	 * there is a Serde error.
+	 * {@link KafkaStreamsBinderConfigurationProperties.SerdeError} values are used to
+	 * provide the exception handler on consumer binding.
 	 */
 	private KafkaStreamsBinderConfigurationProperties.SerdeError serdeError;
 
@@ -70,7 +74,8 @@ public class KafkaStreamsBinderConfigurationProperties extends KafkaBinderConfig
 		return this.serdeError;
 	}
 
-	public void setSerdeError(KafkaStreamsBinderConfigurationProperties.SerdeError serdeError) {
+	public void setSerdeError(
+			KafkaStreamsBinderConfigurationProperties.SerdeError serdeError) {
 		this.serdeError = serdeError;
 	}
 
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBindingProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBindingProperties.java
index eb921cb73..082035ca0 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBindingProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsBindingProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,8 @@ package org.springframework.cloud.stream.binder.kafka.streams.properties;
 import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
 
 /**
- * Extended binding properties holder that delegates to Kafka Streams producer and consumer properties.
+ * Extended binding properties holder that delegates to Kafka Streams producer and
+ * consumer properties.
  *
  * @author Marius Bogoevici
  */
@@ -44,4 +45,5 @@ public class KafkaStreamsBindingProperties implements BinderSpecificPropertiesPr
 	public void setProducer(KafkaStreamsProducerProperties producer) {
 		this.producer = producer;
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsConsumerProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsConsumerProperties.java
index 678833c1d..d0a4c45cf 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsConsumerProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsConsumerProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsExtendedBindingProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsExtendedBindingProperties.java
index 967af4184..dce595454 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsExtendedBindingProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsExtendedBindingProperties.java
@@ -19,16 +19,21 @@ package org.springframework.cloud.stream.binder.kafka.streams.properties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.cloud.stream.binder.AbstractExtendedBindingProperties;
 import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
+
 /**
- * Kafka streams specific extended binding properties class that extends from {@link AbstractExtendedBindingProperties}.
+ * Kafka streams specific extended binding properties class that extends from
+ * {@link AbstractExtendedBindingProperties}.
  *
  * @author Marius Bogoevici
  * @author Oleg Zhurakousky
  */
 @ConfigurationProperties("spring.cloud.stream.kafka.streams")
 public class KafkaStreamsExtendedBindingProperties
-		extends AbstractExtendedBindingProperties {
+		// @checkstyle:off
+		extends
+		AbstractExtendedBindingProperties {
 
+	// @checkstyle:on
 	private static final String DEFAULTS_PREFIX = "spring.cloud.stream.kafka.streams.default";
 
 	@Override
@@ -40,4 +45,5 @@ public class KafkaStreamsExtendedBindingProperties
 	public Class getExtendedPropertiesEntryClass() {
 		return KafkaStreamsBindingProperties.class;
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsProducerProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsProducerProperties.java
index eb9af0c67..f58935a56 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsProducerProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsProducerProperties.java
@@ -51,4 +51,5 @@ public class KafkaStreamsProducerProperties extends KafkaProducerProperties {
 	public void setValueSerde(String valueSerde) {
 		this.valueSerde = valueSerde;
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsStateStoreProperties.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsStateStoreProperties.java
index 261ed7bbf..45b0d37de 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsStateStoreProperties.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/properties/KafkaStreamsStateStoreProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
 
 package org.springframework.cloud.stream.binder.kafka.streams.properties;
 
-
 /**
  * Properties for Kafka Streams state store.
  *
@@ -28,6 +27,7 @@ public class KafkaStreamsStateStoreProperties {
 	 * Enumeration for store type.
 	 */
 	public enum StoreType {
+
 		/**
 		 * Key value store.
 		 */
@@ -51,8 +51,8 @@ public class KafkaStreamsStateStoreProperties {
 		public String toString() {
 			return this.type;
 		}
-	}
 
+	}
 
 	/**
 	 * Name for this state store.
@@ -94,7 +94,6 @@ public class KafkaStreamsStateStoreProperties {
 	 */
 	private boolean loggingDisabled;
 
-
 	public String getName() {
 		return this.name;
 	}
@@ -158,4 +157,5 @@ public class KafkaStreamsStateStoreProperties {
 	public void setLoggingDisabled(boolean loggingDisabled) {
 		this.loggingDisabled = loggingDisabled;
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerde.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerde.java
index f3f4807af..93ae3478a 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerde.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerde.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,25 +34,28 @@ import org.springframework.util.MimeType;
 import org.springframework.util.MimeTypeUtils;
 
 /**
- * A {@link Serde} implementation that wraps the list of {@link MessageConverter}s
- * from {@link CompositeMessageConverterFactory}.
+ * A {@link Serde} implementation that wraps the list of {@link MessageConverter}s from
+ * {@link CompositeMessageConverterFactory}.
  *
  * The primary motivation for this class is to provide an avro based {@link Serde} that is
  * compatible with the schema registry that Spring Cloud Stream provides. When using the
- * schema registry support from Spring Cloud Stream in a Kafka Streams binder based application,
- * the applications can deserialize the incoming Kafka Streams records using the built in
- * Avro {@link MessageConverter}. However, this same message conversion approach will not work
- * downstream in other operations in the topology for Kafka Streams as some of them needs a
- * {@link Serde} instance that can talk to the Spring Cloud Stream provided Schema Registry.
- * This implementation will solve that problem.
+ * schema registry support from Spring Cloud Stream in a Kafka Streams binder based
+ * application, the applications can deserialize the incoming Kafka Streams records using
+ * the built in Avro {@link MessageConverter}. However, this same message conversion
+ * approach will not work downstream in other operations in the topology for Kafka Streams
+ * as some of them needs a {@link Serde} instance that can talk to the Spring Cloud Stream
+ * provided Schema Registry. This implementation will solve that problem.
  *
- * Only Avro and JSON based converters are exposed as binder provided {@link Serde} implementations currently.
+ * Only Avro and JSON based converters are exposed as binder provided {@link Serde}
+ * implementations currently.
  *
- * Users of this class must call the {@link CompositeNonNativeSerde#configure(Map, boolean)} method
- * to configure the {@link Serde} object. At the very least the configuration map must include a key
- * called "valueClass" to indicate the type of the target object for deserialization. If any other
- * content type other than JSON is needed (only Avro is available now other than JSON), that needs
- * to be included in the configuration map with the key "contentType". For example,
+ * Users of this class must call the
+ * {@link CompositeNonNativeSerde#configure(Map, boolean)} method to configure the
+ * {@link Serde} object. At the very least the configuration map must include a key called
+ * "valueClass" to indicate the type of the target object for deserialization. If any
+ * other content type other than JSON is needed (only Avro is available now other than
+ * JSON), that needs to be included in the configuration map with the key "contentType".
+ * For example,
  *
  * 
  * Map<String, Object> config = new HashMap<>();
@@ -62,14 +65,14 @@ import org.springframework.util.MimeTypeUtils;
  *
  * Then use the above map when calling the configure method.
  *
- * This class is only intended to be used when writing a Spring Cloud Stream Kafka Streams application
- * that uses Spring Cloud Stream schema registry for schema evolution.
+ * This class is only intended to be used when writing a Spring Cloud Stream Kafka Streams
+ * application that uses Spring Cloud Stream schema registry for schema evolution.
  *
- * An instance of this class is provided as a bean by the binder configuration and typically the applications
- * can autowire that bean. This is the expected usage pattern of this class.
+ * An instance of this class is provided as a bean by the binder configuration and
+ * typically the applications can autowire that bean. This is the expected usage pattern
+ * of this class.
  *
  * @param  type of the object to marshall
- *
  * @author Soby Chacko
  * @since 2.1
  */
@@ -79,15 +82,19 @@ public class CompositeNonNativeSerde implements Serde {
 
 	private static final String AVRO_FORMAT = "avro";
 
-	private static final MimeType DEFAULT_AVRO_MIME_TYPE = new MimeType("application", "*+" + AVRO_FORMAT);
+	private static final MimeType DEFAULT_AVRO_MIME_TYPE = new MimeType("application",
+			"*+" + AVRO_FORMAT);
 
 	private final CompositeNonNativeDeserializer compositeNonNativeDeserializer;
 
 	private final CompositeNonNativeSerializer compositeNonNativeSerializer;
 
-	public CompositeNonNativeSerde(CompositeMessageConverterFactory compositeMessageConverterFactory) {
-		this.compositeNonNativeDeserializer = new CompositeNonNativeDeserializer<>(compositeMessageConverterFactory);
-		this.compositeNonNativeSerializer = new CompositeNonNativeSerializer<>(compositeMessageConverterFactory);
+	public CompositeNonNativeSerde(
+			CompositeMessageConverterFactory compositeMessageConverterFactory) {
+		this.compositeNonNativeDeserializer = new CompositeNonNativeDeserializer<>(
+				compositeMessageConverterFactory);
+		this.compositeNonNativeSerializer = new CompositeNonNativeSerializer<>(
+				compositeMessageConverterFactory);
 	}
 
 	@Override
@@ -98,7 +105,7 @@ public class CompositeNonNativeSerde implements Serde {
 
 	@Override
 	public void close() {
-		//No-op
+		// No-op
 	}
 
 	@Override
@@ -142,15 +149,19 @@ public class CompositeNonNativeSerde implements Serde {
 
 		private Class valueClass;
 
-		CompositeNonNativeDeserializer(CompositeMessageConverterFactory compositeMessageConverterFactory) {
-			this.messageConverter = compositeMessageConverterFactory.getMessageConverterForAllRegistered();
+		CompositeNonNativeDeserializer(
+				CompositeMessageConverterFactory compositeMessageConverterFactory) {
+			this.messageConverter = compositeMessageConverterFactory
+					.getMessageConverterForAllRegistered();
 		}
 
 		@Override
 		public void configure(Map configs, boolean isKey) {
-			Assert.isTrue(configs.containsKey(VALUE_CLASS_HEADER), "Deserializers must provide a configuration for valueClass.");
+			Assert.isTrue(configs.containsKey(VALUE_CLASS_HEADER),
+					"Deserializers must provide a configuration for valueClass.");
 			final Object valueClass = configs.get(VALUE_CLASS_HEADER);
-			Assert.isTrue(valueClass instanceof Class, "Deserializers must provide a valid value for valueClass.");
+			Assert.isTrue(valueClass instanceof Class,
+					"Deserializers must provide a valid value for valueClass.");
 			this.valueClass = (Class) valueClass;
 			this.mimeType = resolveMimeType(configs);
 		}
@@ -159,16 +170,19 @@ public class CompositeNonNativeSerde implements Serde {
 		@Override
 		public U deserialize(String topic, byte[] data) {
 			Message message = MessageBuilder.withPayload(data)
-					.setHeader(MessageHeaders.CONTENT_TYPE, this.mimeType.toString()).build();
-			U messageConverted = (U) this.messageConverter.fromMessage(message, this.valueClass);
+					.setHeader(MessageHeaders.CONTENT_TYPE, this.mimeType.toString())
+					.build();
+			U messageConverted = (U) this.messageConverter.fromMessage(message,
+					this.valueClass);
 			Assert.notNull(messageConverted, "Deserialization failed.");
 			return messageConverted;
 		}
 
 		@Override
 		public void close() {
-			//No-op
+			// No-op
 		}
+
 	}
 
 	/**
@@ -179,10 +193,13 @@ public class CompositeNonNativeSerde implements Serde {
 	private static class CompositeNonNativeSerializer implements Serializer {
 
 		private final MessageConverter messageConverter;
+
 		private MimeType mimeType;
 
-		CompositeNonNativeSerializer(CompositeMessageConverterFactory compositeMessageConverterFactory) {
-			this.messageConverter = compositeMessageConverterFactory.getMessageConverterForAllRegistered();
+		CompositeNonNativeSerializer(
+				CompositeMessageConverterFactory compositeMessageConverterFactory) {
+			this.messageConverter = compositeMessageConverterFactory
+					.getMessageConverterForAllRegistered();
 		}
 
 		@Override
@@ -196,14 +213,16 @@ public class CompositeNonNativeSerde implements Serde {
 			Map headers = new HashMap<>(message.getHeaders());
 			headers.put(MessageHeaders.CONTENT_TYPE, this.mimeType.toString());
 			MessageHeaders messageHeaders = new MessageHeaders(headers);
-			final Object payload = this.messageConverter.toMessage(message.getPayload(),
-					messageHeaders).getPayload();
+			final Object payload = this.messageConverter
+					.toMessage(message.getPayload(), messageHeaders).getPayload();
 			return (byte[]) payload;
 		}
 
 		@Override
 		public void close() {
-			//No-op
+			// No-op
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/bootstrap/KafkaStreamsBinderBootstrapTest.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/bootstrap/KafkaStreamsBinderBootstrapTest.java
index 660c404cc..f9411e66a 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/bootstrap/KafkaStreamsBinderBootstrapTest.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/bootstrap/KafkaStreamsBinderBootstrapTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,26 +39,34 @@ public class KafkaStreamsBinderBootstrapTest {
 
 	@Test
 	public void testKafkaStreamsBinderWithCustomEnvironmentCanStart() {
-		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(SimpleApplication.class)
-				.web(WebApplicationType.NONE)
-				.run("--spring.cloud.stream.kafka.streams.default.consumer.application-id=testKafkaStreamsBinderWithCustomEnvironmentCanStart",
+		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(
+				SimpleApplication.class).web(WebApplicationType.NONE).run(
+						"--spring.cloud.stream.kafka.streams.default.consumer.application-id"
+								+ "=testKafkaStreamsBinderWithCustomEnvironmentCanStart",
 						"--spring.cloud.stream.bindings.input.destination=foo",
 						"--spring.cloud.stream.bindings.input.binder=kBind1",
 						"--spring.cloud.stream.binders.kBind1.type=kstream",
-						"--spring.cloud.stream.binders.kBind1.environment.spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-						"--spring.cloud.stream.binders.kBind1.environment.spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+						"--spring.cloud.stream.binders.kBind1.environment"
+								+ ".spring.cloud.stream.kafka.streams.binder.brokers"
+								+ "=" + embeddedKafka.getBrokersAsString(),
+						"--spring.cloud.stream.binders.kBind1.environment.spring"
+								+ ".cloud.stream.kafka.streams.binder.zkNodes="
+								+ embeddedKafka.getZookeeperConnectionString());
 
 		applicationContext.close();
 	}
 
 	@Test
 	public void testKafkaStreamsBinderWithStandardConfigurationCanStart() {
-		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(SimpleApplication.class)
-				.web(WebApplicationType.NONE)
-				.run("--spring.cloud.stream.kafka.streams.default.consumer.application-id=testKafkaStreamsBinderWithStandardConfigurationCanStart",
+		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(
+				SimpleApplication.class).web(WebApplicationType.NONE).run(
+						"--spring.cloud.stream.kafka.streams.default.consumer.application-id"
+								+ "=testKafkaStreamsBinderWithStandardConfigurationCanStart",
 						"--spring.cloud.stream.bindings.input.destination=foo",
-						"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-						"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+						"--spring.cloud.stream.kafka.streams.binder.brokers="
+								+ embeddedKafka.getBrokersAsString(),
+						"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+								+ embeddedKafka.getZookeeperConnectionString());
 
 		applicationContext.close();
 	}
@@ -71,10 +79,14 @@ public class KafkaStreamsBinderBootstrapTest {
 		public void handle(@Input("input") KStream stream) {
 
 		}
+
 	}
 
 	interface StreamSourceProcessor {
+
 		@Input("input")
 		KStream inputStream();
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializationErrorHandlerByKafkaTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializationErrorHandlerByKafkaTests.java
index 6d505dde5..7dc07d51b 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializationErrorHandlerByKafkaTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializationErrorHandlerByKafkaTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -69,27 +69,32 @@ import static org.mockito.Mockito.verify;
 public abstract class DeserializationErrorHandlerByKafkaTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts", "error.words.group",
-			"error.word1.groupx", "error.word2.groupx");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts", "error.words.group", "error.word1.groupx", "error.word2.groupx");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	@SpyBean
-	org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsMessageConversionDelegate KafkaStreamsMessageConversionDelegate;
+	org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsMessageConversionDelegate conversionDelegate;
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		System.setProperty("spring.cloud.stream.kafka.streams.binder.brokers", embeddedKafka.getBrokersAsString());
-		System.setProperty("spring.cloud.stream.kafka.streams.binder.zkNodes", embeddedKafka.getZookeeperConnectionString());
+		System.setProperty("spring.cloud.stream.kafka.streams.binder.brokers",
+				embeddedKafka.getBrokersAsString());
+		System.setProperty("spring.cloud.stream.kafka.streams.binder.zkNodes",
+				embeddedKafka.getZookeeperConnectionString());
 
-		System.setProperty("server.port","0");
-		System.setProperty("spring.jmx.enabled","false");
+		System.setProperty("server.port", "0");
+		System.setProperty("spring.jmx.enabled", "false");
 
-		Map consumerProps = KafkaTestUtils.consumerProps("fooc", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("fooc", "false",
+				embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts");
 	}
@@ -99,42 +104,50 @@ public abstract class DeserializationErrorHandlerByKafkaTests {
 		consumer.close();
 	}
 
+	// @checkstyle:off
 	@SpringBootTest(properties = {
 			"spring.cloud.stream.bindings.input.consumer.useNativeDecoding=true",
 			"spring.cloud.stream.bindings.output.producer.useNativeEncoding=true",
 			"spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id=deser-kafka-dlq",
 			"spring.cloud.stream.bindings.input.group=group",
 			"spring.cloud.stream.kafka.streams.binder.serdeError=sendToDlq",
-			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=" +
-					"org.apache.kafka.common.serialization.Serdes$IntegerSerde"},
-			webEnvironment= SpringBootTest.WebEnvironment.NONE
-	)
-	public static class DeserializationByKafkaAndDlqTests extends DeserializationErrorHandlerByKafkaTests {
+			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde="
+					+ "org.apache.kafka.common.serialization.Serdes$IntegerSerde" }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
+	// @checkstyle:on
+	public static class DeserializationByKafkaAndDlqTests
+			extends DeserializationErrorHandlerByKafkaTests {
 
 		@Test
 		@SuppressWarnings("unchecked")
 		public void test() throws Exception {
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("words");
 			template.sendDefault("foobar");
 
-			Map consumerProps = KafkaTestUtils.consumerProps("foobar", "false", embeddedKafka);
+			Map consumerProps = KafkaTestUtils.consumerProps("foobar",
+					"false", embeddedKafka);
 			consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+					consumerProps);
 			Consumer consumer1 = cf.createConsumer();
 			embeddedKafka.consumeFromAnEmbeddedTopic(consumer1, "error.words.group");
 
-			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer1, "error.words.group");
+			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer1,
+					"error.words.group");
 			assertThat(cr.value().equals("foobar")).isTrue();
 
-			//Ensuring that the deserialization was indeed done by Kafka natively
-			verify(KafkaStreamsMessageConversionDelegate, never()).deserializeOnInbound(any(Class.class), any(KStream.class));
-			verify(KafkaStreamsMessageConversionDelegate, never()).serializeOnOutbound(any(KStream.class));
+			// Ensuring that the deserialization was indeed done by Kafka natively
+			verify(conversionDelegate, never()).deserializeOnInbound(any(Class.class),
+					any(KStream.class));
+			verify(conversionDelegate, never()).serializeOnOutbound(any(KStream.class));
 		}
+
 	}
 
+	// @checkstyle:off
 	@SpringBootTest(properties = {
 			"spring.cloud.stream.bindings.input.consumer.useNativeDecoding=true",
 			"spring.cloud.stream.bindings.output.producer.useNativeEncoding=true",
@@ -142,17 +155,18 @@ public abstract class DeserializationErrorHandlerByKafkaTests {
 			"spring.cloud.stream.kafka.streams.default.consumer.applicationId=deser-kafka-dlq-multi-input",
 			"spring.cloud.stream.bindings.input.group=groupx",
 			"spring.cloud.stream.kafka.streams.binder.serdeError=sendToDlq",
-			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=" +
-					"org.apache.kafka.common.serialization.Serdes$IntegerSerde"},
-			webEnvironment= SpringBootTest.WebEnvironment.NONE
-	)
-	public static class DeserializationByKafkaAndDlqTestsWithMultipleInputs extends DeserializationErrorHandlerByKafkaTests {
+			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde="
+					+ "org.apache.kafka.common.serialization.Serdes$IntegerSerde" }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
+	// @checkstyle:on
+	public static class DeserializationByKafkaAndDlqTestsWithMultipleInputs
+			extends DeserializationErrorHandlerByKafkaTests {
 
 		@Test
 		@SuppressWarnings("unchecked")
-		public void test() throws Exception {
+		public void test() {
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("word1");
 			template.sendDefault("foobar");
@@ -160,22 +174,30 @@ public abstract class DeserializationErrorHandlerByKafkaTests {
 			template.setDefaultTopic("word2");
 			template.sendDefault("foobar");
 
-			Map consumerProps = KafkaTestUtils.consumerProps("foobarx", "false", embeddedKafka);
+			Map consumerProps = KafkaTestUtils.consumerProps("foobarx",
+					"false", embeddedKafka);
 			consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+					consumerProps);
 			Consumer consumer1 = cf.createConsumer();
-			embeddedKafka.consumeFromEmbeddedTopics(consumer1, "error.word1.groupx", "error.word2.groupx");
+			embeddedKafka.consumeFromEmbeddedTopics(consumer1, "error.word1.groupx",
+					"error.word2.groupx");
 
-			//TODO: Investigate why the ordering matters below: i.e. if we consume from error.word1.groupx first, an exception is thrown.
-			ConsumerRecord cr1 = KafkaTestUtils.getSingleRecord(consumer1, "error.word2.groupx");
+			// TODO: Investigate why the ordering matters below: i.e.
+			// if we consume from error.word1.groupx first, an exception is thrown.
+			ConsumerRecord cr1 = KafkaTestUtils.getSingleRecord(consumer1,
+					"error.word2.groupx");
 			assertThat(cr1.value().equals("foobar")).isTrue();
-			ConsumerRecord cr2 = KafkaTestUtils.getSingleRecord(consumer1, "error.word1.groupx");
+			ConsumerRecord cr2 = KafkaTestUtils.getSingleRecord(consumer1,
+					"error.word1.groupx");
 			assertThat(cr2.value().equals("foobar")).isTrue();
 
-			//Ensuring that the deserialization was indeed done by Kafka natively
-			verify(KafkaStreamsMessageConversionDelegate, never()).deserializeOnInbound(any(Class.class), any(KStream.class));
-			verify(KafkaStreamsMessageConversionDelegate, never()).serializeOnOutbound(any(KStream.class));
+			// Ensuring that the deserialization was indeed done by Kafka natively
+			verify(conversionDelegate, never()).deserializeOnInbound(any(Class.class),
+					any(KStream.class));
+			verify(conversionDelegate, never()).serializeOnOutbound(any(KStream.class));
 		}
+
 	}
 
 	@EnableBinding(KafkaStreamsProcessor.class)
@@ -192,14 +214,15 @@ public abstract class DeserializationErrorHandlerByKafkaTests {
 		public KStream process(KStream input) {
 
 			return input
-					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.flatMapValues(
+							value -> Arrays.asList(value.toLowerCase().split("\\W+")))
 					.map((key, value) -> new KeyValue<>(value, value))
 					.groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
-					.windowedBy(timeWindows)
-					.count(Materialized.as("foo-WordCounts-x"))
-					.toStream()
-					.map((key, value) -> new KeyValue<>(null, "Count for " + key.key() + " : " + value));
+					.windowedBy(timeWindows).count(Materialized.as("foo-WordCounts-x"))
+					.toStream().map((key, value) -> new KeyValue<>(null,
+							"Count for " + key.key() + " : " + value));
 		}
 
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializtionErrorHandlerByBinderTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializtionErrorHandlerByBinderTests.java
index bb5794f7f..8714cd5e2 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializtionErrorHandlerByBinderTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/DeserializtionErrorHandlerByBinderTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -63,28 +63,35 @@ import static org.mockito.Mockito.verify;
 public abstract class DeserializtionErrorHandlerByBinderTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts-id", "error.foos.foobar-group",
-			"error.foos1.fooz-group", "error.foos2.fooz-group");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts-id", "error.foos.foobar-group", "error.foos1.fooz-group",
+			"error.foos2.fooz-group");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	@SpyBean
-	org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsMessageConversionDelegate KafkaStreamsMessageConversionDelegate;
+	org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsMessageConversionDelegate conversionDelegate;
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		System.setProperty("spring.cloud.stream.kafka.streams.binder.brokers", embeddedKafka.getBrokersAsString());
-		System.setProperty("spring.cloud.stream.kafka.streams.binder.zkNodes", embeddedKafka.getZookeeperConnectionString());
+		System.setProperty("spring.cloud.stream.kafka.streams.binder.brokers",
+				embeddedKafka.getBrokersAsString());
+		System.setProperty("spring.cloud.stream.kafka.streams.binder.zkNodes",
+				embeddedKafka.getZookeeperConnectionString());
 
-		System.setProperty("server.port","0");
-		System.setProperty("spring.jmx.enabled","false");
+		System.setProperty("server.port", "0");
+		System.setProperty("spring.jmx.enabled", "false");
 
-		Map consumerProps = KafkaTestUtils.consumerProps("foob", "false", embeddedKafka);
-		//consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, Deserializer.class.getName());
+		Map consumerProps = KafkaTestUtils.consumerProps("foob", "false",
+				embeddedKafka);
+		// consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+		// Deserializer.class.getName());
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts-id");
 	}
@@ -94,64 +101,77 @@ public abstract class DeserializtionErrorHandlerByBinderTests {
 		consumer.close();
 	}
 
-	@SpringBootTest(properties = {
-			"spring.cloud.stream.bindings.input.destination=foos",
+	@SpringBootTest(properties = { "spring.cloud.stream.bindings.input.destination=foos",
 			"spring.cloud.stream.bindings.output.destination=counts-id",
 			"spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-			"spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+			"spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+					+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+					+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 			"spring.cloud.stream.bindings.output.producer.headerMode=raw",
-			"spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
+			"spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde"
+					+ "=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
 			"spring.cloud.stream.bindings.input.consumer.headerMode=raw",
 			"spring.cloud.stream.kafka.streams.binder.serdeError=sendToDlq",
-			"spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id=deserializationByBinderAndDlqTests",
-			"spring.cloud.stream.bindings.input.group=foobar-group"},
-			webEnvironment= SpringBootTest.WebEnvironment.NONE
-	)
-	public static class DeserializationByBinderAndDlqTests extends DeserializtionErrorHandlerByBinderTests {
+			"spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id"
+					+ "=deserializationByBinderAndDlqTests",
+			"spring.cloud.stream.bindings.input.group=foobar-group" }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
+	public static class DeserializationByBinderAndDlqTests
+			extends DeserializtionErrorHandlerByBinderTests {
 
 		@Test
 		@SuppressWarnings("unchecked")
 		public void test() throws Exception {
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("foos");
 			template.sendDefault("hello");
 
-			Map consumerProps = KafkaTestUtils.consumerProps("foobar", "false", embeddedKafka);
+			Map consumerProps = KafkaTestUtils.consumerProps("foobar",
+					"false", embeddedKafka);
 			consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+					consumerProps);
 			Consumer consumer1 = cf.createConsumer();
-			embeddedKafka.consumeFromAnEmbeddedTopic(consumer1, "error.foos.foobar-group");
+			embeddedKafka.consumeFromAnEmbeddedTopic(consumer1,
+					"error.foos.foobar-group");
 
-			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer1, "error.foos.foobar-group");
+			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer1,
+					"error.foos.foobar-group");
 			assertThat(cr.value().equals("hello")).isTrue();
 
-			//Ensuring that the deserialization was indeed done by the binder
-			verify(KafkaStreamsMessageConversionDelegate).deserializeOnInbound(any(Class.class), any(KStream.class));
+			// Ensuring that the deserialization was indeed done by the binder
+			verify(conversionDelegate).deserializeOnInbound(any(Class.class),
+					any(KStream.class));
 		}
+
 	}
 
 	@SpringBootTest(properties = {
 			"spring.cloud.stream.bindings.input.destination=foos1,foos2",
 			"spring.cloud.stream.bindings.output.destination=counts-id",
 			"spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-			"spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-			"spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
+			"spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+					+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+			"spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+					+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+			"spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde"
+					+ "=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
 			"spring.cloud.stream.kafka.streams.binder.serdeError=sendToDlq",
-			"spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id=deserializationByBinderAndDlqTestsWithMultipleInputs",
-			"spring.cloud.stream.bindings.input.group=fooz-group"},
-			webEnvironment= SpringBootTest.WebEnvironment.NONE
-	)
-	public static class DeserializationByBinderAndDlqTestsWithMultipleInputs extends DeserializtionErrorHandlerByBinderTests {
+			"spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id"
+					+ "=deserializationByBinderAndDlqTestsWithMultipleInputs",
+			"spring.cloud.stream.bindings.input.group=fooz-group" }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
+	public static class DeserializationByBinderAndDlqTestsWithMultipleInputs
+			extends DeserializtionErrorHandlerByBinderTests {
 
 		@Test
 		@SuppressWarnings("unchecked")
 		public void test() throws Exception {
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("foos1");
 			template.sendDefault("hello");
@@ -159,21 +179,28 @@ public abstract class DeserializtionErrorHandlerByBinderTests {
 			template.setDefaultTopic("foos2");
 			template.sendDefault("hello");
 
-			Map consumerProps = KafkaTestUtils.consumerProps("foobar1", "false", embeddedKafka);
+			Map consumerProps = KafkaTestUtils.consumerProps("foobar1",
+					"false", embeddedKafka);
 			consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+					consumerProps);
 			Consumer consumer1 = cf.createConsumer();
-			embeddedKafka.consumeFromEmbeddedTopics(consumer1, "error.foos1.fooz-group", "error.foos2.fooz-group");
+			embeddedKafka.consumeFromEmbeddedTopics(consumer1, "error.foos1.fooz-group",
+					"error.foos2.fooz-group");
 
-			ConsumerRecord cr1 = KafkaTestUtils.getSingleRecord(consumer1, "error.foos1.fooz-group");
+			ConsumerRecord cr1 = KafkaTestUtils.getSingleRecord(consumer1,
+					"error.foos1.fooz-group");
 			assertThat(cr1.value().equals("hello")).isTrue();
 
-			ConsumerRecord cr2 = KafkaTestUtils.getSingleRecord(consumer1, "error.foos2.fooz-group");
+			ConsumerRecord cr2 = KafkaTestUtils.getSingleRecord(consumer1,
+					"error.foos2.fooz-group");
 			assertThat(cr2.value().equals("hello")).isTrue();
 
-			//Ensuring that the deserialization was indeed done by the binder
-			verify(KafkaStreamsMessageConversionDelegate).deserializeOnInbound(any(Class.class), any(KStream.class));
+			// Ensuring that the deserialization was indeed done by the binder
+			verify(conversionDelegate).deserializeOnInbound(any(Class.class),
+					any(KStream.class));
 		}
+
 	}
 
 	@EnableBinding(KafkaStreamsProcessor.class)
@@ -183,16 +210,17 @@ public abstract class DeserializtionErrorHandlerByBinderTests {
 		@StreamListener("input")
 		@SendTo("output")
 		public KStream process(KStream input) {
-			return input
-					.filter((key, product) -> product.getId() == 123)
+			return input.filter((key, product) -> product.getId() == 123)
 					.map((key, value) -> new KeyValue<>(value, value))
-					.groupByKey(Serialized.with(new JsonSerde<>(Product.class), new JsonSerde<>(Product.class)))
+					.groupByKey(Serialized.with(new JsonSerde<>(Product.class),
+							new JsonSerde<>(Product.class)))
 					.windowedBy(TimeWindows.of(5000))
-					.count(Materialized.as("id-count-store-x"))
-					.toStream()
+					.count(Materialized.as("id-count-store-x")).toStream()
 					.map((key, value) -> new KeyValue<>(key.key().id, value));
 		}
+
 	}
+
 	static class Product {
 
 		Integer id;
@@ -204,5 +232,7 @@ public abstract class DeserializtionErrorHandlerByBinderTests {
 		public void setId(Integer id) {
 			this.id = id;
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderMultipleInputTopicsTest.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderMultipleInputTopicsTest.java
index 799b9c2d5..912ddca5a 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderMultipleInputTopicsTest.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderMultipleInputTopicsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,30 +55,34 @@ import org.springframework.messaging.handler.annotation.SendTo;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
+ * This test case demonstrates a kafk-streams topology which consumes messages from
+ * multiple kafka topics(destinations).
+ *
+ * See
+ * {@link KafkaStreamsBinderMultipleInputTopicsTest#testKstreamWordCountWithStringInputAndPojoOuput}
+ * where the input topic names are specified as comma-separated String values for the
+ * property spring.cloud.stream.bindings.input.destination.
+ *
  * @author Sarath Shyam
- * 
- * This test case demonstrates a kafk-streams topology which consumes messages from 
- * multiple kafka topics(destinations). 
- * See {@link KafkaStreamsBinderMultipleInputTopicsTest#testKstreamWordCountWithStringInputAndPojoOuput} where
- * the input topic names are specified as comma-separated String values for
- * the property spring.cloud.stream.bindings.input.destination. 
- * 
- * 
  */
 public class KafkaStreamsBinderMultipleInputTopicsTest {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("group", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group", "false",
+				embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts");
 	}
@@ -90,7 +94,8 @@ public class KafkaStreamsBinderMultipleInputTopicsTest {
 
 	@Test
 	public void testKstreamWordCountWithStringInputAndPojoOuput() throws Exception {
-		SpringApplication app = new SpringApplication(WordCountProcessorApplication.class);
+		SpringApplication app = new SpringApplication(
+				WordCountProcessorApplication.class);
 		app.setWebApplicationType(WebApplicationType.NONE);
 
 		ConfigurableApplicationContext context = app.run("--server.port=0",
@@ -99,45 +104,49 @@ public class KafkaStreamsBinderMultipleInputTopicsTest {
 				"--spring.cloud.stream.bindings.output.destination=counts",
 				"--spring.cloud.stream.bindings.output.contentType=application/json",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.bindings.input.consumer.headerMode=raw",
 				"--spring.cloud.stream.kafka.streams.timeWindow.length=5000",
 				"--spring.cloud.stream.kafka.streams.timeWindow.advanceBy=0",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=WordCountProcessorApplication-xyz",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+						+ "=WordCountProcessorApplication-xyz",
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString());
 		try {
 			receiveAndValidate(context);
-		} finally {
+		}
+		finally {
 			context.close();
 		}
 	}
 
-	private void receiveAndValidate(ConfigurableApplicationContext context) throws Exception {
+	private void receiveAndValidate(ConfigurableApplicationContext context)
+			throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		KafkaTemplate template = new KafkaTemplate<>(pf, true);
 		template.setDefaultTopic("words1");
 		template.sendDefault("foobar1");
 		template.setDefaultTopic("words2");
 		template.sendDefault("foobar2");
-		
-		//Sleep a bit so that both the messages are processed before reading from the output topic.
-		//Else assertions might fail arbitrarily.
+		// Sleep a bit so that both the messages are processed before reading from the
+		// output topic.
+		// Else assertions might fail arbitrarily.
 		Thread.sleep(5000);
-		
-		ConsumerRecords received = KafkaTestUtils.getRecords(consumer); 
-		
+		ConsumerRecords received = KafkaTestUtils.getRecords(consumer);
 		List wordCounts = new ArrayList<>(2);
-		
-		received.records("counts").forEach((consumerRecord) -> {
-			wordCounts.add((consumerRecord.value()));
-		});
+
+		received.records("counts")
+				.forEach((consumerRecord) -> wordCounts.add((consumerRecord.value())));
 		System.out.println(wordCounts);
 		assertThat(wordCounts.contains("{\"word\":\"foobar1\",\"count\":1}")).isTrue();
 		assertThat(wordCounts.contains("{\"word\":\"foobar2\",\"count\":1}")).isTrue();
-		
 	}
 
 	@EnableBinding(KafkaStreamsProcessor.class)
@@ -145,22 +154,22 @@ public class KafkaStreamsBinderMultipleInputTopicsTest {
 	@EnableConfigurationProperties(KafkaStreamsApplicationSupportProperties.class)
 	static class WordCountProcessorApplication {
 
-
 		@StreamListener
 		@SendTo("output")
-		public KStream process(@Input("input") KStream input) {
+		public KStream process(
+				@Input("input") KStream input) {
 
-			input.map((k,v) -> {
+			input.map((k, v) -> {
 				System.out.println(k);
 				System.out.println(v);
-				return new KeyValue<>(k,v);
+				return new KeyValue<>(k, v);
 			});
 			return input
-					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.flatMapValues(
+							value -> Arrays.asList(value.toLowerCase().split("\\W+")))
 					.map((key, value) -> new KeyValue<>(value, value))
 					.groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
-					.count(Materialized.as("WordCounts"))
-					.toStream()
+					.count(Materialized.as("WordCounts")).toStream()
 					.map((key, value) -> new KeyValue<>(null, new WordCount(key, value)));
 		}
 
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests.java
index 44f48ef57..4735c0196 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,18 +57,23 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts-id");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts-id");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("group-id", "false", embeddedKafka);
-		//consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, Deserializer.class.getName());
+		Map consumerProps = KafkaTestUtils.consumerProps("group-id",
+				"false", embeddedKafka);
+		// consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+		// Deserializer.class.getName());
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts-id");
 	}
@@ -87,26 +92,36 @@ public class KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests {
 				"--spring.cloud.stream.bindings.input.destination=foos",
 				"--spring.cloud.stream.bindings.output.destination=counts-id",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests-xyz",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde="
+						+ "org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde="
+						+ "org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde="
+						+ "org.apache.kafka.common.serialization.Serdes$IntegerSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId="
+						+ "KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests-xyz",
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString());
 		try {
 			receiveAndValidateFoo(context);
-		} finally {
+		}
+		finally {
 			context.close();
 		}
 	}
 
-	private void receiveAndValidateFoo(ConfigurableApplicationContext context) throws Exception {
+	private void receiveAndValidateFoo(ConfigurableApplicationContext context)
+			throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		KafkaTemplate template = new KafkaTemplate<>(pf, true);
 		template.setDefaultTopic("foos");
 		template.sendDefault("{\"id\":\"123\"}");
-		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts-id");
+		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+				"counts-id");
 
 		assertThat(cr.key()).isEqualTo(123);
 		ObjectMapper om = new ObjectMapper();
@@ -121,15 +136,15 @@ public class KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests {
 		@StreamListener("input")
 		@SendTo("output")
 		public KStream process(KStream input) {
-			return input
-					.filter((key, product) -> product.getId() == 123)
+			return input.filter((key, product) -> product.getId() == 123)
 					.map((key, value) -> new KeyValue<>(value, value))
-					.groupByKey(Serialized.with(new JsonSerde<>(Product.class), new JsonSerde<>(Product.class)))
+					.groupByKey(Serialized.with(new JsonSerde<>(Product.class),
+							new JsonSerde<>(Product.class)))
 					.windowedBy(TimeWindows.of(5000))
-					.count(Materialized.as("id-count-store-x"))
-					.toStream()
+					.count(Materialized.as("id-count-store-x")).toStream()
 					.map((key, value) -> new KeyValue<>(key.key().id, value));
 		}
+
 	}
 
 	static class Product {
@@ -143,5 +158,7 @@ public class KafkaStreamsBinderPojoInputAndPrimitiveTypeOutputTests {
 		public void setId(Integer id) {
 			this.id = id;
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderWordCountIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderWordCountIntegrationTests.java
index 1f091f82c..7f0859b80 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderWordCountIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsBinderWordCountIntegrationTests.java
@@ -73,17 +73,21 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class KafkaStreamsBinderWordCountIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("group", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group", "false",
+				embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts");
 	}
@@ -94,8 +98,10 @@ public class KafkaStreamsBinderWordCountIntegrationTests {
 	}
 
 	@Test
-	public void testKstreamWordCountWithApplicationIdSpecifiedAtDefaultConsumer() throws Exception {
-		SpringApplication app = new SpringApplication(WordCountProcessorApplication.class);
+	public void testKstreamWordCountWithApplicationIdSpecifiedAtDefaultConsumer()
+			throws Exception {
+		SpringApplication app = new SpringApplication(
+				WordCountProcessorApplication.class);
 		app.setWebApplicationType(WebApplicationType.NONE);
 
 		try (ConfigurableApplicationContext context = app.run("--server.port=0",
@@ -105,21 +111,27 @@ public class KafkaStreamsBinderWordCountIntegrationTests {
 				"--spring.cloud.stream.bindings.output.contentType=application/json",
 				"--spring.cloud.stream.kafka.streams.default.consumer.application-id=basic-word-count",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.bindings.output.producer.headerMode=raw",
 				"--spring.cloud.stream.bindings.input.consumer.headerMode=raw",
 				"--spring.cloud.stream.kafka.streams.timeWindow.length=5000",
 				"--spring.cloud.stream.kafka.streams.timeWindow.advanceBy=0",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString())) {
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString())) {
 			receiveAndValidate(context);
 		}
 	}
 
 	@Test
-	public void testKstreamWordCountWithInputBindingLevelApplicationId() throws Exception {
-		SpringApplication app = new SpringApplication(WordCountProcessorApplication.class);
+	public void testKstreamWordCountWithInputBindingLevelApplicationId()
+			throws Exception {
+		SpringApplication app = new SpringApplication(
+				WordCountProcessorApplication.class);
 		app.setWebApplicationType(WebApplicationType.NONE);
 
 		try (ConfigurableApplicationContext context = app.run("--server.port=0",
@@ -129,43 +141,55 @@ public class KafkaStreamsBinderWordCountIntegrationTests {
 				"--spring.cloud.stream.bindings.output.contentType=application/json",
 				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id=basic-word-count",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.kafka.streams.timeWindow.length=5000",
 				"--spring.cloud.stream.kafka.streams.timeWindow.advanceBy=0",
 				"--spring.cloud.stream.bindings.input.consumer.concurrency=2",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString())) {
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString())) {
 			receiveAndValidate(context);
-			//Assertions on StreamBuilderFactoryBean
-			StreamsBuilderFactoryBean streamsBuilderFactoryBean = context.getBean("&stream-builder-process", StreamsBuilderFactoryBean.class);
+			// Assertions on StreamBuilderFactoryBean
+			StreamsBuilderFactoryBean streamsBuilderFactoryBean = context
+					.getBean("&stream-builder-process", StreamsBuilderFactoryBean.class);
 			KafkaStreams kafkaStreams = streamsBuilderFactoryBean.getKafkaStreams();
-			ReadOnlyWindowStore store = kafkaStreams.store("foo-WordCounts", QueryableStoreTypes.windowStore());
+			ReadOnlyWindowStore store = kafkaStreams
+					.store("foo-WordCounts", QueryableStoreTypes.windowStore());
 			assertThat(store).isNotNull();
 
-			Map streamConfigGlobalProperties = context.getBean("streamConfigGlobalProperties", Map.class);
+			Map streamConfigGlobalProperties = context
+					.getBean("streamConfigGlobalProperties", Map.class);
 
-			//Ensure that concurrency settings are mapped to number of stream task threads in Kafka Streams.
-			final Integer concurrency = (Integer)streamConfigGlobalProperties.get(StreamsConfig.NUM_STREAM_THREADS_CONFIG);
+			// Ensure that concurrency settings are mapped to number of stream task
+			// threads in Kafka Streams.
+			final Integer concurrency = (Integer) streamConfigGlobalProperties
+					.get(StreamsConfig.NUM_STREAM_THREADS_CONFIG);
 			assertThat(concurrency).isEqualTo(2);
 
 			sendTombStoneRecordsAndVerifyGracefulHandling();
 
-			CleanupConfig cleanup = TestUtils.getPropertyValue(streamsBuilderFactoryBean, "cleanupConfig",
-					CleanupConfig.class);
+			CleanupConfig cleanup = TestUtils.getPropertyValue(streamsBuilderFactoryBean,
+					"cleanupConfig", CleanupConfig.class);
 			assertThat(cleanup.cleanupOnStart()).isTrue();
 			assertThat(cleanup.cleanupOnStop()).isFalse();
 		}
 	}
 
-	private void receiveAndValidate(ConfigurableApplicationContext context) throws Exception {
+	private void receiveAndValidate(ConfigurableApplicationContext context)
+			throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		try {
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("words");
 			template.sendDefault("foobar");
-			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts");
+			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+					"counts");
 			assertThat(cr.value().contains("\"word\":\"foobar\",\"count\":1")).isTrue();
 		}
 		finally {
@@ -175,14 +199,17 @@ public class KafkaStreamsBinderWordCountIntegrationTests {
 
 	private void sendTombStoneRecordsAndVerifyGracefulHandling() throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		try {
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("words");
 			template.sendDefault(null);
-			ConsumerRecords received = consumer.poll(Duration.ofMillis(5000));
-			//By asserting that the received record is empty, we are ensuring that the tombstone record
-			//was handled by the binder gracefully.
+			ConsumerRecords received = consumer
+					.poll(Duration.ofMillis(5000));
+			// By asserting that the received record is empty, we are ensuring that the
+			// tombstone record
+			// was handled by the binder gracefully.
 			assertThat(received.isEmpty()).isTrue();
 		}
 		finally {
@@ -200,16 +227,20 @@ public class KafkaStreamsBinderWordCountIntegrationTests {
 
 		@StreamListener
 		@SendTo("output")
-		public KStream process(@Input("input") KStream input) {
+		public KStream process(
+				@Input("input") KStream input) {
 
 			return input
-					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.flatMapValues(
+							value -> Arrays.asList(value.toLowerCase().split("\\W+")))
 					.map((key, value) -> new KeyValue<>(value, value))
 					.groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
-					.windowedBy(timeWindows)
-					.count(Materialized.as("foo-WordCounts"))
+					.windowedBy(timeWindows).count(Materialized.as("foo-WordCounts"))
 					.toStream()
-					.map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end()))));
+					.map((key, value) -> new KeyValue<>(null,
+							new WordCount(key.key(), value,
+									new Date(key.window().start()),
+									new Date(key.window().end()))));
 		}
 
 		@Bean
@@ -267,6 +298,7 @@ public class KafkaStreamsBinderWordCountIntegrationTests {
 		public void setEnd(Date end) {
 			this.end = end;
 		}
+
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsInteractiveQueryIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsInteractiveQueryIntegrationTests.java
index 8270fb31f..4d5fac090 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsInteractiveQueryIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsInteractiveQueryIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,17 +62,21 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class KafkaStreamsInteractiveQueryIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts-id");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts-id");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("group-id", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group-id",
+				"false", embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts-id");
 	}
@@ -91,40 +95,55 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
 				"--spring.cloud.stream.bindings.input.destination=foos",
 				"--spring.cloud.stream.bindings.output.destination=counts-id",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=ProductCountApplication-abc",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.application.server=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+				"--spring.cloud.stream.kafka.streams.binder.configuration.application.server"
+						+ "=" + embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString());
 		try {
 			receiveAndValidateFoo(context);
-		} finally {
+		}
+		finally {
 			context.close();
 		}
 	}
 
-	private void receiveAndValidateFoo(ConfigurableApplicationContext context) throws Exception {
+	private void receiveAndValidateFoo(ConfigurableApplicationContext context)
+			throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		KafkaTemplate template = new KafkaTemplate<>(pf, true);
 		template.setDefaultTopic("foos");
 		template.sendDefault("{\"id\":\"123\"}");
-		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts-id");
+		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+				"counts-id");
 		assertThat(cr.value().contains("Count for product with ID 123: 1")).isTrue();
 
-		ProductCountApplication.Foo foo = context.getBean(ProductCountApplication.Foo.class);
+		ProductCountApplication.Foo foo = context
+				.getBean(ProductCountApplication.Foo.class);
 		assertThat(foo.getProductStock(123).equals(1L));
 
-		//perform assertions on HostInfo related methods in InteractiveQueryService
-		InteractiveQueryService interactiveQueryService = context.getBean(InteractiveQueryService.class);
+		// perform assertions on HostInfo related methods in InteractiveQueryService
+		InteractiveQueryService interactiveQueryService = context
+				.getBean(InteractiveQueryService.class);
 		HostInfo currentHostInfo = interactiveQueryService.getCurrentHostInfo();
-		assertThat(currentHostInfo.host() + ":" + currentHostInfo.port()).isEqualTo(embeddedKafka.getBrokersAsString());
+		assertThat(currentHostInfo.host() + ":" + currentHostInfo.port())
+				.isEqualTo(embeddedKafka.getBrokersAsString());
 
-		HostInfo hostInfo = interactiveQueryService.getHostInfo("prod-id-count-store", 123, new IntegerSerializer());
-		assertThat(hostInfo.host() + ":" + hostInfo.port()).isEqualTo(embeddedKafka.getBrokersAsString());
+		HostInfo hostInfo = interactiveQueryService.getHostInfo("prod-id-count-store",
+				123, new IntegerSerializer());
+		assertThat(hostInfo.host() + ":" + hostInfo.port())
+				.isEqualTo(embeddedKafka.getBrokersAsString());
 
-		HostInfo hostInfoFoo = interactiveQueryService.getHostInfo("prod-id-count-store-foo", 123, new IntegerSerializer());
+		HostInfo hostInfoFoo = interactiveQueryService
+				.getHostInfo("prod-id-count-store-foo", 123, new IntegerSerializer());
 		assertThat(hostInfoFoo).isNull();
 	}
 
@@ -137,13 +156,13 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
 		@SuppressWarnings("deprecation")
 		public KStream process(KStream input) {
 
-			return input
-					.filter((key, product) -> product.getId() == 123)
+			return input.filter((key, product) -> product.getId() == 123)
 					.map((key, value) -> new KeyValue<>(value.id, value))
-					.groupByKey(Serialized.with(new Serdes.IntegerSerde(), new JsonSerde<>(Product.class)))
-					.count(Materialized.as("prod-id-count-store"))
-					.toStream()
-					.map((key, value) -> new KeyValue<>(null, "Count for product with ID 123: " + value));
+					.groupByKey(Serialized.with(new Serdes.IntegerSerde(),
+							new JsonSerde<>(Product.class)))
+					.count(Materialized.as("prod-id-count-store")).toStream()
+					.map((key, value) -> new KeyValue<>(null,
+							"Count for product with ID 123: " + value));
 		}
 
 		@Bean
@@ -152,6 +171,7 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
 		}
 
 		static class Foo {
+
 			InteractiveQueryService interactiveQueryService;
 
 			Foo(InteractiveQueryService interactiveQueryService) {
@@ -159,12 +179,15 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
 			}
 
 			public Long getProductStock(Integer id) {
-				ReadOnlyKeyValueStore keyValueStore =
-						interactiveQueryService.getQueryableStore("prod-id-count-store", QueryableStoreTypes.keyValueStore());
+				ReadOnlyKeyValueStore keyValueStore = interactiveQueryService
+						.getQueryableStore("prod-id-count-store",
+								QueryableStoreTypes.keyValueStore());
 
 				return (Long) keyValueStore.get(id);
 			}
+
 		}
+
 	}
 
 	static class Product {
@@ -178,5 +201,7 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
 		public void setId(Integer id) {
 			this.id = id;
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsNativeEncodingDecodingTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsNativeEncodingDecodingTests.java
index a8161a859..c9dabd1fb 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsNativeEncodingDecodingTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsNativeEncodingDecodingTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -69,26 +69,32 @@ import static org.mockito.Mockito.verify;
 public abstract class KafkaStreamsNativeEncodingDecodingTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	@SpyBean
-	org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsMessageConversionDelegate KafkaStreamsMessageConversionDelegate;
+	org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsMessageConversionDelegate conversionDelegate;
 
 	private static Consumer consumer;
 
 	@BeforeClass
-	public static void setUp() throws Exception {
-		System.setProperty("spring.cloud.stream.kafka.streams.binder.brokers", embeddedKafka.getBrokersAsString());
-		System.setProperty("spring.cloud.stream.kafka.streams.binder.zkNodes", embeddedKafka.getZookeeperConnectionString());
+	public static void setUp() {
+		System.setProperty("spring.cloud.stream.kafka.streams.binder.brokers",
+				embeddedKafka.getBrokersAsString());
+		System.setProperty("spring.cloud.stream.kafka.streams.binder.zkNodes",
+				embeddedKafka.getZookeeperConnectionString());
 
-		System.setProperty("server.port","0");
-		System.setProperty("spring.jmx.enabled","false");
+		System.setProperty("server.port", "0");
+		System.setProperty("spring.jmx.enabled", "false");
 
-		Map consumerProps = KafkaTestUtils.consumerProps("group", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group", "false",
+				embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts");
 	}
@@ -101,44 +107,54 @@ public abstract class KafkaStreamsNativeEncodingDecodingTests {
 	@SpringBootTest(properties = {
 			"spring.cloud.stream.bindings.input.consumer.useNativeDecoding=true",
 			"spring.cloud.stream.bindings.output.producer.useNativeEncoding=true",
-			"spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=NativeEncodingDecodingEnabledTests-abc"
-	},
-			webEnvironment= SpringBootTest.WebEnvironment.NONE
-			)
-	public static class NativeEncodingDecodingEnabledTests extends KafkaStreamsNativeEncodingDecodingTests {
+			"spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+					+ "=NativeEncodingDecodingEnabledTests-abc" }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
+	public static class NativeEncodingDecodingEnabledTests
+			extends KafkaStreamsNativeEncodingDecodingTests {
 
 		@Test
 		public void test() throws Exception {
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("words");
 			template.sendDefault("foobar");
-			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts");
+			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+					"counts");
 			assertThat(cr.value().equals("Count for foobar : 1")).isTrue();
 
-			verify(KafkaStreamsMessageConversionDelegate, never()).serializeOnOutbound(any(KStream.class));
-			verify(KafkaStreamsMessageConversionDelegate, never()).deserializeOnInbound(any(Class.class), any(KStream.class));
+			verify(conversionDelegate, never()).serializeOnOutbound(any(KStream.class));
+			verify(conversionDelegate, never()).deserializeOnInbound(any(Class.class),
+					any(KStream.class));
 		}
+
 	}
 
-	@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.NONE,
-	properties = "spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=NativeEncodingDecodingEnabledTests-xyz")
-	public static class NativeEncodingDecodingDisabledTests extends KafkaStreamsNativeEncodingDecodingTests {
+	// @checkstyle:off
+	@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = "spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+			+ "=NativeEncodingDecodingEnabledTests-xyz")
+	// @checkstyle:on
+	public static class NativeEncodingDecodingDisabledTests
+			extends KafkaStreamsNativeEncodingDecodingTests {
 
 		@Test
 		public void test() throws Exception {
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("words");
 			template.sendDefault("foobar");
-			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts");
+			ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+					"counts");
 			assertThat(cr.value().equals("Count for foobar : 1")).isTrue();
 
-			verify(KafkaStreamsMessageConversionDelegate).serializeOnOutbound(any(KStream.class));
-			verify(KafkaStreamsMessageConversionDelegate).deserializeOnInbound(any(Class.class), any(KStream.class));
+			verify(conversionDelegate).serializeOnOutbound(any(KStream.class));
+			verify(conversionDelegate).deserializeOnInbound(any(Class.class),
+					any(KStream.class));
 		}
+
 	}
 
 	@EnableBinding(KafkaStreamsProcessor.class)
@@ -155,14 +171,15 @@ public abstract class KafkaStreamsNativeEncodingDecodingTests {
 		public KStream process(KStream input) {
 
 			return input
-					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.flatMapValues(
+							value -> Arrays.asList(value.toLowerCase().split("\\W+")))
 					.map((key, value) -> new KeyValue<>(value, value))
 					.groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
-					.windowedBy(timeWindows)
-					.count(Materialized.as("foo-WordCounts-x"))
-					.toStream()
-					.map((key, value) -> new KeyValue<>(null, "Count for " + key.key() + " : " + value));
+					.windowedBy(timeWindows).count(Materialized.as("foo-WordCounts-x"))
+					.toStream().map((key, value) -> new KeyValue<>(null,
+							"Count for " + key.key() + " : " + value));
 		}
+
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsStateStoreIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsStateStoreIntegrationTests.java
index de08e4195..8d7cb662d 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsStateStoreIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkaStreamsStateStoreIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
 
 package org.springframework.cloud.stream.binder.kafka.streams.integration;
 
-
 import java.util.Map;
 
 import org.apache.kafka.streams.kstream.KStream;
@@ -50,9 +49,11 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class KafkaStreamsStateStoreIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts-id");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts-id");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	@Test
 	public void testKstreamStateStore() throws Exception {
@@ -62,31 +63,41 @@ public class KafkaStreamsStateStoreIntegrationTests {
 				"--spring.jmx.enabled=false",
 				"--spring.cloud.stream.bindings.input.destination=foobar",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=KafkaStreamsStateStoreIntegrationTests-abc",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+						+ "=KafkaStreamsStateStoreIntegrationTests-abc",
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString());
 		try {
 			Thread.sleep(2000);
 			receiveAndValidateFoo(context);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw e;
-		} finally {
+		}
+		finally {
 			context.close();
 		}
 	}
 
-	private void receiveAndValidateFoo(ConfigurableApplicationContext context) throws Exception {
+	private void receiveAndValidateFoo(ConfigurableApplicationContext context)
+			throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		KafkaTemplate template = new KafkaTemplate<>(pf, true);
 		template.setDefaultTopic("foobar");
 		template.sendDefault("{\"id\":\"123\"}");
 		Thread.sleep(1000);
 
-		//assertions
-		ProductCountApplication productCount = context.getBean(ProductCountApplication.class);
+		// assertions
+		ProductCountApplication productCount = context
+				.getBean(ProductCountApplication.class);
 		WindowStore state = productCount.state;
 		assertThat(state != null).isTrue();
 		assertThat(state.name()).isEqualTo("mystate");
@@ -99,34 +110,35 @@ public class KafkaStreamsStateStoreIntegrationTests {
 	public static class ProductCountApplication {
 
 		WindowStore state;
+
 		boolean processed;
 
 		@StreamListener("input")
 		@KafkaStreamsStateStore(name = "mystate", type = KafkaStreamsStateStoreProperties.StoreType.WINDOW, lengthMs = 300000)
-		@SuppressWarnings({"deprecation", "unchecked"})
+		@SuppressWarnings({ "deprecation", "unchecked" })
 		public void process(KStream input) {
 
-			input
-				.process(() -> new Processor() {
+			input.process(() -> new Processor() {
 
-					@Override
-					public void init(ProcessorContext processorContext) {
-						state = (WindowStore) processorContext.getStateStore("mystate");
-					}
+				@Override
+				public void init(ProcessorContext processorContext) {
+					state = (WindowStore) processorContext.getStateStore("mystate");
+				}
 
-					@Override
-					public void process(Object s, Product product) {
-						processed = true;
-					}
+				@Override
+				public void process(Object s, Product product) {
+					processed = true;
+				}
 
-					@Override
-					public void close() {
-						if (state != null) {
-							state.close();
-						}
+				@Override
+				public void close() {
+					if (state != null) {
+						state.close();
 					}
-				}, "mystate");
+				}
+			}, "mystate");
 		}
+
 	}
 
 	public static class Product {
@@ -140,11 +152,14 @@ public class KafkaStreamsStateStoreIntegrationTests {
 		public void setId(Integer id) {
 			this.id = id;
 		}
+
 	}
 
 	interface KafkaStreamsProcessorX {
 
 		@Input("input")
 		KStream input();
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkastreamsBinderPojoInputStringOutputIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkastreamsBinderPojoInputStringOutputIntegrationTests.java
index 960b45711..f57ac5de0 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkastreamsBinderPojoInputStringOutputIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/KafkastreamsBinderPojoInputStringOutputIntegrationTests.java
@@ -60,17 +60,21 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class KafkastreamsBinderPojoInputStringOutputIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts-id");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts-id");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("group-id", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group-id",
+				"false", embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "counts-id");
 	}
@@ -89,19 +93,24 @@ public class KafkastreamsBinderPojoInputStringOutputIntegrationTests {
 				"--spring.cloud.stream.bindings.input.destination=foos",
 				"--spring.cloud.stream.bindings.output.destination=counts-id",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$IntegerSerde",
 				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=ProductCountApplication-xyz",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString());
 		try {
 			receiveAndValidateFoo(context);
-			//Assertions on StreamBuilderFactoryBean
-			StreamsBuilderFactoryBean streamsBuilderFactoryBean = context.getBean("&stream-builder-process",
-					StreamsBuilderFactoryBean.class);
-			CleanupConfig cleanup = TestUtils.getPropertyValue(streamsBuilderFactoryBean, "cleanupConfig",
-					CleanupConfig.class);
+			// Assertions on StreamBuilderFactoryBean
+			StreamsBuilderFactoryBean streamsBuilderFactoryBean = context
+					.getBean("&stream-builder-process", StreamsBuilderFactoryBean.class);
+			CleanupConfig cleanup = TestUtils.getPropertyValue(streamsBuilderFactoryBean,
+					"cleanupConfig", CleanupConfig.class);
 			assertThat(cleanup.cleanupOnStart()).isFalse();
 			assertThat(cleanup.cleanupOnStop()).isTrue();
 		}
@@ -110,13 +119,16 @@ public class KafkastreamsBinderPojoInputStringOutputIntegrationTests {
 		}
 	}
 
-	private void receiveAndValidateFoo(ConfigurableApplicationContext context) throws Exception {
+	private void receiveAndValidateFoo(ConfigurableApplicationContext context)
+			throws Exception {
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		KafkaTemplate template = new KafkaTemplate<>(pf, true);
 		template.setDefaultTopic("foos");
 		template.sendDefault("{\"id\":\"123\"}");
-		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts-id");
+		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+				"counts-id");
 		assertThat(cr.value().contains("Count for product with ID 123: 1")).isTrue();
 	}
 
@@ -128,15 +140,16 @@ public class KafkastreamsBinderPojoInputStringOutputIntegrationTests {
 		@SendTo("output")
 		public KStream process(KStream input) {
 
-			return input
-					.filter((key, product) -> product.getId() == 123)
+			return input.filter((key, product) -> product.getId() == 123)
 					.map((key, value) -> new KeyValue<>(value, value))
-					.groupByKey(Serialized.with(new JsonSerde<>(Product.class), new JsonSerde<>(Product.class)))
+					.groupByKey(Serialized.with(new JsonSerde<>(Product.class),
+							new JsonSerde<>(Product.class)))
 					.windowedBy(TimeWindows.of(5000))
-					.count(Materialized.as("id-count-store"))
-					.toStream()
-					.map((key, value) -> new KeyValue<>(key.key().id, "Count for product with ID 123: " + value));
+					.count(Materialized.as("id-count-store")).toStream()
+					.map((key, value) -> new KeyValue<>(key.key().id,
+							"Count for product with ID 123: " + value));
 		}
+
 	}
 
 	static class Product {
@@ -150,5 +163,7 @@ public class KafkastreamsBinderPojoInputStringOutputIntegrationTests {
 		public void setId(Integer id) {
 			this.id = id;
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/PerRecordAvroContentTypeTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/PerRecordAvroContentTypeTests.java
index cbf629f86..5be5ee210 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/PerRecordAvroContentTypeTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/PerRecordAvroContentTypeTests.java
@@ -66,21 +66,26 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class PerRecordAvroContentTypeTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "received-sensors");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"received-sensors");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("avro-ct-test", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("avro-ct-test",
+				"false", embeddedKafka);
 
-		//Receive the data as byte[]
-		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
+		// Receive the data as byte[]
+		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
 
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "received-sensors");
 	}
@@ -102,12 +107,15 @@ public class PerRecordAvroContentTypeTests {
 				"--spring.cloud.stream.bindings.output.contentType=application/avro",
 				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id=per-record-avro-contentType-test",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString())) {
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString())) {
 
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			//Use a custom avro test serializer
-			senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, TestAvroSerializer.class);
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			// Use a custom avro test serializer
+			senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					TestAvroSerializer.class);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			try {
 				KafkaTemplate template = new KafkaTemplate<>(pf, true);
 
@@ -117,26 +125,32 @@ public class PerRecordAvroContentTypeTests {
 				sensor.setAcceleration(random.nextFloat() * 10);
 				sensor.setVelocity(random.nextFloat() * 100);
 				sensor.setTemperature(random.nextFloat() * 50);
-				//Send with avro content type set.
+				// Send with avro content type set.
 				Message message = MessageBuilder.withPayload(sensor)
-						.setHeader("contentType", "application/avro")
-						.build();
+						.setHeader("contentType", "application/avro").build();
 				template.setDefaultTopic("sensors");
 				template.send(message);
 
-				//Serialized byte[] ^^ is received by the binding process and deserialzed it using avro converter.
-				//Then finally, the data will be output to a return topic as byte[] (using the same avro converter).
+				// Serialized byte[] ^^ is received by the binding process and deserialzed
+				// it using avro converter.
+				// Then finally, the data will be output to a return topic as byte[]
+				// (using the same avro converter).
 
-				//Receive the byte[] from return topic
-				ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "received-sensors");
+				// Receive the byte[] from return topic
+				ConsumerRecord cr = KafkaTestUtils
+						.getSingleRecord(consumer, "received-sensors");
 				final byte[] value = cr.value();
 
-				//Convert the byte[] received back to avro object and verify that it is the same as the one we sent ^^.
+				// Convert the byte[] received back to avro object and verify that it is
+				// the same as the one we sent ^^.
 				AvroSchemaMessageConverter avroSchemaMessageConverter = new AvroSchemaMessageConverter();
 
 				Message receivedMessage = MessageBuilder.withPayload(value)
-						.setHeader("contentType", MimeTypeUtils.parseMimeType("application/avro")).build();
-				Sensor messageConverted = (Sensor)avroSchemaMessageConverter.fromMessage(receivedMessage, Sensor.class);
+						.setHeader("contentType",
+								MimeTypeUtils.parseMimeType("application/avro"))
+						.build();
+				Sensor messageConverted = (Sensor) avroSchemaMessageConverter
+						.fromMessage(receivedMessage, Sensor.class);
 				assertThat(messageConverted).isEqualTo(sensor);
 			}
 			finally {
@@ -152,7 +166,8 @@ public class PerRecordAvroContentTypeTests {
 		@StreamListener
 		@SendTo("output")
 		public KStream process(@Input("input") KStream input) {
-			//return the same Sensor object unchanged so that we can do test verifications
+			// return the same Sensor object unchanged so that we can do test
+			// verifications
 			return input.map(KeyValue::new);
 		}
 
@@ -161,5 +176,7 @@ public class PerRecordAvroContentTypeTests {
 		public MessageConverter sensorMessageConverter() throws IOException {
 			return new AvroSchemaMessageConverter();
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToGlobalKTableJoinIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToGlobalKTableJoinIntegrationTests.java
index 91aa4605c..2bd8a7adb 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToGlobalKTableJoinIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToGlobalKTableJoinIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,52 +62,18 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class StreamToGlobalKTableJoinIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "enriched-order");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"enriched-order");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
-	interface CustomGlobalKTableProcessor extends KafkaStreamsProcessor {
-
-		@Input("input-x")
-		GlobalKTable inputX();
-
-		@Input("input-y")
-		GlobalKTable inputY();
-	}
-
-	@EnableBinding(CustomGlobalKTableProcessor.class)
-	@EnableAutoConfiguration
-	@EnableConfigurationProperties(KafkaStreamsApplicationSupportProperties.class)
-	public static class OrderEnricherApplication {
-
-		@StreamListener
-		@SendTo("output")
-		public KStream process(@Input("input") KStream ordersStream,
-													@Input("input-x") GlobalKTable customers,
-													@Input("input-y") GlobalKTable products) {
-
-			KStream customerOrdersStream = ordersStream.join(customers,
-					(orderId, order) -> order.getCustomerId(),
-					(order, customer) -> new CustomerOrder(customer, order));
-
-			return customerOrdersStream.join(products,
-					(orderId, customerOrder) -> customerOrder
-							.productId(),
-					(customerOrder, product) -> {
-						EnrichedOrder enrichedOrder = new EnrichedOrder();
-						enrichedOrder.setProduct(product);
-						enrichedOrder.setCustomer(customerOrder.customer);
-						enrichedOrder.setOrder(customerOrder.order);
-						return enrichedOrder;
-					});
-		}
-	}
-
 	@Test
 	public void testStreamToGlobalKTable() throws Exception {
-		SpringApplication app = new SpringApplication(StreamToGlobalKTableJoinIntegrationTests.OrderEnricherApplication.class);
+		SpringApplication app = new SpringApplication(
+				StreamToGlobalKTableJoinIntegrationTests.OrderEnricherApplication.class);
 		app.setWebApplicationType(WebApplicationType.NONE);
 		try (ConfigurableApplicationContext ignored = app.run("--server.port=0",
 				"--spring.jmx.enabled=false",
@@ -119,27 +85,49 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 				"--spring.cloud.stream.bindings.input-x.consumer.useNativeDecoding=true",
 				"--spring.cloud.stream.bindings.input-y.consumer.useNativeDecoding=true",
 				"--spring.cloud.stream.bindings.output.producer.useNativeEncoding=true",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.valueSerde=org.springframework.cloud.stream.binder.kafka.streams.integration.StreamToGlobalKTableJoinIntegrationTests$OrderSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input-x.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input-x.consumer.valueSerde=org.springframework.cloud.stream.binder.kafka.streams.integration.StreamToGlobalKTableJoinIntegrationTests$CustomerSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input-y.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input-y.consumer.valueSerde=org.springframework.cloud.stream.binder.kafka.streams.integration.StreamToGlobalKTableJoinIntegrationTests$ProductSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.valueSerde=org.springframework.cloud.stream.binder.kafka.streams.integration.StreamToGlobalKTableJoinIntegrationTests$EnrichedOrderSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.valueSerde"
+						+ "=org.springframework.cloud.stream.binder.kafka.streams.integration"
+						+ ".StreamToGlobalKTableJoinIntegrationTests$OrderSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input-x.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input-x.consumer.valueSerde"
+						+ "=org.springframework.cloud.stream.binder.kafka.streams.integration."
+						+ "StreamToGlobalKTableJoinIntegrationTests$CustomerSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input-y.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input-y.consumer.valueSerde"
+						+ "=org.springframework.cloud.stream.binder.kafka.streams."
+						+ "integration.StreamToGlobalKTableJoinIntegrationTests$ProductSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.valueSerde"
+						+ "=org.springframework.cloud.stream.binder.kafka.streams.integration"
+						+ ".StreamToGlobalKTableJoinIntegrationTests$EnrichedOrderSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=10000",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=StreamToGlobalKTableJoinIntegrationTests-abc",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString())) {
-			Map senderPropsCustomer = KafkaTestUtils.producerProps(embeddedKafka);
-			senderPropsCustomer.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, LongSerializer.class);
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+						+ "=StreamToGlobalKTableJoinIntegrationTests-abc",
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString())) {
+			Map senderPropsCustomer = KafkaTestUtils
+					.producerProps(embeddedKafka);
+			senderPropsCustomer.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+					LongSerializer.class);
 			CustomerSerde customerSerde = new CustomerSerde();
-			senderPropsCustomer.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, customerSerde.serializer().getClass());
+			senderPropsCustomer.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					customerSerde.serializer().getClass());
 
-			DefaultKafkaProducerFactory pfCustomer = new DefaultKafkaProducerFactory<>(senderPropsCustomer);
-			KafkaTemplate template = new KafkaTemplate<>(pfCustomer, true);
+			DefaultKafkaProducerFactory pfCustomer = new DefaultKafkaProducerFactory<>(
+					senderPropsCustomer);
+			KafkaTemplate template = new KafkaTemplate<>(pfCustomer,
+					true);
 			template.setDefaultTopic("customers");
 			for (long i = 0; i < 5; i++) {
 				final Customer customer = new Customer();
@@ -147,13 +135,18 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 				template.sendDefault(i, customer);
 			}
 
-			Map senderPropsProduct = KafkaTestUtils.producerProps(embeddedKafka);
-			senderPropsProduct.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, LongSerializer.class);
+			Map senderPropsProduct = KafkaTestUtils
+					.producerProps(embeddedKafka);
+			senderPropsProduct.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+					LongSerializer.class);
 			ProductSerde productSerde = new ProductSerde();
-			senderPropsProduct.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, productSerde.serializer().getClass());
+			senderPropsProduct.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					productSerde.serializer().getClass());
 
-			DefaultKafkaProducerFactory pfProduct = new DefaultKafkaProducerFactory<>(senderPropsProduct);
-			KafkaTemplate productTemplate = new KafkaTemplate<>(pfProduct, true);
+			DefaultKafkaProducerFactory pfProduct = new DefaultKafkaProducerFactory<>(
+					senderPropsProduct);
+			KafkaTemplate productTemplate = new KafkaTemplate<>(pfProduct,
+					true);
 			productTemplate.setDefaultTopic("products");
 
 			for (long i = 0; i < 5; i++) {
@@ -162,12 +155,16 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 				productTemplate.sendDefault(i, product);
 			}
 
-			Map senderPropsOrder = KafkaTestUtils.producerProps(embeddedKafka);
-			senderPropsOrder.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, LongSerializer.class);
+			Map senderPropsOrder = KafkaTestUtils
+					.producerProps(embeddedKafka);
+			senderPropsOrder.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+					LongSerializer.class);
 			OrderSerde orderSerde = new OrderSerde();
-			senderPropsOrder.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, orderSerde.serializer().getClass());
+			senderPropsOrder.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					orderSerde.serializer().getClass());
 
-			DefaultKafkaProducerFactory pfOrder = new DefaultKafkaProducerFactory<>(senderPropsOrder);
+			DefaultKafkaProducerFactory pfOrder = new DefaultKafkaProducerFactory<>(
+					senderPropsOrder);
 			KafkaTemplate orderTemplate = new KafkaTemplate<>(pfOrder, true);
 			orderTemplate.setDefaultTopic("orders");
 
@@ -178,13 +175,19 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 				orderTemplate.sendDefault(i, order);
 			}
 
-			Map consumerProps = KafkaTestUtils.consumerProps("group", "false", embeddedKafka);
+			Map consumerProps = KafkaTestUtils.consumerProps("group",
+					"false", embeddedKafka);
 			consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-			consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class);
+			consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+					LongDeserializer.class);
 			EnrichedOrderSerde enrichedOrderSerde = new EnrichedOrderSerde();
-			consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, enrichedOrderSerde.deserializer().getClass());
-			consumerProps.put(JsonDeserializer.VALUE_DEFAULT_TYPE, "org.springframework.cloud.stream.binder.kafka.streams.integration.StreamToGlobalKTableJoinIntegrationTests.EnrichedOrder");
-			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+			consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+					enrichedOrderSerde.deserializer().getClass());
+			consumerProps.put(JsonDeserializer.VALUE_DEFAULT_TYPE,
+					"org.springframework.cloud.stream.binder.kafka.streams.integration."
+							+ "StreamToGlobalKTableJoinIntegrationTests.EnrichedOrder");
+			DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+					consumerProps);
 
 			consumer = cf.createConsumer();
 			embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "enriched-order");
@@ -193,12 +196,14 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 			long start = System.currentTimeMillis();
 			List> enrichedOrders = new ArrayList<>();
 			do {
-				ConsumerRecords records = KafkaTestUtils.getRecords(consumer);
+				ConsumerRecords records = KafkaTestUtils
+						.getRecords(consumer);
 				count = count + records.count();
 				for (ConsumerRecord record : records) {
 					enrichedOrders.add(new KeyValue<>(record.key(), record.value()));
 				}
-			} while (count < 5 && (System.currentTimeMillis() - start) < 30000);
+			}
+			while (count < 5 && (System.currentTimeMillis() - start) < 30000);
 
 			assertThat(count == 5).isTrue();
 			assertThat(enrichedOrders.size() == 5).isTrue();
@@ -206,13 +211,16 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 			enrichedOrders.sort(Comparator.comparing(o -> o.key));
 
 			for (int i = 0; i < 5; i++) {
-				KeyValue enrichedOrderKeyValue = enrichedOrders.get(i);
+				KeyValue enrichedOrderKeyValue = enrichedOrders
+						.get(i);
 				assertThat(enrichedOrderKeyValue.key == i).isTrue();
 				EnrichedOrder enrichedOrder = enrichedOrderKeyValue.value;
 				assertThat(enrichedOrder.getOrder().customerId == i).isTrue();
 				assertThat(enrichedOrder.getOrder().productId == i).isTrue();
-				assertThat(enrichedOrder.getCustomer().name.equals("customer-" + i)).isTrue();
-				assertThat(enrichedOrder.getProduct().name.equals("product-" + i)).isTrue();
+				assertThat(enrichedOrder.getCustomer().name.equals("customer-" + i))
+						.isTrue();
+				assertThat(enrichedOrder.getProduct().name.equals("product-" + i))
+						.isTrue();
 			}
 			pfCustomer.destroy();
 			pfProduct.destroy();
@@ -222,9 +230,49 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 
 	}
 
+	interface CustomGlobalKTableProcessor extends KafkaStreamsProcessor {
+
+		@Input("input-x")
+		GlobalKTable inputX();
+
+		@Input("input-y")
+		GlobalKTable inputY();
+
+	}
+
+	@EnableBinding(CustomGlobalKTableProcessor.class)
+	@EnableAutoConfiguration
+	@EnableConfigurationProperties(KafkaStreamsApplicationSupportProperties.class)
+	public static class OrderEnricherApplication {
+
+		@StreamListener
+		@SendTo("output")
+		public KStream process(
+				@Input("input") KStream ordersStream,
+				@Input("input-x") GlobalKTable customers,
+				@Input("input-y") GlobalKTable products) {
+
+			KStream customerOrdersStream = ordersStream.join(
+					customers, (orderId, order) -> order.getCustomerId(),
+					(order, customer) -> new CustomerOrder(customer, order));
+
+			return customerOrdersStream.join(products,
+					(orderId, customerOrder) -> customerOrder.productId(),
+					(customerOrder, product) -> {
+						EnrichedOrder enrichedOrder = new EnrichedOrder();
+						enrichedOrder.setProduct(product);
+						enrichedOrder.setCustomer(customerOrder.customer);
+						enrichedOrder.setOrder(customerOrder.order);
+						return enrichedOrder;
+					});
+		}
+
+	}
+
 	static class Order {
 
 		long customerId;
+
 		long productId;
 
 		public long getCustomerId() {
@@ -242,6 +290,7 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 		public void setProductId(long productId) {
 			this.productId = productId;
 		}
+
 	}
 
 	static class Customer {
@@ -255,6 +304,7 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 		public void setName(String name) {
 			this.name = name;
 		}
+
 	}
 
 	static class Product {
@@ -268,12 +318,15 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 		public void setName(String name) {
 			this.name = name;
 		}
+
 	}
 
 	static class EnrichedOrder {
 
 		Product product;
+
 		Customer customer;
+
 		Order order;
 
 		public Product getProduct() {
@@ -299,10 +352,13 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 		public void setOrder(Order order) {
 			this.order = order;
 		}
+
 	}
 
 	private static class CustomerOrder {
+
 		private final Customer customer;
+
 		private final Order order;
 
 		CustomerOrder(final Customer customer, final Order order) {
@@ -313,10 +369,23 @@ public class StreamToGlobalKTableJoinIntegrationTests {
 		long productId() {
 			return order.getProductId();
 		}
+
+	}
+
+	public static class OrderSerde extends JsonSerde {
+
+	}
+
+	public static class CustomerSerde extends JsonSerde {
+
+	}
+
+	public static class ProductSerde extends JsonSerde {
+
+	}
+
+	public static class EnrichedOrderSerde extends JsonSerde {
+
 	}
 
-	public static class OrderSerde extends JsonSerde {}
-	public static class CustomerSerde extends JsonSerde {}
-	public static class ProductSerde extends JsonSerde {}
-	public static class EnrichedOrderSerde extends JsonSerde {}
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToTableJoinIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToTableJoinIntegrationTests.java
index b594b31c6..05b44bee9 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToTableJoinIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/StreamToTableJoinIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -65,47 +65,28 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class StreamToTableJoinIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "output-topic-1", "output-topic-2");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"output-topic-1", "output-topic-2");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
-
-	@EnableBinding(KafkaStreamsProcessorX.class)
-	@EnableAutoConfiguration
-	@EnableConfigurationProperties(KafkaStreamsApplicationSupportProperties.class)
-	public static class CountClicksPerRegionApplication {
-
-		@StreamListener
-		@SendTo("output")
-		public KStream process(@Input("input") KStream userClicksStream,
-											@Input("input-x") KTable userRegionsTable) {
-
-			return userClicksStream
-					.leftJoin(userRegionsTable, (clicks, region) -> new RegionWithClicks(region == null ? "UNKNOWN" : region, clicks),
-							Joined.with(Serdes.String(), Serdes.Long(), null))
-					.map((user, regionWithClicks) -> new KeyValue<>(regionWithClicks.getRegion(), regionWithClicks.getClicks()))
-					.groupByKey(Serialized.with(Serdes.String(), Serdes.Long()))
-					.reduce((firstClicks, secondClicks) -> firstClicks + secondClicks)
-					.toStream();
-		}
-	}
-
-	interface KafkaStreamsProcessorX extends KafkaStreamsProcessor {
-
-		@Input("input-x")
-		KTable inputX();
-	}
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	@Test
 	public void testStreamToTable() throws Exception {
-		SpringApplication app = new SpringApplication(CountClicksPerRegionApplication.class);
+		SpringApplication app = new SpringApplication(
+				CountClicksPerRegionApplication.class);
 		app.setWebApplicationType(WebApplicationType.NONE);
 
 		Consumer consumer;
-		Map consumerProps = KafkaTestUtils.consumerProps("group-1", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group-1",
+				"false", embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
-		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class);
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+				StringDeserializer.class);
+		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+				LongDeserializer.class);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "output-topic-1");
 
@@ -117,35 +98,47 @@ public class StreamToTableJoinIntegrationTests {
 				"--spring.cloud.stream.bindings.input.consumer.useNativeDecoding=true",
 				"--spring.cloud.stream.bindings.input-x.consumer.useNativeDecoding=true",
 				"--spring.cloud.stream.bindings.output.producer.useNativeEncoding=true",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.valueSerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.valueSerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.valueSerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.valueSerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.valueSerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.valueSerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=10000",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=StreamToTableJoinIntegrationTests-abc",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString())) {
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+						+ "=StreamToTableJoinIntegrationTests-abc",
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString())) {
 
 			// Input 1: Region per user (multiple records allowed per user).
-			List> userRegions = Arrays.asList(
-					new KeyValue<>("alice", "asia"),   /* Alice lived in Asia originally... */
-					new KeyValue<>("bob", "americas"),
-					new KeyValue<>("chao", "asia"),
-					new KeyValue<>("dave", "europe"),
-					new KeyValue<>("alice", "europe"), /* ...but moved to Europe some time later. */
-					new KeyValue<>("eve", "americas"),
-					new KeyValue<>("fang", "asia")
-			);
+			List> userRegions = Arrays.asList(new KeyValue<>(
+					"alice", "asia"), /* Alice lived in Asia originally... */
+					new KeyValue<>("bob", "americas"), new KeyValue<>("chao", "asia"),
+					new KeyValue<>("dave", "europe"), new KeyValue<>("alice",
+							"europe"), /* ...but moved to Europe some time later. */
+					new KeyValue<>("eve", "americas"), new KeyValue<>("fang", "asia"));
 
-			Map senderProps1 = KafkaTestUtils.producerProps(embeddedKafka);
-			senderProps1.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
-			senderProps1.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+			Map senderProps1 = KafkaTestUtils
+					.producerProps(embeddedKafka);
+			senderProps1.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+					StringSerializer.class);
+			senderProps1.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					StringSerializer.class);
 
-			DefaultKafkaProducerFactory pf1 = new DefaultKafkaProducerFactory<>(senderProps1);
+			DefaultKafkaProducerFactory pf1 = new DefaultKafkaProducerFactory<>(
+					senderProps1);
 			KafkaTemplate template1 = new KafkaTemplate<>(pf1, true);
 			template1.setDefaultTopic("user-regions-1");
 
@@ -155,21 +148,19 @@ public class StreamToTableJoinIntegrationTests {
 
 			// Input 2: Clicks per user (multiple records allowed per user).
 			List> userClicks = Arrays.asList(
-					new KeyValue<>("alice", 13L),
-					new KeyValue<>("bob", 4L),
-					new KeyValue<>("chao", 25L),
-					new KeyValue<>("bob", 19L),
-					new KeyValue<>("dave", 56L),
-					new KeyValue<>("eve", 78L),
-					new KeyValue<>("alice", 40L),
-					new KeyValue<>("fang", 99L)
-			);
+					new KeyValue<>("alice", 13L), new KeyValue<>("bob", 4L),
+					new KeyValue<>("chao", 25L), new KeyValue<>("bob", 19L),
+					new KeyValue<>("dave", 56L), new KeyValue<>("eve", 78L),
+					new KeyValue<>("alice", 40L), new KeyValue<>("fang", 99L));
 
 			Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-			senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
-			senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, LongSerializer.class);
+			senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+					StringSerializer.class);
+			senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					LongSerializer.class);
 
-			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+					senderProps);
 			KafkaTemplate template = new KafkaTemplate<>(pf, true);
 			template.setDefaultTopic("user-clicks-1");
 
@@ -178,22 +169,24 @@ public class StreamToTableJoinIntegrationTests {
 			}
 
 			List> expectedClicksPerRegion = Arrays.asList(
-					new KeyValue<>("americas", 101L),
-					new KeyValue<>("europe", 109L),
-					new KeyValue<>("asia", 124L)
-			);
+					new KeyValue<>("americas", 101L), new KeyValue<>("europe", 109L),
+					new KeyValue<>("asia", 124L));
 
-			//Verify that we receive the expected data
+			// Verify that we receive the expected data
 			int count = 0;
 			long start = System.currentTimeMillis();
 			List> actualClicksPerRegion = new ArrayList<>();
 			do {
-				ConsumerRecords records = KafkaTestUtils.getRecords(consumer);
+				ConsumerRecords records = KafkaTestUtils
+						.getRecords(consumer);
 				count = count + records.count();
 				for (ConsumerRecord record : records) {
-					actualClicksPerRegion.add(new KeyValue<>(record.key(), record.value()));
+					actualClicksPerRegion
+							.add(new KeyValue<>(record.key(), record.value()));
 				}
-			} while (count < expectedClicksPerRegion.size() && (System.currentTimeMillis() - start) < 30000);
+			}
+			while (count < expectedClicksPerRegion.size()
+					&& (System.currentTimeMillis() - start) < 30000);
 
 			assertThat(count == expectedClicksPerRegion.size()).isTrue();
 			assertThat(actualClicksPerRegion).hasSameElementsAs(expectedClicksPerRegion);
@@ -204,16 +197,22 @@ public class StreamToTableJoinIntegrationTests {
 	}
 
 	@Test
-	public void testGlobalStartOffsetWithLatestAndIndividualBindingWthEarliest() throws Exception {
-		SpringApplication app = new SpringApplication(CountClicksPerRegionApplication.class);
+	public void testGlobalStartOffsetWithLatestAndIndividualBindingWthEarliest()
+			throws Exception {
+		SpringApplication app = new SpringApplication(
+				CountClicksPerRegionApplication.class);
 		app.setWebApplicationType(WebApplicationType.NONE);
 
 		Consumer consumer;
-		Map consumerProps = KafkaTestUtils.consumerProps("group-2", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("group-2",
+				"false", embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
-		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class);
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+				StringDeserializer.class);
+		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+				LongDeserializer.class);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromAnEmbeddedTopic(consumer, "output-topic-2");
 
@@ -221,30 +220,27 @@ public class StreamToTableJoinIntegrationTests {
 		// binding (which is set to earliest below).
 		// Input 1: Clicks per user (multiple records allowed per user).
 		List> userClicks = Arrays.asList(
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L),
-				new KeyValue<>("alice", 100L)
-		);
+				new KeyValue<>("alice", 100L), new KeyValue<>("alice", 100L),
+				new KeyValue<>("alice", 100L), new KeyValue<>("alice", 100L),
+				new KeyValue<>("alice", 100L), new KeyValue<>("alice", 100L),
+				new KeyValue<>("alice", 100L), new KeyValue<>("alice", 100L),
+				new KeyValue<>("alice", 100L), new KeyValue<>("alice", 100L));
 
 		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
-		senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, LongSerializer.class);
+		senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+				StringSerializer.class);
+		senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+				LongSerializer.class);
 
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
 		KafkaTemplate template = new KafkaTemplate<>(pf, true);
 		template.setDefaultTopic("user-clicks-2");
 
 		for (KeyValue keyValue : userClicks) {
 			template.sendDefault(keyValue.key, keyValue.value);
 		}
-		//Thread.sleep(10000L);
+		// Thread.sleep(10000L);
 		try (ConfigurableApplicationContext ignored = app.run("--server.port=0",
 				"--spring.jmx.enabled=false",
 				"--spring.cloud.stream.bindings.input.destination=user-clicks-2",
@@ -255,36 +251,47 @@ public class StreamToTableJoinIntegrationTests {
 				"--spring.cloud.stream.bindings.output.producer.useNativeEncoding=true",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.auto.offset.reset=latest",
 				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.startOffset=earliest",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.valueSerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.keySerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.valueSerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.bindings.output.producer.valueSerde=org.apache.kafka.common.serialization.Serdes$LongSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.valueSerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.inputX.consumer.valueSerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.keySerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.bindings.output.producer.valueSerde"
+						+ "=org.apache.kafka.common.serialization.Serdes$LongSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
 				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=10000",
 				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.application-id=helloxyz-foobar",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString())) {
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString())) {
 			Thread.sleep(1000L);
 
 			// Input 2: Region per user (multiple records allowed per user).
-			List> userRegions = Arrays.asList(
-					new KeyValue<>("alice", "asia"),   /* Alice lived in Asia originally... */
-					new KeyValue<>("bob", "americas"),
-					new KeyValue<>("chao", "asia"),
-					new KeyValue<>("dave", "europe"),
-					new KeyValue<>("alice", "europe"), /* ...but moved to Europe some time later. */
-					new KeyValue<>("eve", "americas"),
-					new KeyValue<>("fang", "asia")
-			);
+			List> userRegions = Arrays.asList(new KeyValue<>(
+					"alice", "asia"), /* Alice lived in Asia originally... */
+					new KeyValue<>("bob", "americas"), new KeyValue<>("chao", "asia"),
+					new KeyValue<>("dave", "europe"), new KeyValue<>("alice",
+							"europe"), /* ...but moved to Europe some time later. */
+					new KeyValue<>("eve", "americas"), new KeyValue<>("fang", "asia"));
 
-			Map senderProps1 = KafkaTestUtils.producerProps(embeddedKafka);
-			senderProps1.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
-			senderProps1.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+			Map senderProps1 = KafkaTestUtils
+					.producerProps(embeddedKafka);
+			senderProps1.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
+					StringSerializer.class);
+			senderProps1.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					StringSerializer.class);
 
-			DefaultKafkaProducerFactory pf1 = new DefaultKafkaProducerFactory<>(senderProps1);
+			DefaultKafkaProducerFactory pf1 = new DefaultKafkaProducerFactory<>(
+					senderProps1);
 			KafkaTemplate template1 = new KafkaTemplate<>(pf1, true);
 			template1.setDefaultTopic("user-regions-2");
 
@@ -292,45 +299,41 @@ public class StreamToTableJoinIntegrationTests {
 				template1.sendDefault(keyValue.key, keyValue.value);
 			}
 
-
-
 			// Input 1: Clicks per user (multiple records allowed per user).
 			List> userClicks1 = Arrays.asList(
-					new KeyValue<>("bob", 4L),
-					new KeyValue<>("chao", 25L),
-					new KeyValue<>("bob", 19L),
-					new KeyValue<>("dave", 56L),
-					new KeyValue<>("eve", 78L),
-					new KeyValue<>("fang", 99L)
-			);
+					new KeyValue<>("bob", 4L), new KeyValue<>("chao", 25L),
+					new KeyValue<>("bob", 19L), new KeyValue<>("dave", 56L),
+					new KeyValue<>("eve", 78L), new KeyValue<>("fang", 99L));
 
 			for (KeyValue keyValue : userClicks1) {
 				template.sendDefault(keyValue.key, keyValue.value);
 			}
 
-
-
 			List> expectedClicksPerRegion = Arrays.asList(
-					new KeyValue<>("americas", 101L),
-					new KeyValue<>("europe", 56L),
+					new KeyValue<>("americas", 101L), new KeyValue<>("europe", 56L),
 					new KeyValue<>("asia", 124L),
-					//1000 alice entries which were there in the topic before the consumer started.
-					//Since we set the startOffset to earliest for the topic, it will read them,
-					//but the join fails to associate with a valid region, thus UNKNOWN.
-					new KeyValue<>("UNKNOWN", 1000L)
-			);
+					// 1000 alice entries which were there in the topic before the
+					// consumer started.
+					// Since we set the startOffset to earliest for the topic, it will
+					// read them,
+					// but the join fails to associate with a valid region, thus UNKNOWN.
+					new KeyValue<>("UNKNOWN", 1000L));
 
-			//Verify that we receive the expected data
+			// Verify that we receive the expected data
 			int count = 0;
 			long start = System.currentTimeMillis();
 			List> actualClicksPerRegion = new ArrayList<>();
 			do {
-				ConsumerRecords records = KafkaTestUtils.getRecords(consumer);
+				ConsumerRecords records = KafkaTestUtils
+						.getRecords(consumer);
 				count = count + records.count();
 				for (ConsumerRecord record : records) {
-					actualClicksPerRegion.add(new KeyValue<>(record.key(), record.value()));
+					actualClicksPerRegion
+							.add(new KeyValue<>(record.key(), record.value()));
 				}
-			} while (count < expectedClicksPerRegion.size() && (System.currentTimeMillis() - start) < 30000);
+			}
+			while (count < expectedClicksPerRegion.size()
+					&& (System.currentTimeMillis() - start) < 30000);
 
 			assertThat(count).isEqualTo(expectedClicksPerRegion.size());
 			assertThat(actualClicksPerRegion).hasSameElementsAs(expectedClicksPerRegion);
@@ -340,12 +343,45 @@ public class StreamToTableJoinIntegrationTests {
 		}
 	}
 
+	@EnableBinding(KafkaStreamsProcessorX.class)
+	@EnableAutoConfiguration
+	@EnableConfigurationProperties(KafkaStreamsApplicationSupportProperties.class)
+	public static class CountClicksPerRegionApplication {
+
+		@StreamListener
+		@SendTo("output")
+		public KStream process(
+				@Input("input") KStream userClicksStream,
+				@Input("input-x") KTable userRegionsTable) {
+
+			return userClicksStream
+					.leftJoin(userRegionsTable,
+							(clicks, region) -> new RegionWithClicks(
+									region == null ? "UNKNOWN" : region, clicks),
+							Joined.with(Serdes.String(), Serdes.Long(), null))
+					.map((user, regionWithClicks) -> new KeyValue<>(
+							regionWithClicks.getRegion(), regionWithClicks.getClicks()))
+					.groupByKey(Serialized.with(Serdes.String(), Serdes.Long()))
+					.reduce((firstClicks, secondClicks) -> firstClicks + secondClicks)
+					.toStream();
+		}
+
+	}
+
+	interface KafkaStreamsProcessorX extends KafkaStreamsProcessor {
+
+		@Input("input-x")
+		KTable inputX();
+
+	}
+
 	/**
 	 * Tuple for a region and its associated number of clicks.
 	 */
 	private static final class RegionWithClicks {
 
 		private final String region;
+
 		private final long clicks;
 
 		RegionWithClicks(String region, long clicks) {
@@ -368,4 +404,5 @@ public class StreamToTableJoinIntegrationTests {
 		}
 
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/WordCountMultipleBranchesIntegrationTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/WordCountMultipleBranchesIntegrationTests.java
index e862b2129..54e89d2ad 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/WordCountMultipleBranchesIntegrationTests.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/WordCountMultipleBranchesIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,17 +62,21 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class WordCountMultipleBranchesIntegrationTests {
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true, "counts","foo","bar");
+	public static EmbeddedKafkaRule embeddedKafkaRule = new EmbeddedKafkaRule(1, true,
+			"counts", "foo", "bar");
 
-	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule.getEmbeddedKafka();
+	private static EmbeddedKafkaBroker embeddedKafka = embeddedKafkaRule
+			.getEmbeddedKafka();
 
 	private static Consumer consumer;
 
 	@BeforeClass
 	public static void setUp() throws Exception {
-		Map consumerProps = KafkaTestUtils.consumerProps("groupx", "false", embeddedKafka);
+		Map consumerProps = KafkaTestUtils.consumerProps("groupx",
+				"false", embeddedKafka);
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
+		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(
+				consumerProps);
 		consumer = cf.createConsumer();
 		embeddedKafka.consumeFromEmbeddedTopics(consumer, "counts", "foo", "bar");
 	}
@@ -82,6 +86,66 @@ public class WordCountMultipleBranchesIntegrationTests {
 		consumer.close();
 	}
 
+	@Test
+	public void testKstreamWordCountWithStringInputAndPojoOuput() throws Exception {
+		SpringApplication app = new SpringApplication(
+				WordCountProcessorApplication.class);
+		app.setWebApplicationType(WebApplicationType.NONE);
+
+		ConfigurableApplicationContext context = app.run("--server.port=0",
+				"--spring.jmx.enabled=false",
+				"--spring.cloud.stream.bindings.input.destination=words",
+				"--spring.cloud.stream.bindings.output1.destination=counts",
+				"--spring.cloud.stream.bindings.output1.contentType=application/json",
+				"--spring.cloud.stream.bindings.output2.destination=foo",
+				"--spring.cloud.stream.bindings.output2.contentType=application/json",
+				"--spring.cloud.stream.bindings.output3.destination=bar",
+				"--spring.cloud.stream.bindings.output3.contentType=application/json",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde"
+						+ "=org.apache.kafka.common.serialization.Serdes$StringSerde",
+				"--spring.cloud.stream.kafka.streams.timeWindow.length=5000",
+				"--spring.cloud.stream.kafka.streams.timeWindow.advanceBy=0",
+				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId"
+						+ "=WordCountMultipleBranchesIntegrationTests-abc",
+				"--spring.cloud.stream.kafka.streams.binder.brokers="
+						+ embeddedKafka.getBrokersAsString(),
+				"--spring.cloud.stream.kafka.streams.binder.zkNodes="
+						+ embeddedKafka.getZookeeperConnectionString());
+		try {
+			receiveAndValidate(context);
+		}
+		finally {
+			context.close();
+		}
+	}
+
+	private void receiveAndValidate(ConfigurableApplicationContext context)
+			throws Exception {
+		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
+		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(
+				senderProps);
+		KafkaTemplate template = new KafkaTemplate<>(pf, true);
+		template.setDefaultTopic("words");
+		template.sendDefault("english");
+		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer,
+				"counts");
+		assertThat(cr.value().contains("\"word\":\"english\",\"count\":1")).isTrue();
+
+		template.sendDefault("french");
+		template.sendDefault("french");
+		cr = KafkaTestUtils.getSingleRecord(consumer, "foo");
+		assertThat(cr.value().contains("\"word\":\"french\",\"count\":2")).isTrue();
+
+		template.sendDefault("spanish");
+		template.sendDefault("spanish");
+		template.sendDefault("spanish");
+		cr = KafkaTestUtils.getSingleRecord(consumer, "bar");
+		assertThat(cr.value().contains("\"word\":\"spanish\",\"count\":3")).isTrue();
+	}
+
 	@EnableBinding(KStreamProcessorX.class)
 	@EnableAutoConfiguration
 	@EnableConfigurationProperties(KafkaStreamsApplicationSupportProperties.class)
@@ -91,23 +155,26 @@ public class WordCountMultipleBranchesIntegrationTests {
 		private TimeWindows timeWindows;
 
 		@StreamListener("input")
-		@SendTo({"output1","output2","output3"})
+		@SendTo({ "output1", "output2", "output3" })
 		@SuppressWarnings("unchecked")
 		public KStream[] process(KStream input) {
 
 			Predicate isEnglish = (k, v) -> v.word.equals("english");
-			Predicate isFrench =  (k, v) -> v.word.equals("french");
+			Predicate isFrench = (k, v) -> v.word.equals("french");
 			Predicate isSpanish = (k, v) -> v.word.equals("spanish");
 
 			return input
-					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
-					.groupBy((key, value) -> value)
-					.windowedBy(timeWindows)
-					.count(Materialized.as("WordCounts-multi"))
-					.toStream()
-					.map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end()))))
+					.flatMapValues(
+							value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.groupBy((key, value) -> value).windowedBy(timeWindows)
+					.count(Materialized.as("WordCounts-multi")).toStream()
+					.map((key, value) -> new KeyValue<>(null,
+							new WordCount(key.key(), value,
+									new Date(key.window().start()),
+									new Date(key.window().end()))))
 					.branch(isEnglish, isFrench, isSpanish);
 		}
+
 	}
 
 	interface KStreamProcessorX {
@@ -123,56 +190,7 @@ public class WordCountMultipleBranchesIntegrationTests {
 
 		@Output("output3")
 		KStream output3();
-	}
 
-	@Test
-	public void testKstreamWordCountWithStringInputAndPojoOuput() throws Exception {
-		SpringApplication app = new SpringApplication(WordCountProcessorApplication.class);
-		app.setWebApplicationType(WebApplicationType.NONE);
-
-		ConfigurableApplicationContext context = app.run("--server.port=0",
-				"--spring.jmx.enabled=false",
-				"--spring.cloud.stream.bindings.input.destination=words",
-				"--spring.cloud.stream.bindings.output1.destination=counts",
-				"--spring.cloud.stream.bindings.output1.contentType=application/json",
-				"--spring.cloud.stream.bindings.output2.destination=foo",
-				"--spring.cloud.stream.bindings.output2.contentType=application/json",
-				"--spring.cloud.stream.bindings.output3.destination=bar",
-				"--spring.cloud.stream.bindings.output3.contentType=application/json",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde",
-				"--spring.cloud.stream.kafka.streams.timeWindow.length=5000",
-				"--spring.cloud.stream.kafka.streams.timeWindow.advanceBy=0",
-				"--spring.cloud.stream.kafka.streams.bindings.input.consumer.applicationId=WordCountMultipleBranchesIntegrationTests-abc",
-				"--spring.cloud.stream.kafka.streams.binder.brokers=" + embeddedKafka.getBrokersAsString(),
-				"--spring.cloud.stream.kafka.streams.binder.zkNodes=" + embeddedKafka.getZookeeperConnectionString());
-		try {
-			receiveAndValidate(context);
-		} finally {
-			context.close();
-		}
-	}
-
-	private void receiveAndValidate(ConfigurableApplicationContext context) throws Exception {
-		Map senderProps = KafkaTestUtils.producerProps(embeddedKafka);
-		DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory<>(senderProps);
-		KafkaTemplate template = new KafkaTemplate<>(pf, true);
-		template.setDefaultTopic("words");
-		template.sendDefault("english");
-		ConsumerRecord cr = KafkaTestUtils.getSingleRecord(consumer, "counts");
-		assertThat(cr.value().contains("\"word\":\"english\",\"count\":1")).isTrue();
-
-		template.sendDefault("french");
-		template.sendDefault("french");
-		cr = KafkaTestUtils.getSingleRecord(consumer, "foo");
-		assertThat(cr.value().contains("\"word\":\"french\",\"count\":2")).isTrue();
-
-		template.sendDefault("spanish");
-		template.sendDefault("spanish");
-		template.sendDefault("spanish");
-		cr = KafkaTestUtils.getSingleRecord(consumer, "bar");
-		assertThat(cr.value().contains("\"word\":\"spanish\",\"count\":3")).isTrue();
 	}
 
 	static class WordCount {
@@ -223,6 +241,7 @@ public class WordCountMultipleBranchesIntegrationTests {
 		public void setEnd(Date end) {
 			this.end = end;
 		}
+
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/utils/TestAvroSerializer.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/utils/TestAvroSerializer.java
index 1a22dab6b..5ba7cd751 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/utils/TestAvroSerializer.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/integration/utils/TestAvroSerializer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,13 +29,13 @@ import org.springframework.messaging.support.MessageBuilder;
 /**
  * Custom avro serializer intended to be used for testing only.
  *
- * @author Soby Chacko
- *
  * @param  Target type to serialize
+ * @author Soby Chacko
  */
 public class TestAvroSerializer implements Serializer {
 
-	public TestAvroSerializer() {}
+	public TestAvroSerializer() {
+	}
 
 	@Override
 	public void configure(Map configs, boolean isKey) {
@@ -49,13 +49,14 @@ public class TestAvroSerializer implements Serializer {
 		Map headers = new HashMap<>(message.getHeaders());
 		headers.put(MessageHeaders.CONTENT_TYPE, "application/avro");
 		MessageHeaders messageHeaders = new MessageHeaders(headers);
-		final Object payload = avroSchemaMessageConverter.toMessage(message.getPayload(),
-				messageHeaders).getPayload();
-		return (byte[])payload;
+		final Object payload = avroSchemaMessageConverter
+				.toMessage(message.getPayload(), messageHeaders).getPayload();
+		return (byte[]) payload;
 	}
 
 	@Override
 	public void close() {
 
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerdeTest.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerdeTest.java
index 42573fd79..29e0a83e7 100644
--- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerdeTest.java
+++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/serde/CompositeNonNativeSerdeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class CompositeNonNativeSerdeTest {
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testCompositeNonNativeSerdeUsingAvroContentType(){
+	public void testCompositeNonNativeSerdeUsingAvroContentType() {
 		Random random = new Random();
 		Sensor sensor = new Sensor();
 		sensor.setId(UUID.randomUUID().toString() + "-v1");
@@ -52,18 +52,22 @@ public class CompositeNonNativeSerdeTest {
 
 		List messageConverters = new ArrayList<>();
 		messageConverters.add(new AvroSchemaMessageConverter());
-		CompositeMessageConverterFactory compositeMessageConverterFactory =
-				new CompositeMessageConverterFactory(messageConverters, new ObjectMapper());
-		CompositeNonNativeSerde compositeNonNativeSerde = new CompositeNonNativeSerde(compositeMessageConverterFactory);
+		CompositeMessageConverterFactory compositeMessageConverterFactory = new CompositeMessageConverterFactory(
+				messageConverters, new ObjectMapper());
+		CompositeNonNativeSerde compositeNonNativeSerde = new CompositeNonNativeSerde(
+				compositeMessageConverterFactory);
 
 		Map configs = new HashMap<>();
 		configs.put("valueClass", Sensor.class);
 		configs.put("contentType", "application/avro");
 		compositeNonNativeSerde.configure(configs, false);
-		final byte[] serialized = compositeNonNativeSerde.serializer().serialize(null, sensor);
+		final byte[] serialized = compositeNonNativeSerde.serializer().serialize(null,
+				sensor);
 
-		final Object deserialized = compositeNonNativeSerde.deserializer().deserialize(null, serialized);
+		final Object deserialized = compositeNonNativeSerde.deserializer()
+				.deserialize(null, serialized);
 
 		assertThat(deserialized).isEqualTo(sensor);
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/BinderHeaderMapper.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/BinderHeaderMapper.java
index ec5720435..0cc2e83b6 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/BinderHeaderMapper.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/BinderHeaderMapper.java
@@ -45,33 +45,24 @@ import org.springframework.util.ClassUtils;
 import org.springframework.util.MimeType;
 
 /**
- * Default header mapper for Apache Kafka.
- * Most headers in {@link KafkaHeaders} are not mapped on outbound messages.
- * The exceptions are correlation and reply headers for request/reply
- * messaging.
- * Header types are added to a special header {@link #JSON_TYPES}.
+ * Default header mapper for Apache Kafka. Most headers in {@link KafkaHeaders} are not
+ * mapped on outbound messages. The exceptions are correlation and reply headers for
+ * request/reply messaging. Header types are added to a special header
+ * {@link #JSON_TYPES}.
  *
  * @author Gary Russell
  * @author Artem Bilan
- *
  * @since 2.0
- * @deprecated will be removed in the next point release after 2.1.0.
- * See issue https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/509
+ * @deprecated will be removed in the next point release after 2.1.0. See issue
+ * https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/509
  */
 public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 
-	private static final List DEFAULT_TRUSTED_PACKAGES =
-			Arrays.asList(
-					"java.util",
-					"java.lang",
-					"org.springframework.util"
-			);
+	private static final List DEFAULT_TRUSTED_PACKAGES = Arrays
+			.asList("java.util", "java.lang", "org.springframework.util");
 
-	private static final List DEFAULT_TO_STRING_CLASSES =
-			Arrays.asList(
-					"org.springframework.util.MimeType",
-					"org.springframework.http.MediaType"
-			);
+	private static final List DEFAULT_TO_STRING_CLASSES = Arrays.asList(
+			"org.springframework.util.MimeType", "org.springframework.http.MediaType");
 
 	/**
 	 * Header name for java types of other headers.
@@ -80,9 +71,11 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 
 	private final ObjectMapper objectMapper;
 
-	private final Set trustedPackages = new LinkedHashSet<>(DEFAULT_TRUSTED_PACKAGES);
+	private final Set trustedPackages = new LinkedHashSet<>(
+			DEFAULT_TRUSTED_PACKAGES);
 
-	private final Set toStringClasses = new LinkedHashSet<>(DEFAULT_TO_STRING_CLASSES);
+	private final Set toStringClasses = new LinkedHashSet<>(
+			DEFAULT_TO_STRING_CLASSES);
 
 	/**
 	 * Construct an instance with the default object mapper and default header patterns
@@ -108,10 +101,7 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 	 * @see org.springframework.util.PatternMatchUtils#simpleMatch(String, String)
 	 */
 	public BinderHeaderMapper(ObjectMapper objectMapper) {
-		this(objectMapper,
-				"!" + MessageHeaders.ID,
-				"!" + MessageHeaders.TIMESTAMP,
-				"*");
+		this(objectMapper, "!" + MessageHeaders.ID, "!" + MessageHeaders.TIMESTAMP, "*");
 	}
 
 	/**
@@ -119,9 +109,9 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 	 * for outbound headers; all inbound headers are mapped. The patterns are applied in
 	 * order, stopping on the first match (positive or negative). Patterns are negated by
 	 * preceding them with "!". The patterns will replace the default patterns; you
-	 * generally should not map the {@code "id" and "timestamp"} headers. Note:
-	 * most of the headers in {@link KafkaHeaders} are ever mapped as headers since they
-	 * represent data in consumer/producer records.
+	 * generally should not map the {@code "id" and "timestamp"} headers. Note: most of
+	 * the headers in {@link KafkaHeaders} are ever mapped as headers since they represent
+	 * data in consumer/producer records.
 	 * @param patterns the patterns.
 	 * @see org.springframework.util.PatternMatchUtils#simpleMatch(String, String)
 	 */
@@ -146,8 +136,8 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 		Assert.notNull(objectMapper, "'objectMapper' must not be null");
 		Assert.noNullElements(patterns, "'patterns' must not have null elements");
 		this.objectMapper = objectMapper;
-		this.objectMapper
-				.registerModule(new SimpleModule().addDeserializer(MimeType.class, new MimeTypeJsonDeserializer()));
+		this.objectMapper.registerModule(new SimpleModule()
+				.addDeserializer(MimeType.class, new MimeTypeJsonDeserializer()));
 	}
 
 	/**
@@ -177,11 +167,11 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 	}
 
 	/**
-	 * Add packages to the trusted packages list (default {@code java.util, java.lang}) used
-	 * when constructing objects from JSON.
-	 * If any of the supplied packages is {@code "*"}, all packages are trusted.
-	 * If a class for a non-trusted package is encountered, the header is returned to the
-	 * application with value of type {@link NonTrustedHeaderType}.
+	 * Add packages to the trusted packages list (default {@code java.util, java.lang})
+	 * used when constructing objects from JSON. If any of the supplied packages is
+	 * {@code "*"}, all packages are trusted. If a class for a non-trusted package is
+	 * encountered, the header is returned to the application with value of type
+	 * {@link NonTrustedHeaderType}.
 	 * @param trustedPackages the packages to trust.
 	 */
 	public void addTrustedPackages(String... trustedPackages) {
@@ -224,12 +214,14 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 							value = v.toString();
 							className = "java.lang.String";
 						}
-						target.add(new RecordHeader(k, getObjectMapper().writeValueAsBytes(value)));
+						target.add(new RecordHeader(k,
+								getObjectMapper().writeValueAsBytes(value)));
 						jsonHeaders.put(k, className);
 					}
 					catch (Exception e) {
 						if (logger.isDebugEnabled()) {
-							logger.debug("Could not map " + k + " with type " + v.getClass().getName());
+							logger.debug("Could not map " + k + " with type "
+									+ v.getClass().getName());
 						}
 					}
 				}
@@ -237,7 +229,8 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 		});
 		if (jsonHeaders.size() > 0) {
 			try {
-				target.add(new RecordHeader(JSON_TYPES, getObjectMapper().writeValueAsBytes(jsonHeaders)));
+				target.add(new RecordHeader(JSON_TYPES,
+						getObjectMapper().writeValueAsBytes(jsonHeaders)));
 			}
 			catch (IllegalStateException | JsonProcessingException e) {
 				logger.error("Could not add json types header", e);
@@ -265,17 +258,18 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 					}
 					if (trusted) {
 						try {
-							headers.put(h.key(), getObjectMapper().readValue(h.value(), type));
+							headers.put(h.key(),
+									getObjectMapper().readValue(h.value(), type));
 						}
 						catch (IOException e) {
-							logger.error("Could not decode json type: " + new String(h.value()) + " for key: " + h
-											.key(),
-									e);
+							logger.error("Could not decode json type: "
+									+ new String(h.value()) + " for key: " + h.key(), e);
 							headers.put(h.key(), h.value());
 						}
 					}
 					else {
-						headers.put(h.key(), new NonTrustedHeaderType(h.value(), requestedType));
+						headers.put(h.key(),
+								new NonTrustedHeaderType(h.value(), requestedType));
 					}
 				}
 				else {
@@ -297,7 +291,9 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 					types = getObjectMapper().readValue(next.value(), Map.class);
 				}
 				catch (IOException e) {
-					logger.error("Could not decode json types: " + new String(next.value()), e);
+					logger.error(
+							"Could not decode json types: " + new String(next.value()),
+							e);
 				}
 				break;
 			}
@@ -313,7 +309,8 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 			}
 			String packageName = requestedType.substring(0, lastDot);
 			for (String trustedPackage : this.trustedPackages) {
-				if (packageName.equals(trustedPackage) || packageName.startsWith(trustedPackage + ".")) {
+				if (packageName.equals(trustedPackage)
+						|| packageName.startsWith(trustedPackage + ".")) {
 					return true;
 				}
 			}
@@ -322,11 +319,10 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 		return true;
 	}
 
-
 	/**
-	 * The {@link StdNodeBasedDeserializer} extension for {@link MimeType} deserialization.
-	 * It is presented here for backward compatibility when older producers send {@link MimeType}
-	 * headers as serialization version.
+	 * The {@link StdNodeBasedDeserializer} extension for {@link MimeType}
+	 * deserialization. It is presented here for backward compatibility when older
+	 * producers send {@link MimeType} headers as serialization version.
 	 */
 	private class MimeTypeJsonDeserializer extends StdNodeBasedDeserializer {
 
@@ -337,14 +333,14 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 		}
 
 		@Override
-		public MimeType convert(JsonNode root, DeserializationContext ctxt) throws IOException {
+		public MimeType convert(JsonNode root, DeserializationContext ctxt)
+				throws IOException {
 			JsonNode type = root.get("type");
 			JsonNode subType = root.get("subtype");
 			JsonNode parameters = root.get("parameters");
-			Map params =
-					BinderHeaderMapper.this.objectMapper.readValue(parameters.traverse(),
-							TypeFactory.defaultInstance()
-									.constructMapType(HashMap.class, String.class, String.class));
+			Map params = BinderHeaderMapper.this.objectMapper
+					.readValue(parameters.traverse(), TypeFactory.defaultInstance()
+							.constructMapType(HashMap.class, String.class, String.class));
 			return new MimeType(type.asText(), subType.asText(), params);
 		}
 
@@ -375,14 +371,17 @@ public class BinderHeaderMapper extends AbstractKafkaHeaderMapper {
 		@Override
 		public String toString() {
 			try {
-				return "NonTrustedHeaderType [headerValue=" + new String(this.headerValue, StandardCharsets.UTF_8)
+				return "NonTrustedHeaderType [headerValue="
+						+ new String(this.headerValue, StandardCharsets.UTF_8)
 						+ ", untrustedType=" + this.untrustedType + "]";
 			}
 			catch (Exception e) {
-				return "NonTrustedHeaderType [headerValue=" + Arrays.toString(this.headerValue) + ", untrustedType="
+				return "NonTrustedHeaderType [headerValue="
+						+ Arrays.toString(this.headerValue) + ", untrustedType="
 						+ this.untrustedType + "]";
 			}
 		}
 
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderEnvironmentPostProcessor.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderEnvironmentPostProcessor.java
index 09e8d5727..507d7a402 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderEnvironmentPostProcessor.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderEnvironmentPostProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,8 +28,8 @@ import org.springframework.core.env.ConfigurableEnvironment;
 import org.springframework.core.env.MapPropertySource;
 
 /**
- * An {@link EnvironmentPostProcessor} that sets some common configuration properties (log config etc.,) for Kafka
- *  binder.
+ * An {@link EnvironmentPostProcessor} that sets some common configuration properties (log
+ * config etc.,) for Kafka binder.
  *
  * @author Ilayaperumal Gopinathan
  */
@@ -41,28 +41,42 @@ public class KafkaBinderEnvironmentPostProcessor implements EnvironmentPostProce
 
 	private static final String SPRING_KAFKA_CONSUMER = SPRING_KAFKA + ".consumer";
 
-	private static final String SPRING_KAFKA_PRODUCER_KEY_SERIALIZER = SPRING_KAFKA_PRODUCER + "." + "keySerializer";
+	private static final String SPRING_KAFKA_PRODUCER_KEY_SERIALIZER = SPRING_KAFKA_PRODUCER
+			+ "." + "keySerializer";
 
-	private static final String SPRING_KAFKA_PRODUCER_VALUE_SERIALIZER = SPRING_KAFKA_PRODUCER + "." + "valueSerializer";
+	private static final String SPRING_KAFKA_PRODUCER_VALUE_SERIALIZER = SPRING_KAFKA_PRODUCER
+			+ "." + "valueSerializer";
 
-	private static final String SPRING_KAFKA_CONSUMER_KEY_DESERIALIZER = SPRING_KAFKA_CONSUMER + "." + "keyDeserializer";
+	private static final String SPRING_KAFKA_CONSUMER_KEY_DESERIALIZER = SPRING_KAFKA_CONSUMER
+			+ "." + "keyDeserializer";
 
-	private static final String SPRING_KAFKA_CONSUMER_VALUE_DESERIALIZER = SPRING_KAFKA_CONSUMER + "." + "valueDeserializer";
+	private static final String SPRING_KAFKA_CONSUMER_VALUE_DESERIALIZER = SPRING_KAFKA_CONSUMER
+			+ "." + "valueDeserializer";
 
 	private static final String KAFKA_BINDER_DEFAULT_PROPERTIES = "kafkaBinderDefaultProperties";
 
 	@Override
-	public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
+	public void postProcessEnvironment(ConfigurableEnvironment environment,
+			SpringApplication application) {
 		if (!environment.getPropertySources().contains(KAFKA_BINDER_DEFAULT_PROPERTIES)) {
 			Map kafkaBinderDefaultProperties = new HashMap<>();
-			kafkaBinderDefaultProperties.put("logging.level.org.I0Itec.zkclient", "ERROR");
-			kafkaBinderDefaultProperties.put("logging.level.kafka.server.KafkaConfig", "ERROR");
-			kafkaBinderDefaultProperties.put("logging.level.kafka.admin.AdminClient.AdminConfig", "ERROR");
-			kafkaBinderDefaultProperties.put(SPRING_KAFKA_PRODUCER_KEY_SERIALIZER, ByteArraySerializer.class.getName());
-			kafkaBinderDefaultProperties.put(SPRING_KAFKA_PRODUCER_VALUE_SERIALIZER, ByteArraySerializer.class.getName());
-			kafkaBinderDefaultProperties.put(SPRING_KAFKA_CONSUMER_KEY_DESERIALIZER, ByteArrayDeserializer.class.getName());
-			kafkaBinderDefaultProperties.put(SPRING_KAFKA_CONSUMER_VALUE_DESERIALIZER, ByteArrayDeserializer.class.getName());
-			environment.getPropertySources().addLast(new MapPropertySource(KAFKA_BINDER_DEFAULT_PROPERTIES, kafkaBinderDefaultProperties));
+			kafkaBinderDefaultProperties.put("logging.level.org.I0Itec.zkclient",
+					"ERROR");
+			kafkaBinderDefaultProperties.put("logging.level.kafka.server.KafkaConfig",
+					"ERROR");
+			kafkaBinderDefaultProperties
+					.put("logging.level.kafka.admin.AdminClient.AdminConfig", "ERROR");
+			kafkaBinderDefaultProperties.put(SPRING_KAFKA_PRODUCER_KEY_SERIALIZER,
+					ByteArraySerializer.class.getName());
+			kafkaBinderDefaultProperties.put(SPRING_KAFKA_PRODUCER_VALUE_SERIALIZER,
+					ByteArraySerializer.class.getName());
+			kafkaBinderDefaultProperties.put(SPRING_KAFKA_CONSUMER_KEY_DESERIALIZER,
+					ByteArrayDeserializer.class.getName());
+			kafkaBinderDefaultProperties.put(SPRING_KAFKA_CONSUMER_VALUE_DESERIALIZER,
+					ByteArrayDeserializer.class.getName());
+			environment.getPropertySources().addLast(new MapPropertySource(
+					KAFKA_BINDER_DEFAULT_PROPERTIES, kafkaBinderDefaultProperties));
 		}
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicator.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicator.java
index 414c043f7..e87295e1a 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicator.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicator.java
@@ -56,14 +56,14 @@ public class KafkaBinderHealthIndicator implements HealthIndicator {
 
 	private Consumer metadataConsumer;
 
-	public KafkaBinderHealthIndicator(KafkaMessageChannelBinder binder, ConsumerFactory consumerFactory) {
+	public KafkaBinderHealthIndicator(KafkaMessageChannelBinder binder,
+			ConsumerFactory consumerFactory) {
 		this.binder = binder;
 		this.consumerFactory = consumerFactory;
 	}
 
 	/**
 	 * Set the timeout in seconds to retrieve health information.
-	 *
 	 * @param timeout the timeout - default 60.
 	 */
 	public void setTimeout(int timeout) {
@@ -80,16 +80,16 @@ public class KafkaBinderHealthIndicator implements HealthIndicator {
 		catch (InterruptedException ex) {
 			Thread.currentThread().interrupt();
 			return Health.down()
-					.withDetail("Interrupted while waiting for partition information in", this.timeout + " seconds")
+					.withDetail("Interrupted while waiting for partition information in",
+							this.timeout + " seconds")
 					.build();
 		}
 		catch (ExecutionException ex) {
 			return Health.down(ex).build();
 		}
 		catch (TimeoutException ex) {
-			return Health.down()
-					.withDetail("Failed to retrieve partition information in", this.timeout + " seconds")
-					.build();
+			return Health.down().withDetail("Failed to retrieve partition information in",
+					this.timeout + " seconds").build();
 		}
 		finally {
 			exec.shutdownNow();
@@ -107,21 +107,23 @@ public class KafkaBinderHealthIndicator implements HealthIndicator {
 			}
 			synchronized (this.metadataConsumer) {
 				Set downMessages = new HashSet<>();
-				final Map topicsInUse =
-						KafkaBinderHealthIndicator.this.binder.getTopicsInUse();
+				final Map topicsInUse = KafkaBinderHealthIndicator.this.binder
+						.getTopicsInUse();
 				if (topicsInUse.isEmpty()) {
-					return Health.down()
-							.withDetail("No topic information available", "Kafka broker is not reachable")
-							.build();
+					return Health.down().withDetail("No topic information available",
+							"Kafka broker is not reachable").build();
 				}
 				else {
 					for (String topic : topicsInUse.keySet()) {
-						KafkaMessageChannelBinder.TopicInformation topicInformation = topicsInUse.get(topic);
+						KafkaMessageChannelBinder.TopicInformation topicInformation = topicsInUse
+								.get(topic);
 						if (!topicInformation.isTopicPattern()) {
-							List partitionInfos = this.metadataConsumer.partitionsFor(topic);
+							List partitionInfos = this.metadataConsumer
+									.partitionsFor(topic);
 							for (PartitionInfo partitionInfo : partitionInfos) {
 								if (topicInformation.getPartitionInfos()
-										.contains(partitionInfo) && partitionInfo.leader().id() == -1) {
+										.contains(partitionInfo)
+										&& partitionInfo.leader().id() == -1) {
 									downMessages.add(partitionInfo.toString());
 								}
 							}
@@ -133,8 +135,9 @@ public class KafkaBinderHealthIndicator implements HealthIndicator {
 				}
 				else {
 					return Health.down()
-						.withDetail("Following partitions in use have no leaders: ", downMessages.toString())
-						.build();
+							.withDetail("Following partitions in use have no leaders: ",
+									downMessages.toString())
+							.build();
 				}
 			}
 		}
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetrics.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetrics.java
index 2ecb56a20..406acd98e 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetrics.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetrics.java
@@ -59,7 +59,8 @@ import org.springframework.util.ObjectUtils;
  * @author Thomas Cheyney
  * @author Gary Russell
  */
-public class KafkaBinderMetrics implements MeterBinder, ApplicationListener {
+public class KafkaBinderMetrics
+		implements MeterBinder, ApplicationListener {
 
 	private static final int DEFAULT_TIMEOUT = 60;
 
@@ -81,7 +82,8 @@ public class KafkaBinderMetrics implements MeterBinder, ApplicationListener defaultConsumerFactory, @Nullable MeterRegistry meterRegistry) {
+			ConsumerFactory defaultConsumerFactory,
+			@Nullable MeterRegistry meterRegistry) {
 
 		this.binder = binder;
 		this.binderConfigurationProperties = binderConfigurationProperties;
@@ -102,8 +104,8 @@ public class KafkaBinderMetrics implements MeterBinder, ApplicationListener topicInfo : this.binder.getTopicsInUse()
-				.entrySet()) {
+		for (Map.Entry topicInfo : this.binder
+				.getTopicsInUse().entrySet()) {
 
 			if (!topicInfo.getValue().isConsumerTopic()) {
 				continue;
@@ -113,8 +115,7 @@ public class KafkaBinderMetrics implements MeterBinder, ApplicationListener computeUnconsumedMessages(topic, group))
-					.tag("group", group)
+					(o) -> computeUnconsumedMessages(topic, group)).tag("group", group)
 					.tag("topic", topic)
 					.description("Unconsumed messages for a particular group and topic")
 					.register(registry);
@@ -131,16 +132,21 @@ public class KafkaBinderMetrics implements MeterBinder, ApplicationListener createConsumerFactory().createConsumer(g, "monitoring"));
 				synchronized (metadataConsumer) {
-					List partitionInfos = metadataConsumer.partitionsFor(topic);
+					List partitionInfos = metadataConsumer
+							.partitionsFor(topic);
 					List topicPartitions = new LinkedList<>();
 					for (PartitionInfo partitionInfo : partitionInfos) {
-						topicPartitions.add(new TopicPartition(partitionInfo.topic(), partitionInfo.partition()));
+						topicPartitions.add(new TopicPartition(partitionInfo.topic(),
+								partitionInfo.partition()));
 					}
 
-					Map endOffsets = metadataConsumer.endOffsets(topicPartitions);
+					Map endOffsets = metadataConsumer
+							.endOffsets(topicPartitions);
 
-					for (Map.Entry endOffset : endOffsets.entrySet()) {
-						OffsetAndMetadata current = metadataConsumer.committed(endOffset.getKey());
+					for (Map.Entry endOffset : endOffsets
+							.entrySet()) {
+						OffsetAndMetadata current = metadataConsumer
+								.committed(endOffset.getKey());
 						lag += endOffset.getValue();
 						if (current != null) {
 							lag -= current.offset();
@@ -173,17 +179,22 @@ public class KafkaBinderMetrics implements MeterBinder, ApplicationListener props = new HashMap<>();
-					props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
-					props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
-					Map mergedConfig = this.binderConfigurationProperties.mergedConsumerConfiguration();
+					props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+							ByteArrayDeserializer.class);
+					props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+							ByteArrayDeserializer.class);
+					Map mergedConfig = this.binderConfigurationProperties
+							.mergedConsumerConfiguration();
 					if (!ObjectUtils.isEmpty(mergedConfig)) {
 						props.putAll(mergedConfig);
 					}
 					if (!props.containsKey(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG)) {
 						props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
-								this.binderConfigurationProperties.getKafkaConnectionString());
+								this.binderConfigurationProperties
+										.getKafkaConnectionString());
 					}
-					this.defaultConsumerFactory = new DefaultKafkaConsumerFactory<>(props);
+					this.defaultConsumerFactory = new DefaultKafkaConsumerFactory<>(
+							props);
 				}
 			}
 		}
@@ -194,7 +205,8 @@ public class KafkaBinderMetrics implements MeterBinder, ApplicationListener consumer,
-			Collection partitions) {
+	default void onPartitionsRevokedBeforeCommit(String bindingName,
+			Consumer consumer, Collection partitions) {
 		// do nothing
 	}
 
@@ -48,20 +48,21 @@ public interface KafkaBindingRebalanceListener {
 	 * @param consumer the consumer.
 	 * @param partitions the partitions.
 	 */
-	default void onPartitionsRevokedAfterCommit(String bindingName, Consumer consumer, Collection partitions) {
+	default void onPartitionsRevokedAfterCommit(String bindingName,
+			Consumer consumer, Collection partitions) {
 		// do nothing
 	}
 
 	/**
-	 * Invoked when partitions are initially assigned or after a rebalance.
-	 * Applications might only want to perform seek operations on an initial assignment.
+	 * Invoked when partitions are initially assigned or after a rebalance. Applications
+	 * might only want to perform seek operations on an initial assignment.
 	 * @param bindingName the name of the binding.
 	 * @param consumer the consumer.
 	 * @param partitions the partitions.
 	 * @param initial true if this is the initial assignment.
 	 */
-	default void onPartitionsAssigned(String bindingName, Consumer consumer, Collection partitions,
-			boolean initial) {
+	default void onPartitionsAssigned(String bindingName, Consumer consumer,
+			Collection partitions, boolean initial) {
 		// do nothing
 	}
 
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java
index 7055f120e..a1901c8f9 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java
@@ -117,7 +117,8 @@ import org.springframework.util.concurrent.ListenableFuture;
 import org.springframework.util.concurrent.ListenableFutureCallback;
 
 /**
- * A {@link org.springframework.cloud.stream.binder.Binder} that uses Kafka as the underlying middleware.
+ * A {@link org.springframework.cloud.stream.binder.Binder} that uses Kafka as the
+ * underlying middleware.
  *
  * @author Eric Bottard
  * @author Marius Bogoevici
@@ -130,8 +131,11 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
  * @author Doug Saus
  */
 public class KafkaMessageChannelBinder extends
+		// @checkstyle:off
 		AbstractMessageChannelBinder, ExtendedProducerProperties, KafkaTopicProvisioner>
-		implements ExtendedPropertiesBinder {
+		// @checkstyle:on
+		implements
+		ExtendedPropertiesBinder {
 
 	/**
 	 * Kafka header for x-exception-fqcn.
@@ -187,23 +191,28 @@ public class KafkaMessageChannelBinder extends
 
 	private KafkaExtendedBindingProperties extendedBindingProperties = new KafkaExtendedBindingProperties();
 
-	public KafkaMessageChannelBinder(KafkaBinderConfigurationProperties configurationProperties,
+	public KafkaMessageChannelBinder(
+			KafkaBinderConfigurationProperties configurationProperties,
 			KafkaTopicProvisioner provisioningProvider) {
 
 		this(configurationProperties, provisioningProvider, null, null);
 	}
 
-	public KafkaMessageChannelBinder(KafkaBinderConfigurationProperties configurationProperties,
+	public KafkaMessageChannelBinder(
+			KafkaBinderConfigurationProperties configurationProperties,
 			KafkaTopicProvisioner provisioningProvider,
 			ListenerContainerCustomizer> containerCustomizer,
 			KafkaBindingRebalanceListener rebalanceListener) {
 
-		super(headersToMap(configurationProperties), provisioningProvider, containerCustomizer);
+		super(headersToMap(configurationProperties), provisioningProvider,
+				containerCustomizer);
 		this.configurationProperties = configurationProperties;
-		if (StringUtils.hasText(configurationProperties.getTransaction().getTransactionIdPrefix())) {
+		if (StringUtils.hasText(
+				configurationProperties.getTransaction().getTransactionIdPrefix())) {
 			this.transactionManager = new KafkaTransactionManager<>(getProducerFactory(
-					configurationProperties.getTransaction().getTransactionIdPrefix(), new ExtendedProducerProperties<>(
-							configurationProperties.getTransaction().getProducer().getExtension())));
+					configurationProperties.getTransaction().getTransactionIdPrefix(),
+					new ExtendedProducerProperties<>(configurationProperties
+							.getTransaction().getProducer().getExtension())));
 		}
 		else {
 			this.transactionManager = null;
@@ -211,23 +220,27 @@ public class KafkaMessageChannelBinder extends
 		this.rebalanceListener = rebalanceListener;
 	}
 
-	private static String[] headersToMap(KafkaBinderConfigurationProperties configurationProperties) {
+	private static String[] headersToMap(
+			KafkaBinderConfigurationProperties configurationProperties) {
 		String[] headersToMap;
 		if (ObjectUtils.isEmpty(configurationProperties.getHeaders())) {
 			headersToMap = BinderHeaders.STANDARD_HEADERS;
 		}
 		else {
-			String[] combinedHeadersToMap = Arrays.copyOfRange(BinderHeaders.STANDARD_HEADERS, 0,
-					BinderHeaders.STANDARD_HEADERS.length + configurationProperties.getHeaders().length);
-			System.arraycopy(configurationProperties.getHeaders(), 0, combinedHeadersToMap,
-					BinderHeaders.STANDARD_HEADERS.length,
+			String[] combinedHeadersToMap = Arrays.copyOfRange(
+					BinderHeaders.STANDARD_HEADERS, 0,
+					BinderHeaders.STANDARD_HEADERS.length
+							+ configurationProperties.getHeaders().length);
+			System.arraycopy(configurationProperties.getHeaders(), 0,
+					combinedHeadersToMap, BinderHeaders.STANDARD_HEADERS.length,
 					configurationProperties.getHeaders().length);
 			headersToMap = combinedHeadersToMap;
 		}
 		return headersToMap;
 	}
 
-	public void setExtendedBindingProperties(KafkaExtendedBindingProperties extendedBindingProperties) {
+	public void setExtendedBindingProperties(
+			KafkaExtendedBindingProperties extendedBindingProperties) {
 		this.extendedBindingProperties = extendedBindingProperties;
 	}
 
@@ -261,46 +274,56 @@ public class KafkaMessageChannelBinder extends
 	}
 
 	@Override
-	protected MessageHandler createProducerMessageHandler(final ProducerDestination destination,
-			ExtendedProducerProperties producerProperties, MessageChannel errorChannel)
-			throws Exception {
-		throw new IllegalStateException("The abstract binder should not call this method");
+	protected MessageHandler createProducerMessageHandler(
+			final ProducerDestination destination,
+			ExtendedProducerProperties producerProperties,
+			MessageChannel errorChannel) throws Exception {
+		throw new IllegalStateException(
+				"The abstract binder should not call this method");
 	}
 
 	@Override
-	protected MessageHandler createProducerMessageHandler(final ProducerDestination destination,
+	protected MessageHandler createProducerMessageHandler(
+			final ProducerDestination destination,
 			ExtendedProducerProperties producerProperties,
-			MessageChannel channel, MessageChannel errorChannel)
-			throws Exception {
+			MessageChannel channel, MessageChannel errorChannel) throws Exception {
 		/*
-		 * IMPORTANT: With a transactional binder, individual producer properties for Kafka are
-		 * ignored; the global binder (spring.cloud.stream.kafka.binder.transaction.producer.*)
-		 * properties are used instead, for all producers. A binder is transactional when
+		 * IMPORTANT: With a transactional binder, individual producer properties for
+		 * Kafka are ignored; the global binder
+		 * (spring.cloud.stream.kafka.binder.transaction.producer.*) properties are used
+		 * instead, for all producers. A binder is transactional when
 		 * 'spring.cloud.stream.kafka.binder.transaction.transaction-id-prefix' has text.
 		 */
 		final ProducerFactory producerFB = this.transactionManager != null
 				? this.transactionManager.getProducerFactory()
 				: getProducerFactory(null, producerProperties);
 		Collection partitions = provisioningProvider.getPartitionsForTopic(
-				producerProperties.getPartitionCount(), false,
-				() -> {
+				producerProperties.getPartitionCount(), false, () -> {
 					Producer producer = producerFB.createProducer();
-					List partitionsFor = producer.partitionsFor(destination.getName());
+					List partitionsFor = producer
+							.partitionsFor(destination.getName());
 					producer.close();
 					((DisposableBean) producerFB).destroy();
 					return partitionsFor;
 				}, destination.getName());
-		this.topicsInUse.put(destination.getName(), new TopicInformation(null, partitions, false));
-		if (producerProperties.isPartitioned() && producerProperties.getPartitionCount() < partitions.size()) {
+		this.topicsInUse.put(destination.getName(),
+				new TopicInformation(null, partitions, false));
+		if (producerProperties.isPartitioned()
+				&& producerProperties.getPartitionCount() < partitions.size()) {
 			if (this.logger.isInfoEnabled()) {
-				this.logger.info("The `partitionCount` of the producer for topic " + destination.getName() + " is "
-						+ producerProperties.getPartitionCount() + ", smaller than the actual partition count of "
-						+ partitions.size() + " for the topic. The larger number will be used instead.");
+				this.logger.info("The `partitionCount` of the producer for topic "
+						+ destination.getName() + " is "
+						+ producerProperties.getPartitionCount()
+						+ ", smaller than the actual partition count of "
+						+ partitions.size()
+						+ " for the topic. The larger number will be used instead.");
 			}
-			List interceptors = ((ChannelInterceptorAware) channel).getChannelInterceptors();
+			List interceptors = ((ChannelInterceptorAware) channel)
+					.getChannelInterceptors();
 			interceptors.forEach((interceptor) -> {
 				if (interceptor instanceof PartitioningInterceptor) {
-					((PartitioningInterceptor) interceptor).setPartitionCount(partitions.size());
+					((PartitioningInterceptor) interceptor)
+							.setPartitionCount(partitions.size());
 				}
 			});
 		}
@@ -309,27 +332,29 @@ public class KafkaMessageChannelBinder extends
 		if (this.producerListener != null) {
 			kafkaTemplate.setProducerListener(this.producerListener);
 		}
-		ProducerConfigurationMessageHandler handler = new ProducerConfigurationMessageHandler(kafkaTemplate,
-				destination.getName(), producerProperties, producerFB);
+		ProducerConfigurationMessageHandler handler = new ProducerConfigurationMessageHandler(
+				kafkaTemplate, destination.getName(), producerProperties, producerFB);
 		if (errorChannel != null) {
 			handler.setSendFailureChannel(errorChannel);
 		}
 		KafkaHeaderMapper mapper = null;
 		if (this.configurationProperties.getHeaderMapperBeanName() != null) {
-			mapper = getApplicationContext().getBean(this.configurationProperties.getHeaderMapperBeanName(),
+			mapper = getApplicationContext().getBean(
+					this.configurationProperties.getHeaderMapperBeanName(),
 					KafkaHeaderMapper.class);
 		}
 		/*
-		 *  Even if the user configures a bean, we must not use it if the header
-		 *  mode is not the default (headers); setting the mapper to null
-		 *  disables populating headers in the message handler.
+		 * Even if the user configures a bean, we must not use it if the header mode is
+		 * not the default (headers); setting the mapper to null disables populating
+		 * headers in the message handler.
 		 */
 		if (producerProperties.getHeaderMode() != null
 				&& !HeaderMode.headers.equals(producerProperties.getHeaderMode())) {
 			mapper = null;
 		}
 		else if (mapper == null) {
-			String[] headerPatterns = producerProperties.getExtension().getHeaderPatterns();
+			String[] headerPatterns = producerProperties.getExtension()
+					.getHeaderPatterns();
 			if (headerPatterns != null && headerPatterns.length > 0) {
 				List patterns = new LinkedList<>(Arrays.asList(headerPatterns));
 				if (!patterns.contains("!" + MessageHeaders.TIMESTAMP)) {
@@ -338,7 +363,8 @@ public class KafkaMessageChannelBinder extends
 				if (!patterns.contains("!" + MessageHeaders.ID)) {
 					patterns.add(0, "!" + MessageHeaders.ID);
 				}
-				mapper = new BinderHeaderMapper(patterns.toArray(new String[patterns.size()]));
+				mapper = new BinderHeaderMapper(
+						patterns.toArray(new String[patterns.size()]));
 			}
 			else {
 				mapper = new BinderHeaderMapper();
@@ -348,20 +374,25 @@ public class KafkaMessageChannelBinder extends
 		return handler;
 	}
 
-	protected DefaultKafkaProducerFactory getProducerFactory(String transactionIdPrefix,
+	protected DefaultKafkaProducerFactory getProducerFactory(
+			String transactionIdPrefix,
 			ExtendedProducerProperties producerProperties) {
 		Map props = new HashMap<>();
 		props.put(ProducerConfig.RETRIES_CONFIG, 0);
 		props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, 33554432);
 		props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class);
-		props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class);
-		props.put(ProducerConfig.ACKS_CONFIG, String.valueOf(this.configurationProperties.getRequiredAcks()));
-		Map mergedConfig = this.configurationProperties.mergedProducerConfiguration();
+		props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+				ByteArraySerializer.class);
+		props.put(ProducerConfig.ACKS_CONFIG,
+				String.valueOf(this.configurationProperties.getRequiredAcks()));
+		Map mergedConfig = this.configurationProperties
+				.mergedProducerConfiguration();
 		if (!ObjectUtils.isEmpty(mergedConfig)) {
 			props.putAll(mergedConfig);
 		}
 		if (ObjectUtils.isEmpty(props.get(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG))) {
-			props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, this.configurationProperties.getKafkaConnectionString());
+			props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
+					this.configurationProperties.getKafkaConnectionString());
 		}
 		if (ObjectUtils.isEmpty(props.get(ProducerConfig.BATCH_SIZE_CONFIG))) {
 			props.put(ProducerConfig.BATCH_SIZE_CONFIG,
@@ -378,7 +409,8 @@ public class KafkaMessageChannelBinder extends
 		if (!ObjectUtils.isEmpty(producerProperties.getExtension().getConfiguration())) {
 			props.putAll(producerProperties.getExtension().getConfiguration());
 		}
-		DefaultKafkaProducerFactory producerFactory = new DefaultKafkaProducerFactory<>(props);
+		DefaultKafkaProducerFactory producerFactory = new DefaultKafkaProducerFactory<>(
+				props);
 		if (transactionIdPrefix != null) {
 			producerFactory.setTransactionIdPrefix(transactionIdPrefix);
 		}
@@ -386,51 +418,62 @@ public class KafkaMessageChannelBinder extends
 	}
 
 	@Override
-	protected boolean useNativeEncoding(ExtendedProducerProperties producerProperties) {
+	protected boolean useNativeEncoding(
+			ExtendedProducerProperties producerProperties) {
 		if (this.transactionManager != null) {
-			return this.configurationProperties.getTransaction().getProducer().isUseNativeEncoding();
+			return this.configurationProperties.getTransaction().getProducer()
+					.isUseNativeEncoding();
 		}
 		return super.useNativeEncoding(producerProperties);
 	}
 
 	@Override
 	@SuppressWarnings("unchecked")
-	protected MessageProducer createConsumerEndpoint(final ConsumerDestination destination, final String group,
+	protected MessageProducer createConsumerEndpoint(
+			final ConsumerDestination destination, final String group,
 			final ExtendedConsumerProperties extendedConsumerProperties) {
 		boolean anonymous = !StringUtils.hasText(group);
-		Assert.isTrue(!anonymous || !extendedConsumerProperties.getExtension().isEnableDlq(),
+		Assert.isTrue(
+				!anonymous || !extendedConsumerProperties.getExtension().isEnableDlq(),
 				"DLQ support is not available for anonymous subscriptions");
-		String consumerGroup = anonymous ? "anonymous." + UUID.randomUUID().toString() : group;
-		final ConsumerFactory consumerFactory = createKafkaConsumerFactory(anonymous, consumerGroup,
-				extendedConsumerProperties);
+		String consumerGroup = anonymous ? "anonymous." + UUID.randomUUID().toString()
+				: group;
+		final ConsumerFactory consumerFactory = createKafkaConsumerFactory(
+				anonymous, consumerGroup, extendedConsumerProperties);
 		int partitionCount = extendedConsumerProperties.getInstanceCount()
 				* extendedConsumerProperties.getConcurrency();
 
 		Collection listenedPartitions = new ArrayList<>();
 
-		boolean usingPatterns = extendedConsumerProperties.getExtension().isDestinationIsPattern();
+		boolean usingPatterns = extendedConsumerProperties.getExtension()
+				.isDestinationIsPattern();
 		Assert.isTrue(!usingPatterns || !extendedConsumerProperties.isMultiplex(),
 				"Cannot use a pattern with multiplexed destinations; "
-				+ "use the regex pattern to specify multiple topics instead");
-		boolean groupManagement = extendedConsumerProperties.getExtension().isAutoRebalanceEnabled();
+						+ "use the regex pattern to specify multiple topics instead");
+		boolean groupManagement = extendedConsumerProperties.getExtension()
+				.isAutoRebalanceEnabled();
 		if (!extendedConsumerProperties.isMultiplex()) {
-			listenedPartitions.addAll(processTopic(consumerGroup, extendedConsumerProperties, consumerFactory,
-					partitionCount, usingPatterns, groupManagement, destination.getName()));
+			listenedPartitions.addAll(processTopic(consumerGroup,
+					extendedConsumerProperties, consumerFactory, partitionCount,
+					usingPatterns, groupManagement, destination.getName()));
 		}
 		else {
-			for (String name : StringUtils.commaDelimitedListToStringArray(destination.getName())) {
-				listenedPartitions.addAll(processTopic(consumerGroup, extendedConsumerProperties, consumerFactory,
-						partitionCount, usingPatterns, groupManagement, name.trim()));
+			for (String name : StringUtils
+					.commaDelimitedListToStringArray(destination.getName())) {
+				listenedPartitions.addAll(processTopic(consumerGroup,
+						extendedConsumerProperties, consumerFactory, partitionCount,
+						usingPatterns, groupManagement, name.trim()));
 			}
 		}
 
-		String[] topics = extendedConsumerProperties.isMultiplex() ? StringUtils.commaDelimitedListToStringArray(destination.getName())
+		String[] topics = extendedConsumerProperties.isMultiplex()
+				? StringUtils.commaDelimitedListToStringArray(destination.getName())
 				: new String[] { destination.getName() };
 		for (int i = 0; i < topics.length; i++) {
 			topics[i] = topics[i].trim();
 		}
-		Assert.isTrue(usingPatterns
-				|| !CollectionUtils.isEmpty(listenedPartitions), "A list of partitions must be provided");
+		Assert.isTrue(usingPatterns || !CollectionUtils.isEmpty(listenedPartitions),
+				"A list of partitions must be provided");
 		final TopicPartitionInitialOffset[] topicPartitionInitialOffsets = getTopicPartitionInitialOffsets(
 				listenedPartitions);
 		final ContainerProperties containerProperties = anonymous
@@ -445,13 +488,16 @@ public class KafkaMessageChannelBinder extends
 		if (this.rebalanceListener != null) {
 			setupRebalanceListener(extendedConsumerProperties, containerProperties);
 		}
-		containerProperties.setIdleEventInterval(extendedConsumerProperties.getExtension().getIdleEventInterval());
+		containerProperties.setIdleEventInterval(
+				extendedConsumerProperties.getExtension().getIdleEventInterval());
 		int concurrency = usingPatterns ? extendedConsumerProperties.getConcurrency()
-				: Math.min(extendedConsumerProperties.getConcurrency(), listenedPartitions.size());
-		resetOffsets(extendedConsumerProperties, consumerFactory, groupManagement, containerProperties);
+				: Math.min(extendedConsumerProperties.getConcurrency(),
+						listenedPartitions.size());
+		resetOffsets(extendedConsumerProperties, consumerFactory, groupManagement,
+				containerProperties);
 		@SuppressWarnings("rawtypes")
-		final ConcurrentMessageListenerContainer messageListenerContainer =
-				new ConcurrentMessageListenerContainer(consumerFactory, containerProperties) {
+		final ConcurrentMessageListenerContainer messageListenerContainer = new ConcurrentMessageListenerContainer(
+				consumerFactory, containerProperties) {
 
 			@Override
 			public void stop(Runnable callback) {
@@ -462,10 +508,12 @@ public class KafkaMessageChannelBinder extends
 		messageListenerContainer.setConcurrency(concurrency);
 		// these won't be needed if the container is made a bean
 		if (getApplicationEventPublisher() != null) {
-			messageListenerContainer.setApplicationEventPublisher(getApplicationEventPublisher());
+			messageListenerContainer
+					.setApplicationEventPublisher(getApplicationEventPublisher());
 		}
 		else if (getApplicationContext() != null) {
-			messageListenerContainer.setApplicationEventPublisher(getApplicationContext());
+			messageListenerContainer
+					.setApplicationEventPublisher(getApplicationContext());
 		}
 		messageListenerContainer.setBeanName(topics + ".container");
 		// end of these won't be needed...
@@ -478,26 +526,34 @@ public class KafkaMessageChannelBinder extends
 			messageListenerContainer.getContainerProperties()
 					.setAckOnError(isAutoCommitOnError(extendedConsumerProperties));
 			if (extendedConsumerProperties.getExtension().isAckEachRecord()) {
-				messageListenerContainer.getContainerProperties().setAckMode(ContainerProperties.AckMode.RECORD);
+				messageListenerContainer.getContainerProperties()
+						.setAckMode(ContainerProperties.AckMode.RECORD);
 			}
 		}
 		if (this.logger.isDebugEnabled()) {
-			this.logger.debug(
-					"Listened partitions: " + StringUtils.collectionToCommaDelimitedString(listenedPartitions));
+			this.logger.debug("Listened partitions: "
+					+ StringUtils.collectionToCommaDelimitedString(listenedPartitions));
 		}
-		this.getContainerCustomizer().configure(messageListenerContainer, destination.getName(), group);
-		final KafkaMessageDrivenChannelAdapter kafkaMessageDrivenChannelAdapter =
-				new KafkaMessageDrivenChannelAdapter<>(messageListenerContainer);
-		kafkaMessageDrivenChannelAdapter.setMessageConverter(getMessageConverter(extendedConsumerProperties));
+		this.getContainerCustomizer().configure(messageListenerContainer,
+				destination.getName(), group);
+		// @checkstyle:off
+		final KafkaMessageDrivenChannelAdapter kafkaMessageDrivenChannelAdapter = new KafkaMessageDrivenChannelAdapter<>(
+				messageListenerContainer);
+		// @checkstyle:on
+		kafkaMessageDrivenChannelAdapter
+				.setMessageConverter(getMessageConverter(extendedConsumerProperties));
 		kafkaMessageDrivenChannelAdapter.setBeanFactory(this.getBeanFactory());
-		ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination, consumerGroup,
-				extendedConsumerProperties);
+		ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination,
+				consumerGroup, extendedConsumerProperties);
 		if (extendedConsumerProperties.getMaxAttempts() > 1) {
-			kafkaMessageDrivenChannelAdapter.setRetryTemplate(buildRetryTemplate(extendedConsumerProperties));
-			kafkaMessageDrivenChannelAdapter.setRecoveryCallback(errorInfrastructure.getRecoverer());
+			kafkaMessageDrivenChannelAdapter
+					.setRetryTemplate(buildRetryTemplate(extendedConsumerProperties));
+			kafkaMessageDrivenChannelAdapter
+					.setRecoveryCallback(errorInfrastructure.getRecoverer());
 		}
 		else {
-			kafkaMessageDrivenChannelAdapter.setErrorChannel(errorInfrastructure.getErrorChannel());
+			kafkaMessageDrivenChannelAdapter
+					.setErrorChannel(errorInfrastructure.getErrorChannel());
 		}
 		return kafkaMessageDrivenChannelAdapter;
 	}
@@ -511,61 +567,67 @@ public class KafkaMessageChannelBinder extends
 		bindingNameHolder.remove();
 		Assert.notNull(bindingName, "'bindingName' cannot be null");
 		final KafkaBindingRebalanceListener userRebalanceListener = this.rebalanceListener;
-		containerProperties.setConsumerRebalanceListener(new ConsumerAwareRebalanceListener() {
+		containerProperties
+				.setConsumerRebalanceListener(new ConsumerAwareRebalanceListener() {
 
-			private boolean initial = true;
+					private boolean initial = true;
 
-			@Override
-			public void onPartitionsRevokedBeforeCommit(Consumer consumer,
-					Collection partitions) {
+					@Override
+					public void onPartitionsRevokedBeforeCommit(Consumer consumer,
+							Collection partitions) {
 
-				userRebalanceListener.onPartitionsRevokedBeforeCommit(bindingName, consumer, partitions);
-			}
+						userRebalanceListener.onPartitionsRevokedBeforeCommit(bindingName,
+								consumer, partitions);
+					}
 
-			@Override
-			public void onPartitionsRevokedAfterCommit(Consumer consumer,
-					Collection partitions) {
+					@Override
+					public void onPartitionsRevokedAfterCommit(Consumer consumer,
+							Collection partitions) {
 
-				userRebalanceListener.onPartitionsRevokedAfterCommit(bindingName, consumer, partitions);
-			}
+						userRebalanceListener.onPartitionsRevokedAfterCommit(bindingName,
+								consumer, partitions);
+					}
 
-			@Override
-			public void onPartitionsAssigned(Consumer consumer, Collection partitions) {
-				try {
-					userRebalanceListener.onPartitionsAssigned(bindingName, consumer, partitions, this.initial);
-				}
-				finally {
-					this.initial = false;
-				}
-			}
+					@Override
+					public void onPartitionsAssigned(Consumer consumer,
+							Collection partitions) {
+						try {
+							userRebalanceListener.onPartitionsAssigned(bindingName,
+									consumer, partitions, this.initial);
+						}
+						finally {
+							this.initial = false;
+						}
+					}
 
-		});
+				});
 	}
 
 	public Collection processTopic(final String group,
 			final ExtendedConsumerProperties extendedConsumerProperties,
-			final ConsumerFactory consumerFactory, int partitionCount, boolean usingPatterns,
-			boolean groupManagement, String topic) {
+			final ConsumerFactory consumerFactory, int partitionCount,
+			boolean usingPatterns, boolean groupManagement, String topic) {
 		Collection listenedPartitions;
 		Collection allPartitions = usingPatterns ? Collections.emptyList()
-				: getPartitionInfo(topic, extendedConsumerProperties, consumerFactory, partitionCount);
+				: getPartitionInfo(topic, extendedConsumerProperties, consumerFactory,
+						partitionCount);
 
-		if (groupManagement ||
-				extendedConsumerProperties.getInstanceCount() == 1) {
+		if (groupManagement || extendedConsumerProperties.getInstanceCount() == 1) {
 			listenedPartitions = allPartitions;
 		}
 		else {
 			listenedPartitions = new ArrayList<>();
 			for (PartitionInfo partition : allPartitions) {
 				// divide partitions across modules
-				if ((partition.partition()
-						% extendedConsumerProperties.getInstanceCount()) == extendedConsumerProperties
+				if ((partition.partition() % extendedConsumerProperties
+						.getInstanceCount()) == extendedConsumerProperties
 								.getInstanceIndex()) {
 					listenedPartitions.add(partition);
 				}
 			}
 		}
-		this.topicsInUse.put(topic, new TopicInformation(group, listenedPartitions, usingPatterns));
+		this.topicsInUse.put(topic,
+				new TopicInformation(group, listenedPartitions, usingPatterns));
 		return listenedPartitions;
 	}
 
@@ -579,84 +641,101 @@ public class KafkaMessageChannelBinder extends
 			final ContainerProperties containerProperties) {
 
 		boolean resetOffsets = extendedConsumerProperties.getExtension().isResetOffsets();
-		final Object resetTo = consumerFactory.getConfigurationProperties().get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG);
+		final Object resetTo = consumerFactory.getConfigurationProperties()
+				.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG);
 		final AtomicBoolean initialAssignment = new AtomicBoolean(true);
 		if (!"earliest".equals(resetTo) && !"latest".equals(resetTo)) {
-			logger.warn("no (or unknown) " + ConsumerConfig.AUTO_OFFSET_RESET_CONFIG +
-					" property cannot reset");
+			logger.warn("no (or unknown) " + ConsumerConfig.AUTO_OFFSET_RESET_CONFIG
+					+ " property cannot reset");
 			resetOffsets = false;
 		}
 		if (groupManagement && resetOffsets) {
-			containerProperties.setConsumerRebalanceListener(new ConsumerAwareRebalanceListener() {
+			containerProperties
+					.setConsumerRebalanceListener(new ConsumerAwareRebalanceListener() {
 
-				@Override
-				public void onPartitionsRevokedBeforeCommit(Consumer consumer, Collection tps) {
-					// no op
-				}
-
-				@Override
-				public void onPartitionsRevokedAfterCommit(Consumer consumer, Collection tps) {
-					// no op
-				}
-
-				@Override
-				public void onPartitionsAssigned(Consumer consumer, Collection tps) {
-					if (initialAssignment.getAndSet(false)) {
-						if ("earliest".equals(resetTo)) {
-							consumer.seekToBeginning(tps);
+						@Override
+						public void onPartitionsRevokedBeforeCommit(
+								Consumer consumer, Collection tps) {
+							// no op
 						}
-						else if ("latest".equals(resetTo)) {
-							consumer.seekToEnd(tps);
+
+						@Override
+						public void onPartitionsRevokedAfterCommit(
+								Consumer consumer, Collection tps) {
+							// no op
 						}
-					}
-				}
-			});
+
+						@Override
+						public void onPartitionsAssigned(Consumer consumer,
+								Collection tps) {
+							if (initialAssignment.getAndSet(false)) {
+								if ("earliest".equals(resetTo)) {
+									consumer.seekToBeginning(tps);
+								}
+								else if ("latest".equals(resetTo)) {
+									consumer.seekToEnd(tps);
+								}
+							}
+						}
+					});
 		}
 		else if (resetOffsets) {
 			Arrays.stream(containerProperties.getTopicPartitions())
-					.map(tpio -> new TopicPartitionInitialOffset(tpio.topic(), tpio.partition(),
-							"earliest".equals(resetTo) ? SeekPosition.BEGINNING : SeekPosition.END))
-					.collect(Collectors.toList()).toArray(containerProperties.getTopicPartitions());
+					.map(tpio -> new TopicPartitionInitialOffset(tpio.topic(),
+							tpio.partition(),
+							"earliest".equals(resetTo) ? SeekPosition.BEGINNING
+									: SeekPosition.END))
+					.collect(Collectors.toList())
+					.toArray(containerProperties.getTopicPartitions());
 		}
 	}
 
 	@Override
-	protected PolledConsumerResources createPolledConsumerResources(String name, String group,
-			ConsumerDestination destination, ExtendedConsumerProperties consumerProperties) {
+	protected PolledConsumerResources createPolledConsumerResources(String name,
+			String group, ConsumerDestination destination,
+			ExtendedConsumerProperties consumerProperties) {
 
 		boolean anonymous = !StringUtils.hasText(group);
 		Assert.isTrue(!anonymous || !consumerProperties.getExtension().isEnableDlq(),
 				"DLQ support is not available for anonymous subscriptions");
-		String consumerGroup = anonymous ? "anonymous." + UUID.randomUUID().toString() : group;
-		final ConsumerFactory consumerFactory = createKafkaConsumerFactory(anonymous, consumerGroup,
-				consumerProperties);
+		String consumerGroup = anonymous ? "anonymous." + UUID.randomUUID().toString()
+				: group;
+		final ConsumerFactory consumerFactory = createKafkaConsumerFactory(
+				anonymous, consumerGroup, consumerProperties);
 		String[] topics = consumerProperties.isMultiplex()
 				? StringUtils.commaDelimitedListToStringArray(destination.getName())
 				: new String[] { destination.getName() };
 		for (int i = 0; i < topics.length; i++) {
 			topics[i] = topics[i].trim();
 		}
-		KafkaMessageSource source = new KafkaMessageSource<>(consumerFactory, topics);
+		KafkaMessageSource source = new KafkaMessageSource<>(consumerFactory,
+				topics);
 		source.setMessageConverter(getMessageConverter(consumerProperties));
 		source.setRawMessageHeader(consumerProperties.getExtension().isEnableDlq());
 		String clientId = name;
-		if (consumerProperties.getExtension().getConfiguration().containsKey(ConsumerConfig.CLIENT_ID_CONFIG)) {
-			clientId = consumerProperties.getExtension().getConfiguration().get(ConsumerConfig.CLIENT_ID_CONFIG);
+		if (consumerProperties.getExtension().getConfiguration()
+				.containsKey(ConsumerConfig.CLIENT_ID_CONFIG)) {
+			clientId = consumerProperties.getExtension().getConfiguration()
+					.get(ConsumerConfig.CLIENT_ID_CONFIG);
 		}
 		source.setClientId(clientId);
 
 		if (!consumerProperties.isMultiplex()) {
-			// I copied this from the regular consumer - it looks bogus to me - includes all partitions
-			// not just the ones this binding is listening to; doesn't seem right for a health check.
-			Collection partitionInfos = getPartitionInfo(destination.getName(), consumerProperties,
-					consumerFactory, -1);
-			this.topicsInUse.put(destination.getName(), new TopicInformation(consumerGroup, partitionInfos, false));
+			// I copied this from the regular consumer - it looks bogus to me - includes
+			// all partitions
+			// not just the ones this binding is listening to; doesn't seem right for a
+			// health check.
+			Collection partitionInfos = getPartitionInfo(
+					destination.getName(), consumerProperties, consumerFactory, -1);
+			this.topicsInUse.put(destination.getName(),
+					new TopicInformation(consumerGroup, partitionInfos, false));
 		}
 		else {
 			for (int i = 0; i < topics.length; i++) {
-				Collection partitionInfos = getPartitionInfo(topics[i], consumerProperties,
-						consumerFactory, -1);
-				this.topicsInUse.put(topics[i], new TopicInformation(consumerGroup, partitionInfos, false));
+				Collection partitionInfos = getPartitionInfo(topics[i],
+						consumerProperties, consumerFactory, -1);
+				this.topicsInUse.put(topics[i],
+						new TopicInformation(consumerGroup, partitionInfos, false));
 			}
 		}
 
@@ -673,8 +752,8 @@ public class KafkaMessageChannelBinder extends
 			}
 
 		});
-		return new PolledConsumerResources(source,
-				registerErrorInfrastructure(destination, group, consumerProperties, true));
+		return new PolledConsumerResources(source, registerErrorInfrastructure(
+				destination, group, consumerProperties, true));
 	}
 
 	@Override
@@ -692,20 +771,24 @@ public class KafkaMessageChannelBinder extends
 		MessagingMessageConverter messageConverter;
 		if (extendedConsumerProperties.getExtension().getConverterBeanName() == null) {
 			messageConverter = new MessagingMessageConverter();
-			StandardHeaders standardHeaders = extendedConsumerProperties.getExtension().getStandardHeaders();
-			messageConverter.setGenerateMessageId(StandardHeaders.id.equals(standardHeaders)
-					|| StandardHeaders.both.equals(standardHeaders));
-			messageConverter.setGenerateTimestamp(StandardHeaders.timestamp.equals(standardHeaders)
-					|| StandardHeaders.both.equals(standardHeaders));
+			StandardHeaders standardHeaders = extendedConsumerProperties.getExtension()
+					.getStandardHeaders();
+			messageConverter
+					.setGenerateMessageId(StandardHeaders.id.equals(standardHeaders)
+							|| StandardHeaders.both.equals(standardHeaders));
+			messageConverter.setGenerateTimestamp(
+					StandardHeaders.timestamp.equals(standardHeaders)
+							|| StandardHeaders.both.equals(standardHeaders));
 		}
 		else {
 			try {
 				messageConverter = getApplicationContext().getBean(
-					extendedConsumerProperties.getExtension().getConverterBeanName(),
+						extendedConsumerProperties.getExtension().getConverterBeanName(),
 						MessagingMessageConverter.class);
 			}
 			catch (NoSuchBeanDefinitionException ex) {
-				throw new IllegalStateException("Converter bean not present in application context", ex);
+				throw new IllegalStateException(
+						"Converter bean not present in application context", ex);
 			}
 		}
 		messageConverter.setHeaderMapper(getHeaderMapper(extendedConsumerProperties));
@@ -716,7 +799,8 @@ public class KafkaMessageChannelBinder extends
 			final ExtendedConsumerProperties extendedConsumerProperties) {
 		KafkaHeaderMapper mapper = null;
 		if (this.configurationProperties.getHeaderMapperBeanName() != null) {
-			mapper = getApplicationContext().getBean(this.configurationProperties.getHeaderMapperBeanName(),
+			mapper = getApplicationContext().getBean(
+					this.configurationProperties.getHeaderMapperBeanName(),
 					KafkaHeaderMapper.class);
 		}
 		if (mapper == null) {
@@ -731,7 +815,8 @@ public class KafkaMessageChannelBinder extends
 				}
 
 			};
-			String[] trustedPackages = extendedConsumerProperties.getExtension().getTrustedPackages();
+			String[] trustedPackages = extendedConsumerProperties.getExtension()
+					.getTrustedPackages();
 			if (!StringUtils.isEmpty(trustedPackages)) {
 				headerMapper.addTrustedPackages(trustedPackages);
 			}
@@ -760,16 +845,19 @@ public class KafkaMessageChannelBinder extends
 
 	@SuppressWarnings("unchecked")
 	@Override
-	protected MessageHandler getErrorMessageHandler(final ConsumerDestination destination, final String group,
+	protected MessageHandler getErrorMessageHandler(final ConsumerDestination destination,
+			final String group,
 			final ExtendedConsumerProperties properties) {
 		KafkaConsumerProperties kafkaConsumerProperties = properties.getExtension();
 		if (kafkaConsumerProperties.isEnableDlq()) {
-			KafkaProducerProperties dlqProducerProperties = kafkaConsumerProperties.getDlqProducerProperties();
+			KafkaProducerProperties dlqProducerProperties = kafkaConsumerProperties
+					.getDlqProducerProperties();
 			ProducerFactory producerFactory = this.transactionManager != null
 					? this.transactionManager.getProducerFactory()
 					: getProducerFactory(null,
-						new ExtendedProducerProperties<>(dlqProducerProperties));
-			final KafkaTemplate kafkaTemplate = new KafkaTemplate<>(producerFactory);
+							new ExtendedProducerProperties<>(dlqProducerProperties));
+			final KafkaTemplate kafkaTemplate = new KafkaTemplate<>(
+					producerFactory);
 
 			@SuppressWarnings("rawtypes")
 			DlqSender dlqSender = new DlqSender(kafkaTemplate);
@@ -781,16 +869,23 @@ public class KafkaMessageChannelBinder extends
 
 				if (properties.isUseNativeDecoding()) {
 					if (record != null) {
-						Map configuration = this.transactionManager == null ? dlqProducerProperties.getConfiguration()
-								: this.configurationProperties.getTransaction().getProducer().getConfiguration();
-						if (record.key() != null && !record.key().getClass().isInstance(byte[].class)) {
-							ensureDlqMessageCanBeProperlySerialized(
-									configuration,
-									(Map config) -> !config.containsKey("key.serializer"), "Key");
-						}
-						if (record.value() != null && !record.value().getClass().isInstance(byte[].class)) {
+						Map configuration = this.transactionManager == null
+								? dlqProducerProperties.getConfiguration()
+								: this.configurationProperties.getTransaction()
+										.getProducer().getConfiguration();
+						if (record.key() != null
+								&& !record.key().getClass().isInstance(byte[].class)) {
 							ensureDlqMessageCanBeProperlySerialized(configuration,
-									(Map config) -> !config.containsKey("value.serializer"), "Payload");
+									(Map config) -> !config
+											.containsKey("key.serializer"),
+									"Key");
+						}
+						if (record.value() != null
+								&& !record.value().getClass().isInstance(byte[].class)) {
+							ensureDlqMessageCanBeProperlySerialized(configuration,
+									(Map config) -> !config
+											.containsKey("value.serializer"),
+									"Payload");
 						}
 					}
 				}
@@ -800,7 +895,8 @@ public class KafkaMessageChannelBinder extends
 					return;
 				}
 				Headers kafkaHeaders = new RecordHeaders(record.headers().toArray());
-				AtomicReference> recordToSend = new AtomicReference<>(record);
+				AtomicReference> recordToSend = new AtomicReference<>(
+						record);
 				if (message.getPayload() instanceof Throwable) {
 
 					Throwable throwable = (Throwable) message.getPayload();
@@ -809,42 +905,55 @@ public class KafkaMessageChannelBinder extends
 
 					if (headerMode == null || HeaderMode.headers.equals(headerMode)) {
 
-						kafkaHeaders.add(
-								new RecordHeader(X_ORIGINAL_TOPIC, record.topic().getBytes(StandardCharsets.UTF_8)));
+						kafkaHeaders.add(new RecordHeader(X_ORIGINAL_TOPIC,
+								record.topic().getBytes(StandardCharsets.UTF_8)));
 						kafkaHeaders.add(new RecordHeader(X_ORIGINAL_PARTITION,
-								ByteBuffer.allocate(Integer.BYTES).putInt(record.partition()).array()));
-						kafkaHeaders.add(new RecordHeader(X_ORIGINAL_OFFSET,
-								ByteBuffer.allocate(Long.BYTES).putLong(record.offset()).array()));
+								ByteBuffer.allocate(Integer.BYTES)
+										.putInt(record.partition()).array()));
+						kafkaHeaders.add(new RecordHeader(X_ORIGINAL_OFFSET, ByteBuffer
+								.allocate(Long.BYTES).putLong(record.offset()).array()));
 						kafkaHeaders.add(new RecordHeader(X_ORIGINAL_TIMESTAMP,
-								ByteBuffer.allocate(Long.BYTES).putLong(record.timestamp()).array()));
+								ByteBuffer.allocate(Long.BYTES)
+										.putLong(record.timestamp()).array()));
 						kafkaHeaders.add(new RecordHeader(X_ORIGINAL_TIMESTAMP_TYPE,
-								record.timestampType().toString().getBytes(StandardCharsets.UTF_8)));
-						kafkaHeaders.add(new RecordHeader(X_EXCEPTION_FQCN,
-								throwable.getClass().getName().getBytes(StandardCharsets.UTF_8)));
+								record.timestampType().toString()
+										.getBytes(StandardCharsets.UTF_8)));
+						kafkaHeaders.add(new RecordHeader(X_EXCEPTION_FQCN, throwable
+								.getClass().getName().getBytes(StandardCharsets.UTF_8)));
 						kafkaHeaders.add(new RecordHeader(X_EXCEPTION_MESSAGE,
 								throwable.getMessage().getBytes(StandardCharsets.UTF_8)));
 						kafkaHeaders.add(new RecordHeader(X_EXCEPTION_STACKTRACE,
-								getStackTraceAsString(throwable).getBytes(StandardCharsets.UTF_8)));
+								getStackTraceAsString(throwable)
+										.getBytes(StandardCharsets.UTF_8)));
 					}
 					else if (HeaderMode.embeddedHeaders.equals(headerMode)) {
 						try {
 							MessageValues messageValues = EmbeddedHeaderUtils
-									.extractHeaders(MessageBuilder.withPayload((byte[]) record.value()).build(), false);
+									.extractHeaders(MessageBuilder
+											.withPayload((byte[]) record.value()).build(),
+											false);
 							messageValues.put(X_ORIGINAL_TOPIC, record.topic());
 							messageValues.put(X_ORIGINAL_PARTITION, record.partition());
 							messageValues.put(X_ORIGINAL_OFFSET, record.offset());
 							messageValues.put(X_ORIGINAL_TIMESTAMP, record.timestamp());
-							messageValues.put(X_ORIGINAL_TIMESTAMP_TYPE, record.timestampType().toString());
-							messageValues.put(X_EXCEPTION_FQCN, throwable.getClass().getName());
-							messageValues.put(X_EXCEPTION_MESSAGE, throwable.getMessage());
-							messageValues.put(X_EXCEPTION_STACKTRACE, getStackTraceAsString(throwable));
+							messageValues.put(X_ORIGINAL_TIMESTAMP_TYPE,
+									record.timestampType().toString());
+							messageValues.put(X_EXCEPTION_FQCN,
+									throwable.getClass().getName());
+							messageValues.put(X_EXCEPTION_MESSAGE,
+									throwable.getMessage());
+							messageValues.put(X_EXCEPTION_STACKTRACE,
+									getStackTraceAsString(throwable));
 
-							final String[] headersToEmbed = new ArrayList<>(messageValues.keySet())
-									.toArray(new String[messageValues.keySet().size()]);
-							byte[] payload = EmbeddedHeaderUtils.embedHeaders(messageValues,
+							final String[] headersToEmbed = new ArrayList<>(
+									messageValues.keySet()).toArray(
+											new String[messageValues.keySet().size()]);
+							byte[] payload = EmbeddedHeaderUtils.embedHeaders(
+									messageValues,
 									EmbeddedHeaderUtils.headersToEmbed(headersToEmbed));
-							recordToSend.set(new ConsumerRecord(record.topic(), record.partition(),
-									record.offset(), record.key(), payload));
+							recordToSend.set(new ConsumerRecord(
+									record.topic(), record.partition(), record.offset(),
+									record.key(), payload));
 						}
 						catch (Exception ex) {
 							throw new RuntimeException(ex);
@@ -852,7 +961,8 @@ public class KafkaMessageChannelBinder extends
 					}
 				}
 				String dlqName = StringUtils.hasText(kafkaConsumerProperties.getDlqName())
-						? kafkaConsumerProperties.getDlqName() : "error." + record.topic() + "." + group;
+						? kafkaConsumerProperties.getDlqName()
+						: "error." + record.topic() + "." + group;
 				dlqSender.sendToDlq(recordToSend.get(), kafkaHeaders, dlqName);
 			};
 		}
@@ -860,17 +970,20 @@ public class KafkaMessageChannelBinder extends
 	}
 
 	@Override
-	protected MessageHandler getPolledConsumerErrorMessageHandler(ConsumerDestination destination, String group,
+	protected MessageHandler getPolledConsumerErrorMessageHandler(
+			ConsumerDestination destination, String group,
 			ExtendedConsumerProperties properties) {
 		if (properties.getExtension().isEnableDlq()) {
 			return getErrorMessageHandler(destination, group, properties);
 		}
-		final MessageHandler superHandler = super.getErrorMessageHandler(destination, group, properties);
+		final MessageHandler superHandler = super.getErrorMessageHandler(destination,
+				group, properties);
 		return (message) -> {
-			ConsumerRecord record = (ConsumerRecord) message.getHeaders().get(KafkaHeaders.RAW_DATA);
+			ConsumerRecord record = (ConsumerRecord) message.getHeaders()
+					.get(KafkaHeaders.RAW_DATA);
 			if (!(message instanceof ErrorMessage)) {
-				logger.error("Expected an ErrorMessage, not a " + message.getClass().toString() + " for: "
-						+ message);
+				logger.error("Expected an ErrorMessage, not a "
+						+ message.getClass().toString() + " for: " + message);
 			}
 			else if (record == null) {
 				if (superHandler != null) {
@@ -879,8 +992,10 @@ public class KafkaMessageChannelBinder extends
 			}
 			else {
 				if (message.getPayload() instanceof MessagingException) {
-					AcknowledgmentCallback ack = StaticMessageHeaderAccessor.getAcknowledgmentCallback(
-							((MessagingException) message.getPayload()).getFailedMessage());
+					AcknowledgmentCallback ack = StaticMessageHeaderAccessor
+							.getAcknowledgmentCallback(
+									((MessagingException) message.getPayload())
+											.getFailedMessage());
 					if (ack != null) {
 						if (isAutoCommitOnError(properties)) {
 							ack.acknowledge(AcknowledgmentCallback.Status.REJECT);
@@ -894,31 +1009,39 @@ public class KafkaMessageChannelBinder extends
 		};
 	}
 
-	private static void ensureDlqMessageCanBeProperlySerialized(Map configuration,
-																Predicate> configPredicate,
-																String dataType) {
-			if (CollectionUtils.isEmpty(configuration) || configPredicate.test(configuration)) {
-				throw new IllegalArgumentException("Native decoding is used on the consumer. " +
-						dataType + " is not byte[] and no serializer is set on the DLQ producer.");
-			}
+	private static void ensureDlqMessageCanBeProperlySerialized(
+			Map configuration,
+			Predicate> configPredicate, String dataType) {
+		if (CollectionUtils.isEmpty(configuration)
+				|| configPredicate.test(configuration)) {
+			throw new IllegalArgumentException("Native decoding is used on the consumer. "
+					+ dataType
+					+ " is not byte[] and no serializer is set on the DLQ producer.");
+		}
 	}
 
-	protected ConsumerFactory createKafkaConsumerFactory(boolean anonymous, String consumerGroup,
+	protected ConsumerFactory createKafkaConsumerFactory(boolean anonymous,
+			String consumerGroup,
 			ExtendedConsumerProperties consumerProperties) {
 		Map props = new HashMap<>();
-		props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
-		props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
+		props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
+		props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
 		props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false);
 		props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 100);
-		props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, anonymous ? "latest" : "earliest");
+		props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
+				anonymous ? "latest" : "earliest");
 		props.put(ConsumerConfig.GROUP_ID_CONFIG, consumerGroup);
 
-		Map mergedConfig = this.configurationProperties.mergedConsumerConfiguration();
+		Map mergedConfig = this.configurationProperties
+				.mergedConsumerConfiguration();
 		if (!ObjectUtils.isEmpty(mergedConfig)) {
 			props.putAll(mergedConfig);
 		}
 		if (ObjectUtils.isEmpty(props.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG))) {
-			props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.configurationProperties.getKafkaConnectionString());
+			props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
+					this.configurationProperties.getKafkaConnectionString());
 		}
 		if (!ObjectUtils.isEmpty(consumerProperties.getExtension().getConfiguration())) {
 			props.putAll(consumerProperties.getExtension().getConfiguration());
@@ -931,10 +1054,12 @@ public class KafkaMessageChannelBinder extends
 		return new DefaultKafkaConsumerFactory<>(props);
 	}
 
-	private boolean isAutoCommitOnError(ExtendedConsumerProperties properties) {
+	private boolean isAutoCommitOnError(
+			ExtendedConsumerProperties properties) {
 		return properties.getExtension().getAutoCommitOnError() != null
 				? properties.getExtension().getAutoCommitOnError()
-				: properties.getExtension().isAutoCommitOffset() && properties.getExtension().isEnableDlq();
+				: properties.getExtension().isAutoCommitOffset()
+						&& properties.getExtension().isEnableDlq();
 	}
 
 	private TopicPartitionInitialOffset[] getTopicPartitionInitialOffsets(
@@ -944,8 +1069,8 @@ public class KafkaMessageChannelBinder extends
 		int i = 0;
 		for (PartitionInfo partition : listenedPartitions) {
 
-			topicPartitionInitialOffsets[i++] = new TopicPartitionInitialOffset(partition.topic(),
-					partition.partition());
+			topicPartitionInitialOffsets[i++] = new TopicPartitionInitialOffset(
+					partition.topic(), partition.partition());
 		}
 		return topicPartitionInitialOffsets;
 	}
@@ -964,23 +1089,26 @@ public class KafkaMessageChannelBinder extends
 		return stringWriter.getBuffer().toString();
 	}
 
-	private final class ProducerConfigurationMessageHandler extends KafkaProducerMessageHandler
-			implements Lifecycle {
+	private final class ProducerConfigurationMessageHandler
+			extends KafkaProducerMessageHandler implements Lifecycle {
 
 		private boolean running = true;
 
 		private final ProducerFactory producerFactory;
 
-		ProducerConfigurationMessageHandler(KafkaTemplate kafkaTemplate, String topic,
+		ProducerConfigurationMessageHandler(KafkaTemplate kafkaTemplate,
+				String topic,
 				ExtendedProducerProperties producerProperties,
 				ProducerFactory producerFactory) {
 			super(kafkaTemplate);
 			setTopicExpression(new LiteralExpression(topic));
-			setMessageKeyExpression(producerProperties.getExtension().getMessageKeyExpression());
+			setMessageKeyExpression(
+					producerProperties.getExtension().getMessageKeyExpression());
 			setBeanFactory(KafkaMessageChannelBinder.this.getBeanFactory());
 			if (producerProperties.isPartitioned()) {
 				SpelExpressionParser parser = new SpelExpressionParser();
-				setPartitionIdExpression(parser.parseExpression("headers['" + BinderHeaders.PARTITION_HEADER + "']"));
+				setPartitionIdExpression(parser.parseExpression(
+						"headers['" + BinderHeaders.PARTITION_HEADER + "']"));
 			}
 			if (producerProperties.getExtension().isSync()) {
 				setSync(true);
@@ -1025,7 +1153,8 @@ public class KafkaMessageChannelBinder extends
 
 		private final boolean isTopicPattern;
 
-		TopicInformation(String consumerGroup, Collection partitionInfos, boolean isTopicPattern) {
+		TopicInformation(String consumerGroup, Collection partitionInfos,
+				boolean isTopicPattern) {
 			this.consumerGroup = consumerGroup;
 			this.partitionInfos = partitionInfos;
 			this.isTopicPattern = isTopicPattern;
@@ -1064,15 +1193,16 @@ public class KafkaMessageChannelBinder extends
 		}
 
 		@SuppressWarnings("unchecked")
-		void sendToDlq(ConsumerRecord consumerRecord, Headers headers, String dlqName) {
+		void sendToDlq(ConsumerRecord consumerRecord, Headers headers,
+				String dlqName) {
 			K key = (K) consumerRecord.key();
 			V value = (V) consumerRecord.value();
-			ProducerRecord producerRecord = new ProducerRecord<>(dlqName, consumerRecord.partition(),
-					key, value, headers);
+			ProducerRecord producerRecord = new ProducerRecord<>(dlqName,
+					consumerRecord.partition(), key, value, headers);
 
 			StringBuilder sb = new StringBuilder().append(" a message with key='")
-					.append(toDisplayString(ObjectUtils.nullSafeToString(key), 50)).append("'")
-					.append(" and payload='")
+					.append(toDisplayString(ObjectUtils.nullSafeToString(key), 50))
+					.append("'").append(" and payload='")
 					.append(toDisplayString(ObjectUtils.nullSafeToString(value), 50))
 					.append("'").append(" received from ")
 					.append(consumerRecord.partition());
@@ -1083,26 +1213,28 @@ public class KafkaMessageChannelBinder extends
 
 					@Override
 					public void onFailure(Throwable ex) {
-						KafkaMessageChannelBinder.this.logger.error(
-								"Error sending to DLQ " + sb.toString(), ex);
+						KafkaMessageChannelBinder.this.logger
+								.error("Error sending to DLQ " + sb.toString(), ex);
 					}
 
 					@Override
 					public void onSuccess(SendResult result) {
 						if (KafkaMessageChannelBinder.this.logger.isDebugEnabled()) {
-							KafkaMessageChannelBinder.this.logger.debug(
-									"Sent to DLQ " + sb.toString());
+							KafkaMessageChannelBinder.this.logger
+									.debug("Sent to DLQ " + sb.toString());
 						}
 					}
 				});
 			}
 			catch (Exception ex) {
 				if (sentDlq == null) {
-					KafkaMessageChannelBinder.this.logger.error(
-							"Error sending to DLQ " + sb.toString(), ex);
+					KafkaMessageChannelBinder.this.logger
+							.error("Error sending to DLQ " + sb.toString(), ex);
 				}
 			}
 
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/ExtendedBindingHandlerMappingsProviderConfiguration.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/ExtendedBindingHandlerMappingsProviderConfiguration.java
index 2e2d02b2b..671284edb 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/ExtendedBindingHandlerMappingsProviderConfiguration.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/ExtendedBindingHandlerMappingsProviderConfiguration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,17 +31,21 @@ import org.springframework.context.annotation.Configuration;
  */
 
 @Configuration
-public class ExtendedBindingHandlerMappingsProviderConfiguration  {
+public class ExtendedBindingHandlerMappingsProviderConfiguration {
 
 	@Bean
 	public MappingsProvider kafkaExtendedPropertiesDefaultMappingsProvider() {
 		return () -> {
 			Map mappings = new HashMap<>();
-			mappings.put(ConfigurationPropertyName.of("spring.cloud.stream.kafka.bindings"),
+			mappings.put(
+					ConfigurationPropertyName.of("spring.cloud.stream.kafka.bindings"),
 					ConfigurationPropertyName.of("spring.cloud.stream.kafka.default"));
-			mappings.put(ConfigurationPropertyName.of("spring.cloud.stream.kafka.streams"),
-					ConfigurationPropertyName.of("spring.cloud.stream.kafka.streams.default"));
+			mappings.put(
+					ConfigurationPropertyName.of("spring.cloud.stream.kafka.streams"),
+					ConfigurationPropertyName
+							.of("spring.cloud.stream.kafka.streams.default"));
 			return mappings;
 		};
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderConfiguration.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderConfiguration.java
index 6081ab936..bef6264cc 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderConfiguration.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderConfiguration.java
@@ -76,29 +76,32 @@ public class KafkaBinderConfiguration {
 	@Autowired
 	private KafkaProperties kafkaProperties;
 
-
 	@Bean
-	KafkaBinderConfigurationProperties configurationProperties(KafkaProperties kafkaProperties) {
+	KafkaBinderConfigurationProperties configurationProperties(
+			KafkaProperties kafkaProperties) {
 		return new KafkaBinderConfigurationProperties(kafkaProperties);
 	}
 
 	@Bean
-	KafkaTopicProvisioner provisioningProvider(KafkaBinderConfigurationProperties configurationProperties) {
+	KafkaTopicProvisioner provisioningProvider(
+			KafkaBinderConfigurationProperties configurationProperties) {
 		return new KafkaTopicProvisioner(configurationProperties, this.kafkaProperties);
 	}
 
 	@SuppressWarnings("unchecked")
 	@Bean
-	KafkaMessageChannelBinder kafkaMessageChannelBinder(KafkaBinderConfigurationProperties configurationProperties,
+	KafkaMessageChannelBinder kafkaMessageChannelBinder(
+			KafkaBinderConfigurationProperties configurationProperties,
 			KafkaTopicProvisioner provisioningProvider,
 			@Nullable ListenerContainerCustomizer> listenerContainerCustomizer,
 			ObjectProvider rebalanceListener) {
 
 		KafkaMessageChannelBinder kafkaMessageChannelBinder = new KafkaMessageChannelBinder(
-				configurationProperties, provisioningProvider, listenerContainerCustomizer,
-				rebalanceListener.getIfUnique());
+				configurationProperties, provisioningProvider,
+				listenerContainerCustomizer, rebalanceListener.getIfUnique());
 		kafkaMessageChannelBinder.setProducerListener(this.producerListener);
-		kafkaMessageChannelBinder.setExtendedBindingProperties(this.kafkaExtendedBindingProperties);
+		kafkaMessageChannelBinder
+				.setExtendedBindingProperties(this.kafkaExtendedBindingProperties);
 		return kafkaMessageChannelBinder;
 	}
 
@@ -111,13 +114,16 @@ public class KafkaBinderConfiguration {
 
 	@Bean
 	@ConditionalOnMissingBean(KafkaJaasLoginModuleInitializer.class)
-	public KafkaJaasLoginModuleInitializer jaasInitializer(KafkaBinderConfigurationProperties configurationProperties) throws IOException {
+	public KafkaJaasLoginModuleInitializer jaasInitializer(
+			KafkaBinderConfigurationProperties configurationProperties)
+			throws IOException {
 		KafkaJaasLoginModuleInitializer kafkaJaasLoginModuleInitializer = new KafkaJaasLoginModuleInitializer();
 		JaasLoginModuleConfiguration jaas = configurationProperties.getJaas();
 		if (jaas != null) {
 			kafkaJaasLoginModuleInitializer.setLoginModule(jaas.getLoginModule());
 
-			KafkaJaasLoginModuleInitializer.ControlFlag controlFlag = jaas.getControlFlag();
+			KafkaJaasLoginModuleInitializer.ControlFlag controlFlag = jaas
+					.getControlFlag();
 
 			if (controlFlag != null) {
 				kafkaJaasLoginModuleInitializer.setControlFlag(controlFlag);
@@ -129,8 +135,8 @@ public class KafkaBinderConfiguration {
 
 	/**
 	 * A conditional configuration for the {@link KafkaBinderMetrics} bean when the
-	 * {@link MeterRegistry} class is in classpath, as well as a {@link MeterRegistry} bean is
-	 * present in the application context.
+	 * {@link MeterRegistry} class is in classpath, as well as a {@link MeterRegistry}
+	 * bean is present in the application context.
 	 */
 	@Configuration
 	@ConditionalOnClass(MeterRegistry.class)
@@ -139,11 +145,13 @@ public class KafkaBinderConfiguration {
 
 		@Bean
 		@ConditionalOnMissingBean(KafkaBinderMetrics.class)
-		public MeterBinder kafkaBinderMetrics(KafkaMessageChannelBinder kafkaMessageChannelBinder,
+		public MeterBinder kafkaBinderMetrics(
+				KafkaMessageChannelBinder kafkaMessageChannelBinder,
 				KafkaBinderConfigurationProperties configurationProperties,
 				MeterRegistry meterRegistry) {
 
-			return new KafkaBinderMetrics(kafkaMessageChannelBinder, configurationProperties, null, meterRegistry);
+			return new KafkaBinderMetrics(kafkaMessageChannelBinder,
+					configurationProperties, null, meterRegistry);
 		}
 
 	}
@@ -157,6 +165,7 @@ public class KafkaBinderConfiguration {
 		private JaasLoginModuleConfiguration kafka;
 
 		private JaasLoginModuleConfiguration zookeeper;
+
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderHealthIndicatorConfiguration.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderHealthIndicatorConfiguration.java
index d067b5c1c..ca6649315 100644
--- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderHealthIndicatorConfiguration.java
+++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaBinderHealthIndicatorConfiguration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,22 +45,28 @@ import org.springframework.util.ObjectUtils;
 class KafkaBinderHealthIndicatorConfiguration {
 
 	@Bean
-	KafkaBinderHealthIndicator kafkaBinderHealthIndicator(KafkaMessageChannelBinder kafkaMessageChannelBinder,
-														KafkaBinderConfigurationProperties configurationProperties) {
+	KafkaBinderHealthIndicator kafkaBinderHealthIndicator(
+			KafkaMessageChannelBinder kafkaMessageChannelBinder,
+			KafkaBinderConfigurationProperties configurationProperties) {
 		Map props = new HashMap<>();
-		props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
-		props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
-		Map mergedConfig = configurationProperties.mergedConsumerConfiguration();
+		props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
+		props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
+		Map mergedConfig = configurationProperties
+				.mergedConsumerConfiguration();
 		if (!ObjectUtils.isEmpty(mergedConfig)) {
 			props.putAll(mergedConfig);
 		}
 		if (!props.containsKey(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG)) {
-			props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, configurationProperties.getKafkaConnectionString());
+			props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
+					configurationProperties.getKafkaConnectionString());
 		}
 		ConsumerFactory consumerFactory = new DefaultKafkaConsumerFactory<>(props);
-		KafkaBinderHealthIndicator indicator = new KafkaBinderHealthIndicator(kafkaMessageChannelBinder,
-				consumerFactory);
+		KafkaBinderHealthIndicator indicator = new KafkaBinderHealthIndicator(
+				kafkaMessageChannelBinder, consumerFactory);
 		indicator.setTimeout(configurationProperties.getHealthTimeout());
 		return indicator;
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AbstractKafkaTestBinder.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AbstractKafkaTestBinder.java
index 1f83a73f9..f9d664158 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AbstractKafkaTestBinder.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AbstractKafkaTestBinder.java
@@ -28,9 +28,10 @@ import org.springframework.context.ApplicationContext;
  * @author Gary Russell
  */
 public abstract class AbstractKafkaTestBinder extends
-		AbstractPollableConsumerTestBinder, ExtendedProducerProperties> {
+		// @checkstyle:off
+		AbstractPollableConsumerTestBinder, ExtendedProducerProperties> {
 
+	// @checkstyle:on
 	private ApplicationContext applicationContext;
 
 	@Override
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AdminConfigTests.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AdminConfigTests.java
index 024cadaf4..55a8398d4 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AdminConfigTests.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AdminConfigTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
  *
  */
 @RunWith(SpringRunner.class)
-@SpringBootTest(classes = {KafkaBinderConfiguration.class,
+@SpringBootTest(classes = { KafkaBinderConfiguration.class,
 		BindingServiceConfiguration.class })
 @TestPropertySource(properties = {
 		"spring.cloud.stream.kafka.bindings.input.consumer.admin.replication-factor=2",
@@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 		"spring.cloud.stream.kafka.bindings.output.producer.topic.replication-factor=2",
 		"spring.cloud.stream.kafka.bindings.output.producer.topic.replicas-assignments.0=0,1",
 		"spring.cloud.stream.kafka.bindings.output.producer.topic.properties.message.format.version=0.9.0.0",
-		"spring.main.allow-bean-definition-overriding=true"})
+		"spring.main.allow-bean-definition-overriding=true" })
 @EnableIntegration
 public class AdminConfigTests {
 
@@ -62,31 +62,41 @@ public class AdminConfigTests {
 
 	@Test
 	public void testDeprecatedAdminConfigurationToMapTopicProperties() {
-		final KafkaConsumerProperties consumerProps = this.binder.getExtendedConsumerProperties("input");
+		final KafkaConsumerProperties consumerProps = this.binder
+				.getExtendedConsumerProperties("input");
 		final KafkaTopicProperties kafkaTopicProperties = consumerProps.getTopic();
 
 		assertThat(kafkaTopicProperties.getReplicationFactor()).isEqualTo((short) 2);
-		assertThat(kafkaTopicProperties.getReplicasAssignments().get(0)).isEqualTo(Arrays.asList(0, 1));
-		assertThat(kafkaTopicProperties.getProperties().get("message.format.version")).isEqualTo("0.9.0.0");
+		assertThat(kafkaTopicProperties.getReplicasAssignments().get(0))
+				.isEqualTo(Arrays.asList(0, 1));
+		assertThat(kafkaTopicProperties.getProperties().get("message.format.version"))
+				.isEqualTo("0.9.0.0");
 	}
 
 	@Test
 	public void testConsumerTopicProperties() {
-		final KafkaConsumerProperties consumerProperties = this.binder.getExtendedConsumerProperties("secondInput");
+		final KafkaConsumerProperties consumerProperties = this.binder
+				.getExtendedConsumerProperties("secondInput");
 		final KafkaTopicProperties kafkaTopicProperties = consumerProperties.getTopic();
 
 		assertThat(kafkaTopicProperties.getReplicationFactor()).isEqualTo((short) 3);
-		assertThat(kafkaTopicProperties.getReplicasAssignments().get(0)).isEqualTo(Arrays.asList(0, 1));
-		assertThat(kafkaTopicProperties.getProperties().get("message.format.version")).isEqualTo("0.9.1.0");
+		assertThat(kafkaTopicProperties.getReplicasAssignments().get(0))
+				.isEqualTo(Arrays.asList(0, 1));
+		assertThat(kafkaTopicProperties.getProperties().get("message.format.version"))
+				.isEqualTo("0.9.1.0");
 	}
 
 	@Test
 	public void testProducerTopicProperties() {
-		final KafkaProducerProperties producerProperties = this.binder.getExtendedProducerProperties("output");
+		final KafkaProducerProperties producerProperties = this.binder
+				.getExtendedProducerProperties("output");
 		final KafkaTopicProperties kafkaTopicProperties = producerProperties.getTopic();
 
 		assertThat(kafkaTopicProperties.getReplicationFactor()).isEqualTo((short) 2);
-		assertThat(kafkaTopicProperties.getReplicasAssignments().get(0)).isEqualTo(Arrays.asList(0, 1));
-		assertThat(kafkaTopicProperties.getProperties().get("message.format.version")).isEqualTo("0.9.0.0");
+		assertThat(kafkaTopicProperties.getReplicasAssignments().get(0))
+				.isEqualTo(Arrays.asList(0, 1));
+		assertThat(kafkaTopicProperties.getProperties().get("message.format.version"))
+				.isEqualTo("0.9.0.0");
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AutoCreateTopicDisabledTests.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AutoCreateTopicDisabledTests.java
index 8537c557e..8733c5499 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AutoCreateTopicDisabledTests.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/AutoCreateTopicDisabledTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -53,61 +53,69 @@ public class AutoCreateTopicDisabledTests {
 			.brokerProperty(KafkaConfig.AutoCreateTopicsEnableProp(), "false");
 
 	@Test
-	public void testAutoCreateTopicDisabledFailsOnConsumerIfTopicNonExistentOnBroker() throws Throwable {
+	public void testAutoCreateTopicDisabledFailsOnConsumerIfTopicNonExistentOnBroker()
+			throws Throwable {
 
 		KafkaProperties kafkaProperties = new TestKafkaProperties();
-		kafkaProperties.setBootstrapServers(Collections.singletonList(embeddedKafka.getEmbeddedKafka().getBrokersAsString()));
-		KafkaBinderConfigurationProperties configurationProperties =
-				new KafkaBinderConfigurationProperties(kafkaProperties);
-		//disable auto create topic on the binder.
+		kafkaProperties.setBootstrapServers(Collections
+				.singletonList(embeddedKafka.getEmbeddedKafka().getBrokersAsString()));
+		KafkaBinderConfigurationProperties configurationProperties = new KafkaBinderConfigurationProperties(
+				kafkaProperties);
+		// disable auto create topic on the binder.
 		configurationProperties.setAutoCreateTopics(false);
 
-		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(configurationProperties, kafkaProperties);
+		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(
+				configurationProperties, kafkaProperties);
 		provisioningProvider.setMetadataRetryOperations(new RetryTemplate());
 
-		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(configurationProperties, provisioningProvider);
+		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(
+				configurationProperties, provisioningProvider);
 
 		final String testTopicName = "nonExistent" + System.currentTimeMillis();
 
-		ExtendedConsumerProperties properties = new ExtendedConsumerProperties<>(new KafkaConsumerProperties());
+		ExtendedConsumerProperties properties = new ExtendedConsumerProperties<>(
+				new KafkaConsumerProperties());
 
 		expectedException.expect(BinderException.class);
-		expectedException
-				.expectCause(isA(UnknownTopicOrPartitionException.class));
+		expectedException.expectCause(isA(UnknownTopicOrPartitionException.class));
 		binder.createConsumerEndpoint(() -> testTopicName, "group", properties);
 	}
 
-
 	@Test
-	public void testAutoCreateTopicDisabledFailsOnProducerIfTopicNonExistentOnBroker() throws Throwable {
+	public void testAutoCreateTopicDisabledFailsOnProducerIfTopicNonExistentOnBroker()
+			throws Throwable {
 
 		KafkaProperties kafkaProperties = new TestKafkaProperties();
-		kafkaProperties.setBootstrapServers(Collections.singletonList(embeddedKafka.getEmbeddedKafka().getBrokersAsString()));
+		kafkaProperties.setBootstrapServers(Collections
+				.singletonList(embeddedKafka.getEmbeddedKafka().getBrokersAsString()));
 
-		KafkaBinderConfigurationProperties configurationProperties =
-				new KafkaBinderConfigurationProperties(kafkaProperties);
-		//disable auto create topic on the binder.
+		KafkaBinderConfigurationProperties configurationProperties = new KafkaBinderConfigurationProperties(
+				kafkaProperties);
+		// disable auto create topic on the binder.
 		configurationProperties.setAutoCreateTopics(false);
-		//reduce the wait time on the producer blocking operations.
+		// reduce the wait time on the producer blocking operations.
 		configurationProperties.getConfiguration().put("max.block.ms", "3000");
 
-		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(configurationProperties, kafkaProperties);
+		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(
+				configurationProperties, kafkaProperties);
 		SimpleRetryPolicy simpleRetryPolicy = new SimpleRetryPolicy(1);
 		final RetryTemplate metadataRetryOperations = new RetryTemplate();
 		metadataRetryOperations.setRetryPolicy(simpleRetryPolicy);
 		provisioningProvider.setMetadataRetryOperations(metadataRetryOperations);
 
-		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(configurationProperties, provisioningProvider);
+		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(
+				configurationProperties, provisioningProvider);
 
 		final String testTopicName = "nonExistent" + System.currentTimeMillis();
 
-		ExtendedProducerProperties properties = new ExtendedProducerProperties<>(new KafkaProducerProperties());
+		ExtendedProducerProperties properties = new ExtendedProducerProperties<>(
+				new KafkaProducerProperties());
 
 		expectedException.expect(BinderException.class);
-		expectedException
-				.expectCause(isA(UnknownTopicOrPartitionException.class));
+		expectedException.expectCause(isA(UnknownTopicOrPartitionException.class));
 
 		binder.bindProducer(testTopicName, new DirectChannel(), properties);
 
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderAutoConfigurationPropertiesTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderAutoConfigurationPropertiesTest.java
index 2043865ad..a7c375c28 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderAutoConfigurationPropertiesTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderAutoConfigurationPropertiesTest.java
@@ -41,16 +41,13 @@ import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.ReflectionUtils;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Ilayaperumal Gopinathan
  */
 @RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = {KafkaBinderConfiguration.class })
+@SpringBootTest(classes = { KafkaBinderConfiguration.class })
 @TestPropertySource(locations = "classpath:binder-config-autoconfig.properties")
 public class KafkaBinderAutoConfigurationPropertiesTest {
 
@@ -63,66 +60,78 @@ public class KafkaBinderAutoConfigurationPropertiesTest {
 	@Test
 	@SuppressWarnings("unchecked")
 	public void testKafkaBinderConfigurationWithKafkaProperties() throws Exception {
-		assertNotNull(this.kafkaMessageChannelBinder);
+		assertThat(this.kafkaMessageChannelBinder).isNotNull();
 		ExtendedProducerProperties producerProperties = new ExtendedProducerProperties<>(
 				new KafkaProducerProperties());
-		Method getProducerFactoryMethod = KafkaMessageChannelBinder.class.getDeclaredMethod("getProducerFactory",
-				String.class, ExtendedProducerProperties.class);
+		Method getProducerFactoryMethod = KafkaMessageChannelBinder.class
+				.getDeclaredMethod("getProducerFactory", String.class,
+						ExtendedProducerProperties.class);
 		getProducerFactoryMethod.setAccessible(true);
 		DefaultKafkaProducerFactory producerFactory = (DefaultKafkaProducerFactory) getProducerFactoryMethod
 				.invoke(this.kafkaMessageChannelBinder, "foo", producerProperties);
-		Field producerFactoryConfigField = ReflectionUtils.findField(DefaultKafkaProducerFactory.class, "configs",
-				Map.class);
+		Field producerFactoryConfigField = ReflectionUtils
+				.findField(DefaultKafkaProducerFactory.class, "configs", Map.class);
 		ReflectionUtils.makeAccessible(producerFactoryConfigField);
-		Map producerConfigs = (Map) ReflectionUtils.getField(producerFactoryConfigField,
-				producerFactory);
-		assertTrue(producerConfigs.get("batch.size").equals(10));
-		assertEquals(producerConfigs.get("key.serializer"), LongSerializer.class);
-		assertNull(producerConfigs.get("key.deserializer"));
-		assertEquals(producerConfigs.get("value.serializer"), LongSerializer.class);
-		assertNull(producerConfigs.get("value.deserializer"));
-		assertEquals("snappy", producerConfigs.get("compression.type"));
+		Map producerConfigs = (Map) ReflectionUtils
+				.getField(producerFactoryConfigField, producerFactory);
+		assertThat(producerConfigs.get("batch.size").equals(10)).isTrue();
+		assertThat(producerConfigs.get("key.serializer")).isEqualTo(LongSerializer.class);
+		assertThat(producerConfigs.get("key.deserializer")).isNull();
+		assertThat(producerConfigs.get("value.serializer"))
+				.isEqualTo(LongSerializer.class);
+		assertThat(producerConfigs.get("value.deserializer")).isNull();
+		assertThat(producerConfigs.get("compression.type")).isEqualTo("snappy");
 		List bootstrapServers = new ArrayList<>();
 		bootstrapServers.add("10.98.09.199:9092");
 		bootstrapServers.add("10.98.09.196:9092");
-		assertTrue((((List) producerConfigs.get("bootstrap.servers")).containsAll(bootstrapServers)));
-		Method createKafkaConsumerFactoryMethod = KafkaMessageChannelBinder.class.getDeclaredMethod(
-				"createKafkaConsumerFactory", boolean.class, String.class, ExtendedConsumerProperties.class);
+		assertThat((((List) producerConfigs.get("bootstrap.servers"))
+				.containsAll(bootstrapServers))).isTrue();
+		Method createKafkaConsumerFactoryMethod = KafkaMessageChannelBinder.class
+				.getDeclaredMethod("createKafkaConsumerFactory", boolean.class,
+						String.class, ExtendedConsumerProperties.class);
 		createKafkaConsumerFactoryMethod.setAccessible(true);
 		ExtendedConsumerProperties consumerProperties = new ExtendedConsumerProperties<>(
 				new KafkaConsumerProperties());
 		DefaultKafkaConsumerFactory consumerFactory = (DefaultKafkaConsumerFactory) createKafkaConsumerFactoryMethod
 				.invoke(this.kafkaMessageChannelBinder, true, "test", consumerProperties);
-		Field consumerFactoryConfigField = ReflectionUtils.findField(DefaultKafkaConsumerFactory.class, "configs",
-				Map.class);
+		Field consumerFactoryConfigField = ReflectionUtils
+				.findField(DefaultKafkaConsumerFactory.class, "configs", Map.class);
 		ReflectionUtils.makeAccessible(consumerFactoryConfigField);
-		Map consumerConfigs = (Map) ReflectionUtils.getField(consumerFactoryConfigField,
-				consumerFactory);
-		assertEquals(consumerConfigs.get("key.deserializer"), LongDeserializer.class);
-		assertNull(consumerConfigs.get("key.serializer"));
-		assertEquals(consumerConfigs.get("value.deserializer"), LongDeserializer.class);
-		assertNull(consumerConfigs.get("value.serialized"));
-		assertEquals("groupIdFromBootConfig", consumerConfigs.get("group.id"));
-		assertEquals("earliest", consumerConfigs.get("auto.offset.reset"));
-		assertTrue((((List) consumerConfigs.get("bootstrap.servers")).containsAll(bootstrapServers)));
+		Map consumerConfigs = (Map) ReflectionUtils
+				.getField(consumerFactoryConfigField, consumerFactory);
+		assertThat(consumerConfigs.get("key.deserializer"))
+				.isEqualTo(LongDeserializer.class);
+		assertThat(consumerConfigs.get("key.serializer")).isNull();
+		assertThat(consumerConfigs.get("value.deserializer"))
+				.isEqualTo(LongDeserializer.class);
+		assertThat(consumerConfigs.get("value.serialized")).isNull();
+		assertThat(consumerConfigs.get("group.id")).isEqualTo("groupIdFromBootConfig");
+		assertThat(consumerConfigs.get("auto.offset.reset")).isEqualTo("earliest");
+		assertThat((((List) consumerConfigs.get("bootstrap.servers"))
+				.containsAll(bootstrapServers))).isTrue();
 	}
 
 	@Test
 	@SuppressWarnings("unchecked")
 	public void testKafkaHealthIndicatorProperties() {
-		assertNotNull(this.kafkaBinderHealthIndicator);
-		Field consumerFactoryField = ReflectionUtils.findField(KafkaBinderHealthIndicator.class, "consumerFactory",
+		assertThat(this.kafkaBinderHealthIndicator).isNotNull();
+		Field consumerFactoryField = ReflectionUtils.findField(
+				KafkaBinderHealthIndicator.class, "consumerFactory",
 				ConsumerFactory.class);
 		ReflectionUtils.makeAccessible(consumerFactoryField);
-		DefaultKafkaConsumerFactory consumerFactory = (DefaultKafkaConsumerFactory) ReflectionUtils.getField(
-				consumerFactoryField, this.kafkaBinderHealthIndicator);
-		Field configField = ReflectionUtils.findField(DefaultKafkaConsumerFactory.class, "configs", Map.class);
+		DefaultKafkaConsumerFactory consumerFactory = (DefaultKafkaConsumerFactory) ReflectionUtils
+				.getField(consumerFactoryField, this.kafkaBinderHealthIndicator);
+		Field configField = ReflectionUtils.findField(DefaultKafkaConsumerFactory.class,
+				"configs", Map.class);
 		ReflectionUtils.makeAccessible(configField);
-		Map configs = (Map) ReflectionUtils.getField(configField, consumerFactory);
-		assertTrue(configs.containsKey("bootstrap.servers"));
+		Map configs = (Map) ReflectionUtils
+				.getField(configField, consumerFactory);
+		assertThat(configs.containsKey("bootstrap.servers")).isTrue();
 		List bootstrapServers = new ArrayList<>();
 		bootstrapServers.add("10.98.09.199:9092");
 		bootstrapServers.add("10.98.09.196:9092");
-		assertTrue(((List) configs.get("bootstrap.servers")).containsAll(bootstrapServers));
+		assertThat(((List) configs.get("bootstrap.servers"))
+				.containsAll(bootstrapServers)).isTrue();
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationPropertiesTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationPropertiesTest.java
index 080c8da21..4212721a2 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationPropertiesTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationPropertiesTest.java
@@ -41,9 +41,7 @@ import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.ReflectionUtils;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Ilayaperumal Gopinathan
@@ -60,46 +58,55 @@ public class KafkaBinderConfigurationPropertiesTest {
 	@Test
 	@SuppressWarnings("unchecked")
 	public void testKafkaBinderConfigurationProperties() throws Exception {
-		assertNotNull(this.kafkaMessageChannelBinder);
+		assertThat(this.kafkaMessageChannelBinder).isNotNull();
 		KafkaProducerProperties kafkaProducerProperties = new KafkaProducerProperties();
 		kafkaProducerProperties.setBufferSize(12345);
 		kafkaProducerProperties.setBatchTimeout(100);
-		kafkaProducerProperties.setCompressionType(KafkaProducerProperties.CompressionType.gzip);
+		kafkaProducerProperties
+				.setCompressionType(KafkaProducerProperties.CompressionType.gzip);
 		ExtendedProducerProperties producerProperties = new ExtendedProducerProperties<>(
 				kafkaProducerProperties);
-		Method getProducerFactoryMethod = KafkaMessageChannelBinder.class.getDeclaredMethod("getProducerFactory",
-				String.class, ExtendedProducerProperties.class);
+		Method getProducerFactoryMethod = KafkaMessageChannelBinder.class
+				.getDeclaredMethod("getProducerFactory", String.class,
+						ExtendedProducerProperties.class);
 		getProducerFactoryMethod.setAccessible(true);
 		DefaultKafkaProducerFactory producerFactory = (DefaultKafkaProducerFactory) getProducerFactoryMethod
 				.invoke(this.kafkaMessageChannelBinder, "bar", producerProperties);
-		Field producerFactoryConfigField = ReflectionUtils.findField(DefaultKafkaProducerFactory.class, "configs",
-				Map.class);
+		Field producerFactoryConfigField = ReflectionUtils
+				.findField(DefaultKafkaProducerFactory.class, "configs", Map.class);
 		ReflectionUtils.makeAccessible(producerFactoryConfigField);
-		Map producerConfigs = (Map) ReflectionUtils.getField(producerFactoryConfigField,
-				producerFactory);
-		assertEquals("12345", producerConfigs.get("batch.size"));;
-		assertEquals("100", producerConfigs.get("linger.ms"));
-		assertEquals(producerConfigs.get("key.serializer"), ByteArraySerializer.class);
-		assertEquals(producerConfigs.get("value.serializer"), ByteArraySerializer.class);
-		assertEquals("gzip", producerConfigs.get("compression.type"));
+		Map producerConfigs = (Map) ReflectionUtils
+				.getField(producerFactoryConfigField, producerFactory);
+		assertThat(producerConfigs.get("batch.size")).isEqualTo("12345");
+		assertThat(producerConfigs.get("linger.ms")).isEqualTo("100");
+		assertThat(producerConfigs.get("key.serializer"))
+				.isEqualTo(ByteArraySerializer.class);
+		assertThat(producerConfigs.get("value.serializer"))
+				.isEqualTo(ByteArraySerializer.class);
+		assertThat(producerConfigs.get("compression.type")).isEqualTo("gzip");
 		List bootstrapServers = new ArrayList<>();
 		bootstrapServers.add("10.98.09.199:9082");
-		assertTrue((((String) producerConfigs.get("bootstrap.servers")).contains("10.98.09.199:9082")));
-		Method createKafkaConsumerFactoryMethod = KafkaMessageChannelBinder.class.getDeclaredMethod(
-				"createKafkaConsumerFactory", boolean.class, String.class, ExtendedConsumerProperties.class);
+		assertThat((((String) producerConfigs.get("bootstrap.servers"))
+				.contains("10.98.09.199:9082"))).isTrue();
+		Method createKafkaConsumerFactoryMethod = KafkaMessageChannelBinder.class
+				.getDeclaredMethod("createKafkaConsumerFactory", boolean.class,
+						String.class, ExtendedConsumerProperties.class);
 		createKafkaConsumerFactoryMethod.setAccessible(true);
 		ExtendedConsumerProperties consumerProperties = new ExtendedConsumerProperties<>(
 				new KafkaConsumerProperties());
 		DefaultKafkaConsumerFactory consumerFactory = (DefaultKafkaConsumerFactory) createKafkaConsumerFactoryMethod
 				.invoke(this.kafkaMessageChannelBinder, true, "test", consumerProperties);
-		Field consumerFactoryConfigField = ReflectionUtils.findField(DefaultKafkaConsumerFactory.class, "configs",
-				Map.class);
+		Field consumerFactoryConfigField = ReflectionUtils
+				.findField(DefaultKafkaConsumerFactory.class, "configs", Map.class);
 		ReflectionUtils.makeAccessible(consumerFactoryConfigField);
-		Map consumerConfigs = (Map) ReflectionUtils.getField(consumerFactoryConfigField,
-				consumerFactory);
-		assertEquals(consumerConfigs.get("key.deserializer"), ByteArrayDeserializer.class);
-		assertEquals(consumerConfigs.get("value.deserializer"), ByteArrayDeserializer.class);
-		assertTrue((((String) consumerConfigs.get("bootstrap.servers")).contains("10.98.09.199:9082")));
+		Map consumerConfigs = (Map) ReflectionUtils
+				.getField(consumerFactoryConfigField, consumerFactory);
+		assertThat(consumerConfigs.get("key.deserializer"))
+				.isEqualTo(ByteArrayDeserializer.class);
+		assertThat(consumerConfigs.get("value.deserializer"))
+				.isEqualTo(ByteArrayDeserializer.class);
+		assertThat((((String) consumerConfigs.get("bootstrap.servers"))
+				.contains("10.98.09.199:9082"))).isTrue();
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationTest.java
index 9a0f633ff..f52bc069f 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderConfigurationTest.java
@@ -29,14 +29,13 @@ import org.springframework.kafka.support.ProducerListener;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.util.ReflectionUtils;
 
-import static org.junit.Assert.assertNotNull;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Ilayaperumal Gopinathan
  */
 @RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = { KafkaBinderConfiguration.class,
-		KafkaAutoConfiguration.class,
+@SpringBootTest(classes = { KafkaBinderConfiguration.class, KafkaAutoConfiguration.class,
 		KafkaBinderConfigurationTest.class })
 public class KafkaBinderConfigurationTest {
 
@@ -45,14 +44,14 @@ public class KafkaBinderConfigurationTest {
 
 	@Test
 	public void testKafkaBinderProducerListener() {
-		assertNotNull(this.kafkaMessageChannelBinder);
+		assertThat(this.kafkaMessageChannelBinder).isNotNull();
 		Field producerListenerField = ReflectionUtils.findField(
 				KafkaMessageChannelBinder.class, "producerListener",
 				ProducerListener.class);
 		ReflectionUtils.makeAccessible(producerListenerField);
-		ProducerListener producerListener = (ProducerListener) ReflectionUtils.getField(
-				producerListenerField, this.kafkaMessageChannelBinder);
-		assertNotNull(producerListener);
+		ProducerListener producerListener = (ProducerListener) ReflectionUtils
+				.getField(producerListenerField, this.kafkaMessageChannelBinder);
+		assertThat(producerListener).isNotNull();
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicatorTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicatorTest.java
index 6fa837c12..70c4b1923 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicatorTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderHealthIndicatorTest.java
@@ -65,7 +65,8 @@ public class KafkaBinderHealthIndicatorTest {
 	@Before
 	public void setup() {
 		MockitoAnnotations.initMocks(this);
-		org.mockito.BDDMockito.given(consumerFactory.createConsumer()).willReturn(consumer);
+		org.mockito.BDDMockito.given(consumerFactory.createConsumer())
+				.willReturn(consumer);
 		org.mockito.BDDMockito.given(binder.getTopicsInUse()).willReturn(topicsInUse);
 		this.indicator = new KafkaBinderHealthIndicator(binder, consumerFactory);
 		this.indicator.setTimeout(10);
@@ -74,27 +75,33 @@ public class KafkaBinderHealthIndicatorTest {
 	@Test
 	public void kafkaBinderIsUp() {
 		final List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation("group1-healthIndicator", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willReturn(partitions);
+		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation(
+				"group1-healthIndicator", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willReturn(partitions);
 		Health health = indicator.health();
 		assertThat(health.getStatus()).isEqualTo(Status.UP);
 	}
 
 	@Test
 	public void kafkaBinderIsUpWithRegexTopic() {
-		topicsInUse.put(REGEX_TOPIC, new KafkaMessageChannelBinder.TopicInformation("regex-healthIndicator", null, true));
+		topicsInUse.put(REGEX_TOPIC, new KafkaMessageChannelBinder.TopicInformation(
+				"regex-healthIndicator", null, true));
 		Health health = indicator.health();
-		//verify no consumer interaction for retrieving partitions
-		org.mockito.BDDMockito.verify(consumer, Mockito.never()).partitionsFor(REGEX_TOPIC);
-		//Ensuring the normal health check returns with status "up"
+		// verify no consumer interaction for retrieving partitions
+		org.mockito.BDDMockito.verify(consumer, Mockito.never())
+				.partitionsFor(REGEX_TOPIC);
+		// Ensuring the normal health check returns with status "up"
 		assertThat(health.getStatus()).isEqualTo(Status.UP);
 	}
 
 	@Test
 	public void kafkaBinderIsDown() {
 		final List partitions = partitions(new Node(-1, null, 0));
-		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation("group2-healthIndicator", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willReturn(partitions);
+		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation(
+				"group2-healthIndicator", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willReturn(partitions);
 		Health health = indicator.health();
 		assertThat(health.getStatus()).isEqualTo(Status.DOWN);
 	}
@@ -102,12 +109,14 @@ public class KafkaBinderHealthIndicatorTest {
 	@Test(timeout = 5000)
 	public void kafkaBinderDoesNotAnswer() {
 		final List partitions = partitions(new Node(-1, null, 0));
-		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation("group3-healthIndicator", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willAnswer(invocation -> {
-			final int fiveMinutes = 1000 * 60 * 5;
-			Thread.sleep(fiveMinutes);
-			return partitions;
-		});
+		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation(
+				"group3-healthIndicator", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willAnswer(invocation -> {
+					final int fiveMinutes = 1000 * 60 * 5;
+					Thread.sleep(fiveMinutes);
+					return partitions;
+				});
 		this.indicator.setTimeout(1);
 		Health health = indicator.health();
 		assertThat(health.getStatus()).isEqualTo(Status.DOWN);
@@ -116,8 +125,10 @@ public class KafkaBinderHealthIndicatorTest {
 	@Test
 	public void createsConsumerOnceWhenInvokedMultipleTimes() {
 		final List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation("group4-healthIndicator", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willReturn(partitions);
+		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation(
+				"group4-healthIndicator", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willReturn(partitions);
 
 		indicator.health();
 		Health health = indicator.health();
@@ -129,10 +140,11 @@ public class KafkaBinderHealthIndicatorTest {
 	@Test
 	public void consumerCreationFailsFirstTime() {
 		final List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation("foo-healthIndicator", partitions, false));
+		topicsInUse.put(TEST_TOPIC, new KafkaMessageChannelBinder.TopicInformation(
+				"foo-healthIndicator", partitions, false));
 
-		org.mockito.BDDMockito.given(consumerFactory.createConsumer()).willThrow(KafkaException.class)
-				.willReturn(consumer);
+		org.mockito.BDDMockito.given(consumerFactory.createConsumer())
+				.willThrow(KafkaException.class).willReturn(consumer);
 
 		Health health = indicator.health();
 		assertThat(health.getStatus()).isEqualTo(Status.DOWN);
@@ -140,7 +152,8 @@ public class KafkaBinderHealthIndicatorTest {
 		health = indicator.health();
 		assertThat(health.getStatus()).isEqualTo(Status.UP);
 
-		org.mockito.Mockito.verify(this.consumerFactory, Mockito.times(2)).createConsumer();
+		org.mockito.Mockito.verify(this.consumerFactory, Mockito.times(2))
+				.createConsumer();
 	}
 
 	@Test
@@ -154,4 +167,5 @@ public class KafkaBinderHealthIndicatorTest {
 		partitions.add(new PartitionInfo(TEST_TOPIC, 0, leader, null, null));
 		return partitions;
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderJaasInitializerListenerTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderJaasInitializerListenerTest.java
index 19e39a456..b331ef7af 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderJaasInitializerListenerTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderJaasInitializerListenerTest.java
@@ -48,7 +48,8 @@ public class KafkaBinderJaasInitializerListenerTest {
 
 	@BeforeClass
 	public static void setup() {
-		System.setProperty(KAFKA_BROKERS_PROPERTY, kafkaEmbedded.getEmbeddedKafka().getBrokersAsString());
+		System.setProperty(KAFKA_BROKERS_PROPERTY,
+				kafkaEmbedded.getEmbeddedKafka().getBrokersAsString());
 	}
 
 	@AfterClass
@@ -58,68 +59,83 @@ public class KafkaBinderJaasInitializerListenerTest {
 
 	@Test
 	@Ignore("CI randomly fails this test, need to investigate further. ")
-	public void testConfigurationParsedCorrectlyWithKafkaClientAndDefaultControlFlag() throws Exception {
-		ConfigFile configFile = new ConfigFile(new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
-		final AppConfigurationEntry[] kafkaConfigurationArray = configFile.getAppConfigurationEntry("KafkaClient");
+	public void testConfigurationParsedCorrectlyWithKafkaClientAndDefaultControlFlag()
+			throws Exception {
+		ConfigFile configFile = new ConfigFile(
+				new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
+		final AppConfigurationEntry[] kafkaConfigurationArray = configFile
+				.getAppConfigurationEntry("KafkaClient");
 
-		final ConfigurableApplicationContext context =
-				SpringApplication.run(SimpleApplication.class,
-						"--spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true",
-						"--spring.cloud.stream.kafka.binder.jaas.options.storeKey=true",
-						"--spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab",
-						"--spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM",
-						"--spring.jmx.enabled=false");
-		javax.security.auth.login.Configuration configuration = javax.security.auth.login.Configuration.getConfiguration();
+		final ConfigurableApplicationContext context = SpringApplication.run(
+				SimpleApplication.class,
+				"--spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true",
+				"--spring.cloud.stream.kafka.binder.jaas.options.storeKey=true",
+				"--spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab",
+				"--spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM",
+				"--spring.jmx.enabled=false");
+		javax.security.auth.login.Configuration configuration = javax.security.auth.login.Configuration
+				.getConfiguration();
 
-		final AppConfigurationEntry[] kafkaConfiguration = configuration.getAppConfigurationEntry("KafkaClient");
+		final AppConfigurationEntry[] kafkaConfiguration = configuration
+				.getAppConfigurationEntry("KafkaClient");
 		assertThat(kafkaConfiguration).hasSize(1);
-		assertThat(kafkaConfiguration[0].getOptions()).isEqualTo(kafkaConfigurationArray[0].getOptions());
-		assertThat(kafkaConfiguration[0].getControlFlag()).isEqualTo(AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
+		assertThat(kafkaConfiguration[0].getOptions())
+				.isEqualTo(kafkaConfigurationArray[0].getOptions());
+		assertThat(kafkaConfiguration[0].getControlFlag())
+				.isEqualTo(AppConfigurationEntry.LoginModuleControlFlag.REQUIRED);
 		context.close();
 	}
 
 	@Test
 	@Ignore("CI randomly fails this test, need to investigate further. ")
-	public void testConfigurationParsedCorrectlyWithKafkaClientAndNonDefaultControlFlag() throws Exception {
-		ConfigFile configFile = new ConfigFile(new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
-		final AppConfigurationEntry[] kafkaConfigurationArray = configFile.getAppConfigurationEntry("KafkaClient");
+	public void testConfigurationParsedCorrectlyWithKafkaClientAndNonDefaultControlFlag()
+			throws Exception {
+		ConfigFile configFile = new ConfigFile(
+				new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
+		final AppConfigurationEntry[] kafkaConfigurationArray = configFile
+				.getAppConfigurationEntry("KafkaClient");
 
-		final ConfigurableApplicationContext context =
-				SpringApplication.run(SimpleApplication.class,
-						"--spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true",
-						"--spring.cloud.stream.kafka.binder.jaas.controlFlag=requisite",
-						"--spring.cloud.stream.kafka.binder.jaas.options.storeKey=true",
-						"--spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab",
-						"--spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM",
-						"--spring.jmx.enabled=false");
-		javax.security.auth.login.Configuration configuration = javax.security.auth.login.Configuration.getConfiguration();
+		final ConfigurableApplicationContext context = SpringApplication.run(
+				SimpleApplication.class,
+				"--spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true",
+				"--spring.cloud.stream.kafka.binder.jaas.controlFlag=requisite",
+				"--spring.cloud.stream.kafka.binder.jaas.options.storeKey=true",
+				"--spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab",
+				"--spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM",
+				"--spring.jmx.enabled=false");
+		javax.security.auth.login.Configuration configuration = javax.security.auth.login.Configuration
+				.getConfiguration();
 
-		final AppConfigurationEntry[] kafkaConfiguration = configuration.getAppConfigurationEntry("KafkaClient");
+		final AppConfigurationEntry[] kafkaConfiguration = configuration
+				.getAppConfigurationEntry("KafkaClient");
 		assertThat(kafkaConfiguration).hasSize(1);
-		assertThat(kafkaConfiguration[0].getOptions()).isEqualTo(kafkaConfigurationArray[0].getOptions());
-		assertThat(kafkaConfiguration[0].getControlFlag()).isEqualTo(AppConfigurationEntry.LoginModuleControlFlag.REQUISITE);
+		assertThat(kafkaConfiguration[0].getOptions())
+				.isEqualTo(kafkaConfigurationArray[0].getOptions());
+		assertThat(kafkaConfiguration[0].getControlFlag())
+				.isEqualTo(AppConfigurationEntry.LoginModuleControlFlag.REQUISITE);
 		context.close();
 	}
 
 	@Test
 	public void testConfigurationWithUnknownControlFlag() throws Exception {
-		ConfigFile configFile = new ConfigFile(new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
+		ConfigFile configFile = new ConfigFile(
+				new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
 
-		assertThatThrownBy(
-				() -> SpringApplication.run(SimpleApplication.class,
-						"--spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true",
-						"--spring.cloud.stream.kafka.binder.jaas.controlFlag=unknown",
-						"--spring.cloud.stream.kafka.binder.jaas.options.storeKey=true",
-						"--spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab",
-						"--spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM",
-						"--spring.jmx.enabled=false"))
-				.isInstanceOf(ConfigurationPropertiesBindException.class)
-				.hasMessageContaining("Error creating bean with name 'configurationProperties'");
+		assertThatThrownBy(() -> SpringApplication.run(SimpleApplication.class,
+				"--spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true",
+				"--spring.cloud.stream.kafka.binder.jaas.controlFlag=unknown",
+				"--spring.cloud.stream.kafka.binder.jaas.options.storeKey=true",
+				"--spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab",
+				"--spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM",
+				"--spring.jmx.enabled=false"))
+						.isInstanceOf(ConfigurationPropertiesBindException.class)
+						.hasMessageContaining(
+								"Error creating bean with name 'configurationProperties'");
 	}
 
-
 	@SpringBootApplication
 	public static class SimpleApplication {
 
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetricsTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetricsTest.java
index f6991d4a1..132e515aa 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetricsTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetricsTest.java
@@ -74,23 +74,33 @@ public class KafkaBinderMetricsTest {
 	@Before
 	public void setup() {
 		MockitoAnnotations.initMocks(this);
-		org.mockito.BDDMockito.given(consumerFactory.createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any())).willReturn(consumer);
+		org.mockito.BDDMockito.given(consumerFactory
+				.createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any()))
+				.willReturn(consumer);
 		org.mockito.BDDMockito.given(binder.getTopicsInUse()).willReturn(topicsInUse);
-		metrics = new KafkaBinderMetrics(binder, kafkaBinderConfigurationProperties, consumerFactory, null);
-		org.mockito.BDDMockito.given(consumer.endOffsets(ArgumentMatchers.anyCollection()))
-				.willReturn(java.util.Collections.singletonMap(new TopicPartition(TEST_TOPIC, 0), 1000L));
+		metrics = new KafkaBinderMetrics(binder, kafkaBinderConfigurationProperties,
+				consumerFactory, null);
+		org.mockito.BDDMockito
+				.given(consumer.endOffsets(ArgumentMatchers.anyCollection()))
+				.willReturn(java.util.Collections
+						.singletonMap(new TopicPartition(TEST_TOPIC, 0), 1000L));
 	}
 
 	@Test
 	public void shouldIndicateLag() {
-		org.mockito.BDDMockito.given(consumer.committed(ArgumentMatchers.any(TopicPartition.class))).willReturn(new OffsetAndMetadata(500));
+		org.mockito.BDDMockito
+				.given(consumer.committed(ArgumentMatchers.any(TopicPartition.class)))
+				.willReturn(new OffsetAndMetadata(500));
 		List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new TopicInformation("group1-metrics", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willReturn(partitions);
+		topicsInUse.put(TEST_TOPIC,
+				new TopicInformation("group1-metrics", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willReturn(partitions);
 		metrics.bindTo(meterRegistry);
 		assertThat(meterRegistry.getMeters()).hasSize(1);
-		assertThat(meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group1-metrics").tag("topic", TEST_TOPIC).gauge()
-				.value()).isEqualTo(500.0);
+		assertThat(meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group1-metrics").tag("topic", TEST_TOPIC).gauge().value())
+						.isEqualTo(500.0);
 	}
 
 	@Test
@@ -98,26 +108,37 @@ public class KafkaBinderMetricsTest {
 		Map endOffsets = new HashMap<>();
 		endOffsets.put(new TopicPartition(TEST_TOPIC, 0), 1000L);
 		endOffsets.put(new TopicPartition(TEST_TOPIC, 1), 1000L);
-		org.mockito.BDDMockito.given(consumer.endOffsets(ArgumentMatchers.anyCollection())).willReturn(endOffsets);
-		org.mockito.BDDMockito.given(consumer.committed(ArgumentMatchers.any(TopicPartition.class))).willReturn(new OffsetAndMetadata(500));
-		List partitions = partitions(new Node(0, null, 0), new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new TopicInformation("group2-metrics", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willReturn(partitions);
+		org.mockito.BDDMockito
+				.given(consumer.endOffsets(ArgumentMatchers.anyCollection()))
+				.willReturn(endOffsets);
+		org.mockito.BDDMockito
+				.given(consumer.committed(ArgumentMatchers.any(TopicPartition.class)))
+				.willReturn(new OffsetAndMetadata(500));
+		List partitions = partitions(new Node(0, null, 0),
+				new Node(0, null, 0));
+		topicsInUse.put(TEST_TOPIC,
+				new TopicInformation("group2-metrics", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willReturn(partitions);
 		metrics.bindTo(meterRegistry);
 		assertThat(meterRegistry.getMeters()).hasSize(1);
-		assertThat(meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group2-metrics").tag("topic", TEST_TOPIC).gauge()
-				.value()).isEqualTo(1000.0);
+		assertThat(meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group2-metrics").tag("topic", TEST_TOPIC).gauge().value())
+						.isEqualTo(1000.0);
 	}
 
 	@Test
 	public void shouldIndicateFullLagForNotCommittedGroups() {
 		List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new TopicInformation("group3-metrics", partitions, false));
-		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC)).willReturn(partitions);
+		topicsInUse.put(TEST_TOPIC,
+				new TopicInformation("group3-metrics", partitions, false));
+		org.mockito.BDDMockito.given(consumer.partitionsFor(TEST_TOPIC))
+				.willReturn(partitions);
 		metrics.bindTo(meterRegistry);
 		assertThat(meterRegistry.getMeters()).hasSize(1);
-		assertThat(meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group3-metrics").tag("topic", TEST_TOPIC).gauge()
-				.value()).isEqualTo(1000.0);
+		assertThat(meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group3-metrics").tag("topic", TEST_TOPIC).gauge().value())
+						.isEqualTo(1000.0);
 	}
 
 	@Test
@@ -131,58 +152,76 @@ public class KafkaBinderMetricsTest {
 	@Test
 	public void createsConsumerOnceWhenInvokedMultipleTimes() {
 		final List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new TopicInformation("group4-metrics", partitions, false));
+		topicsInUse.put(TEST_TOPIC,
+				new TopicInformation("group4-metrics", partitions, false));
 
 		metrics.bindTo(meterRegistry);
 
-		Gauge gauge = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group4-metrics").tag("topic", TEST_TOPIC).gauge();
+		Gauge gauge = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group4-metrics").tag("topic", TEST_TOPIC).gauge();
 		gauge.value();
 		assertThat(gauge.value()).isEqualTo(1000.0);
 
-		org.mockito.Mockito.verify(this.consumerFactory).createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any());
+		org.mockito.Mockito.verify(this.consumerFactory)
+				.createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any());
 	}
 
 	@Test
 	public void consumerCreationFailsFirstTime() {
-		org.mockito.BDDMockito.given(consumerFactory.createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any())).willThrow(KafkaException.class)
-				.willReturn(consumer);
+		org.mockito.BDDMockito
+				.given(consumerFactory.createConsumer(ArgumentMatchers.any(),
+						ArgumentMatchers.any()))
+				.willThrow(KafkaException.class).willReturn(consumer);
 
 		final List partitions = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new TopicInformation("group5-metrics", partitions, false));
+		topicsInUse.put(TEST_TOPIC,
+				new TopicInformation("group5-metrics", partitions, false));
 
 		metrics.bindTo(meterRegistry);
 
-		Gauge gauge = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group5-metrics").tag("topic", TEST_TOPIC).gauge();
+		Gauge gauge = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group5-metrics").tag("topic", TEST_TOPIC).gauge();
 		assertThat(gauge.value()).isEqualTo(0);
 		assertThat(gauge.value()).isEqualTo(1000.0);
 
-		org.mockito.Mockito.verify(this.consumerFactory, Mockito.times(2)).createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any());
+		org.mockito.Mockito.verify(this.consumerFactory, Mockito.times(2))
+				.createConsumer(ArgumentMatchers.any(), ArgumentMatchers.any());
 	}
-	
+
 	@Test
 	public void createOneConsumerPerGroup() {
 		final List partitions1 = partitions(new Node(0, null, 0));
 		final List partitions2 = partitions(new Node(0, null, 0));
-		topicsInUse.put(TEST_TOPIC, new TopicInformation("group1-metrics", partitions1, false));
-		topicsInUse.put("test2", new TopicInformation("group2-metrics", partitions2, false));
+		topicsInUse.put(TEST_TOPIC,
+				new TopicInformation("group1-metrics", partitions1, false));
+		topicsInUse.put("test2",
+				new TopicInformation("group2-metrics", partitions2, false));
 
 		metrics.bindTo(meterRegistry);
-		
-		KafkaConsumer consumer2 = mock(KafkaConsumer.class);
-		org.mockito.BDDMockito.given(consumerFactory.createConsumer(ArgumentMatchers.eq("group2-metrics"), ArgumentMatchers.any()))
-				.willReturn(consumer2);
-		org.mockito.BDDMockito.given(consumer2.endOffsets(ArgumentMatchers.anyCollection()))
-				.willReturn(java.util.Collections.singletonMap(new TopicPartition("test2", 0), 50L));
 
-		Gauge gauge1 = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group1-metrics").tag("topic", TEST_TOPIC).gauge();
-		Gauge gauge2 = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME).tag("group", "group2-metrics").tag("topic", "test2").gauge();
+		KafkaConsumer consumer2 = mock(KafkaConsumer.class);
+		org.mockito.BDDMockito
+				.given(consumerFactory.createConsumer(
+						ArgumentMatchers.eq("group2-metrics"), ArgumentMatchers.any()))
+				.willReturn(consumer2);
+		org.mockito.BDDMockito
+				.given(consumer2.endOffsets(ArgumentMatchers.anyCollection()))
+				.willReturn(java.util.Collections
+						.singletonMap(new TopicPartition("test2", 0), 50L));
+
+		Gauge gauge1 = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group1-metrics").tag("topic", TEST_TOPIC).gauge();
+		Gauge gauge2 = meterRegistry.get(KafkaBinderMetrics.METRIC_NAME)
+				.tag("group", "group2-metrics").tag("topic", "test2").gauge();
 		gauge1.value();
 		gauge2.value();
 		assertThat(gauge1.value()).isEqualTo(1000.0);
 		assertThat(gauge2.value()).isEqualTo(50.0);
 
-		org.mockito.Mockito.verify(this.consumerFactory).createConsumer(ArgumentMatchers.eq("group1-metrics"), ArgumentMatchers.any());
-		org.mockito.Mockito.verify(this.consumerFactory).createConsumer(ArgumentMatchers.eq("group2-metrics"), ArgumentMatchers.any());
+		org.mockito.Mockito.verify(this.consumerFactory).createConsumer(
+				ArgumentMatchers.eq("group1-metrics"), ArgumentMatchers.any());
+		org.mockito.Mockito.verify(this.consumerFactory).createConsumer(
+				ArgumentMatchers.eq("group2-metrics"), ArgumentMatchers.any());
 	}
 
 	private List partitions(Node... nodes) {
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java
index 0fb4a75ac..309967db6 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java
@@ -135,7 +135,6 @@ import org.springframework.util.concurrent.SettableListenableFuture;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.fail;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 
 /**
@@ -145,17 +144,21 @@ import static org.mockito.Mockito.mock;
  * @author Gary Russell
  */
 public class KafkaBinderTests extends
+		// @checkstyle:off
 		PartitionCapableBinderTests, ExtendedProducerProperties> {
 
+	// @checkstyle:on
 	private static final int DEFAULT_OPERATION_TIMEOUT = 30;
 
 	@Rule
 	public ExpectedException expectedProvisioningException = ExpectedException.none();
 
-	private final String CLASS_UNDER_TEST_NAME = KafkaMessageChannelBinder.class.getSimpleName();
+	private final String CLASS_UNDER_TEST_NAME = KafkaMessageChannelBinder.class
+			.getSimpleName();
 
 	@ClassRule
-	public static EmbeddedKafkaRule embeddedKafka = new EmbeddedKafkaRule(1, true, 10, "error.pollableDlq.group-pcWithDlq");
+	public static EmbeddedKafkaRule embeddedKafka = new EmbeddedKafkaRule(1, true, 10,
+			"error.pollableDlq.group-pcWithDlq");
 
 	private KafkaTestBinder binder;
 
@@ -188,7 +191,8 @@ public class KafkaBinderTests extends
 	protected KafkaTestBinder getBinder() {
 		if (binder == null) {
 			KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
-			KafkaTopicProvisioner kafkaTopicProvisioner = new KafkaTopicProvisioner(binderConfiguration, new TestKafkaProperties());
+			KafkaTopicProvisioner kafkaTopicProvisioner = new KafkaTopicProvisioner(
+					binderConfiguration, new TestKafkaProperties());
 			try {
 				kafkaTopicProvisioner.afterPropertiesSet();
 			}
@@ -200,22 +204,25 @@ public class KafkaBinderTests extends
 		return binder;
 	}
 
-	private Binder getBinder(KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties) {
-		KafkaTopicProvisioner provisioningProvider =
-				new KafkaTopicProvisioner(kafkaBinderConfigurationProperties, new TestKafkaProperties());
+	private Binder getBinder(
+			KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties) {
+		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(
+				kafkaBinderConfigurationProperties, new TestKafkaProperties());
 		try {
 			provisioningProvider.afterPropertiesSet();
 		}
 		catch (Exception e) {
 			throw new RuntimeException(e);
 		}
-		return new KafkaTestBinder(kafkaBinderConfigurationProperties, provisioningProvider);
+		return new KafkaTestBinder(kafkaBinderConfigurationProperties,
+				provisioningProvider);
 	}
 
 	private KafkaBinderConfigurationProperties createConfigurationProperties() {
 		KafkaBinderConfigurationProperties binderConfiguration = new KafkaBinderConfigurationProperties(
 				new TestKafkaProperties());
-		BrokerAddress[] brokerAddresses = embeddedKafka.getEmbeddedKafka().getBrokerAddresses();
+		BrokerAddress[] brokerAddresses = embeddedKafka.getEmbeddedKafka()
+				.getBrokerAddresses();
 		List bAddresses = new ArrayList<>();
 		for (BrokerAddress bAddress : brokerAddresses) {
 			bAddresses.add(bAddress.toString());
@@ -229,11 +236,12 @@ public class KafkaBinderTests extends
 		return consumerFactory().createConsumer().partitionsFor(topic).size();
 	}
 
-	private void invokeCreateTopic(String topic, int partitions, int replicationFactor) throws Exception {
+	private void invokeCreateTopic(String topic, int partitions, int replicationFactor)
+			throws Exception {
 
-		NewTopic newTopic = new NewTopic(topic, partitions,
-				(short) replicationFactor);
-		CreateTopicsResult topics = adminClient.createTopics(Collections.singletonList(newTopic));
+		NewTopic newTopic = new NewTopic(topic, partitions, (short) replicationFactor);
+		CreateTopicsResult topics = adminClient
+				.createTopics(Collections.singletonList(newTopic));
 		topics.all().get(DEFAULT_OPERATION_TIMEOUT, TimeUnit.SECONDS);
 	}
 
@@ -248,7 +256,8 @@ public class KafkaBinderTests extends
 			timeoutMultiplier = Double.parseDouble(multiplier);
 		}
 
-		BrokerAddress[] brokerAddresses = embeddedKafka.getEmbeddedKafka().getBrokerAddresses();
+		BrokerAddress[] brokerAddresses = embeddedKafka.getEmbeddedKafka()
+				.getBrokerAddresses();
 		List bAddresses = new ArrayList<>();
 		for (BrokerAddress bAddress : brokerAddresses) {
 			bAddresses.add(bAddress.toString());
@@ -256,15 +265,18 @@ public class KafkaBinderTests extends
 		String[] foo = new String[bAddresses.size()];
 
 		Map adminConfigs = new HashMap<>();
-		adminConfigs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bAddresses.toArray(foo)[0]);
+		adminConfigs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
+				bAddresses.toArray(foo)[0]);
 		adminClient = AdminClient.create(adminConfigs);
 	}
 
 	private int invokePartitionSize(String topic) throws Throwable {
 
-		DescribeTopicsResult describeTopicsResult = adminClient.describeTopics(Collections.singletonList(topic));
+		DescribeTopicsResult describeTopicsResult = adminClient
+				.describeTopics(Collections.singletonList(topic));
 		KafkaFuture> all = describeTopicsResult.all();
-		Map stringTopicDescriptionMap = all.get(DEFAULT_OPERATION_TIMEOUT, TimeUnit.SECONDS);
+		Map stringTopicDescriptionMap = all
+				.get(DEFAULT_OPERATION_TIMEOUT, TimeUnit.SECONDS);
 		TopicDescription topicDescription = stringTopicDescriptionMap.get(topic);
 		return topicDescription.partitions().size();
 	}
@@ -287,7 +299,8 @@ public class KafkaBinderTests extends
 	private ConsumerFactory consumerFactory() {
 		Map props = new HashMap<>();
 		KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
-		props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, configurationProperties.getKafkaConnectionString());
+		props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
+				configurationProperties.getKafkaConnectionString());
 		props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false);
 		props.put(ConsumerConfig.GROUP_ID_CONFIG, "TEST-CONSUMER-GROUP");
 		Deserializer valueDecoder = new ByteArrayDeserializer();
@@ -296,30 +309,35 @@ public class KafkaBinderTests extends
 		return new DefaultKafkaConsumerFactory<>(props, keyDecoder, valueDecoder);
 	}
 
-	@SuppressWarnings({"rawtypes", "unchecked"})
+	@SuppressWarnings({ "rawtypes", "unchecked" })
 	@Test
 	public void testTrustedPackages() throws Exception {
 		Binder binder = getBinder();
 
-		BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties());
-		DirectChannel moduleOutputChannel = createBindableChannel("output", producerBindingProperties);
+		BindingProperties producerBindingProperties = createProducerBindingProperties(
+				createProducerProperties());
+		DirectChannel moduleOutputChannel = createBindableChannel("output",
+				producerBindingProperties);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		consumerProperties.getExtension().setTrustedPackages(new String[]{"org.springframework.util"});
+		consumerProperties.getExtension()
+				.setTrustedPackages(new String[] { "org.springframework.util" });
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
-		Binding producerBinding = binder.bindProducer("bar.0", moduleOutputChannel,
-				producerBindingProperties.getProducer());
+		Binding producerBinding = binder.bindProducer("bar.0",
+				moduleOutputChannel, producerBindingProperties.getProducer());
 
 		Binding consumerBinding = binder.bindConsumer("bar.0",
-				"testSendAndReceiveNoOriginalContentType", moduleInputChannel, consumerProperties);
+				"testSendAndReceiveNoOriginalContentType", moduleInputChannel,
+				consumerProperties);
 		binderBindUnbindLatency();
 
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload("foo")
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload("foo")
 				.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN)
-				.setHeader("foo", MimeTypeUtils.TEXT_PLAIN)
-				.build();
+				.setHeader("foo", MimeTypeUtils.TEXT_PLAIN).build();
 
 		moduleOutputChannel.send(message);
 		CountDownLatch latch = new CountDownLatch(1);
@@ -334,13 +352,17 @@ public class KafkaBinderTests extends
 		});
 		Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
 
-
 		Assertions.assertThat(inboundMessageRef.get()).isNotNull();
-		Assertions.assertThat(inboundMessageRef.get().getPayload()).isEqualTo("foo".getBytes());
-		Assertions.assertThat(inboundMessageRef.get().getHeaders().get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull();
-		Assertions.assertThat(inboundMessageRef.get().getHeaders().get(MessageHeaders.CONTENT_TYPE))
+		Assertions.assertThat(inboundMessageRef.get().getPayload())
+				.isEqualTo("foo".getBytes());
+		Assertions.assertThat(inboundMessageRef.get().getHeaders()
+				.get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull();
+		Assertions
+				.assertThat(inboundMessageRef.get().getHeaders()
+						.get(MessageHeaders.CONTENT_TYPE))
 				.isEqualTo(MimeTypeUtils.TEXT_PLAIN);
-		Assertions.assertThat(inboundMessageRef.get().getHeaders().get("foo")).isInstanceOf(String.class);
+		Assertions.assertThat(inboundMessageRef.get().getHeaders().get("foo"))
+				.isInstanceOf(String.class);
 		String actual = (String) inboundMessageRef.get().getHeaders().get("foo");
 		Assertions.assertThat(actual).isEqualTo(MimeTypeUtils.TEXT_PLAIN.toString());
 		producerBinding.unbind();
@@ -358,19 +380,23 @@ public class KafkaBinderTests extends
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
 				producerBindingProperties);
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 		Binding producerBinding = binder.bindProducer("bar.0",
 				moduleOutputChannel, producerBindingProperties.getProducer());
 
-		consumerProperties.getExtension().setTrustedPackages(new String[]{"org.springframework.util"});
+		consumerProperties.getExtension()
+				.setTrustedPackages(new String[] { "org.springframework.util" });
 		Binding consumerBinding = binder.bindConsumer("bar.0",
 				"testSendAndReceiveNoOriginalContentType", moduleInputChannel,
 				consumerProperties);
 		binderBindUnbindLatency();
 
-		//TODO: Will have to fix the MimeType to convert to byte array once this issue has been resolved:
-		//https://github.com/spring-projects/spring-kafka/issues/424
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload("foo")
+		// TODO: Will have to fix the MimeType to convert to byte array once this issue
+		// has been resolved:
+		// https://github.com/spring-projects/spring-kafka/issues/424
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload("foo")
 				.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN).build();
 		moduleOutputChannel.send(message);
 		CountDownLatch latch = new CountDownLatch(1);
@@ -403,13 +429,15 @@ public class KafkaBinderTests extends
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
 				outputBindingProperties);
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		Binding producerBinding = binder.bindProducer("foo.bar",
 				moduleOutputChannel, outputBindingProperties.getProducer());
 		Binding consumerBinding = binder.bindConsumer("foo.bar",
 				"testSendAndReceive", moduleInputChannel, consumerProperties);
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload("foo".getBytes(StandardCharsets.UTF_8))
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload("foo".getBytes(StandardCharsets.UTF_8))
 				.setHeader(MessageHeaders.CONTENT_TYPE,
 						MimeTypeUtils.APPLICATION_OCTET_STREAM)
 				.build();
@@ -430,11 +458,14 @@ public class KafkaBinderTests extends
 		Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
 
 		assertThat(inboundMessageRef.get()).isNotNull();
-		assertThat(new String(inboundMessageRef.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo("foo");
+		assertThat(
+				new String(inboundMessageRef.get().getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo("foo");
 		assertThat(inboundMessageRef.get().getHeaders().get(MessageHeaders.CONTENT_TYPE))
 				.isEqualTo(MimeTypeUtils.APPLICATION_OCTET_STREAM);
 
-		Map topicsInUse = ((KafkaTestBinder)binder).getCoreBinder().getTopicsInUse();
+		Map topicsInUse = ((KafkaTestBinder) binder)
+				.getCoreBinder().getTopicsInUse();
 		assertThat(topicsInUse.keySet()).contains("foo.bar");
 		TopicInformation topic = topicsInUse.get("foo.bar");
 		assertThat(topic.isConsumerTopic()).isTrue();
@@ -450,10 +481,11 @@ public class KafkaBinderTests extends
 		Binder binder = getBinder();
 		ExtendedProducerProperties producerProperties = createProducerProperties();
 
-		//Native serialization for producer
+		// Native serialization for producer
 		producerProperties.setUseNativeEncoding(true);
 		Map producerConfig = new HashMap<>();
-		producerConfig.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
+		producerConfig.put("value.serializer",
+				"org.apache.kafka.common.serialization.StringSerializer");
 		producerProperties.getExtension().setConfiguration(producerConfig);
 
 		BindingProperties outputBindingProperties = createProducerBindingProperties(
@@ -463,17 +495,20 @@ public class KafkaBinderTests extends
 				outputBindingProperties);
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
-		//Native Deserialization for consumer
+		// Native Deserialization for consumer
 		consumerProperties.setUseNativeDecoding(true);
 		Map consumerConfig = new HashMap<>();
-		consumerConfig.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
+		consumerConfig.put("value.deserializer",
+				"org.apache.kafka.common.serialization.StringDeserializer");
 		consumerProperties.getExtension().setConfiguration(consumerConfig);
 
-		//Setting dlq producer properties on the consumer
-		consumerProperties.getExtension().setDlqProducerProperties(producerProperties.getExtension());
+		// Setting dlq producer properties on the consumer
+		consumerProperties.getExtension()
+				.setDlqProducerProperties(producerProperties.getExtension());
 		consumerProperties.getExtension().setEnableDlq(true);
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		Binding producerBinding = binder.bindProducer("foo.bar",
 				moduleOutputChannel, outputBindingProperties.getProducer());
@@ -486,30 +521,34 @@ public class KafkaBinderTests extends
 		FailingInvocationCountingMessageHandler handler = new FailingInvocationCountingMessageHandler();
 		moduleInputChannel.subscribe(handler);
 
-		//Consumer for the DLQ destination
+		// Consumer for the DLQ destination
 		QueueChannel dlqChannel = new QueueChannel();
 		ExtendedConsumerProperties dlqConsumerProperties = createConsumerProperties();
 		dlqConsumerProperties.setMaxAttempts(1);
 
 		Binding dlqConsumerBinding = binder.bindConsumer(
-				"error.foo.bar." + "testDlqWithNativeEncoding-1", null, dlqChannel, dlqConsumerProperties);
+				"error.foo.bar." + "testDlqWithNativeEncoding-1", null, dlqChannel,
+				dlqConsumerProperties);
 		binderBindUnbindLatency();
 
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload("foo")
-				.build();
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload("foo").build();
 
 		moduleOutputChannel.send(message);
 
 		Message receivedMessage = receive(dlqChannel, 5);
 		assertThat(receivedMessage).isNotNull();
 		assertThat(receivedMessage.getPayload()).isEqualTo("foo".getBytes());
-		assertThat(handler.getInvocationCount()).isEqualTo(consumerProperties.getMaxAttempts());
-		assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC))
-				.isEqualTo("foo.bar".getBytes(StandardCharsets.UTF_8));
-		assertThat(new String((byte[]) receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_MESSAGE)))
-				.startsWith("Dispatcher failed to deliver Message; nested exception is java.lang.RuntimeException: fail");
-		assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_STACKTRACE))
-				.isNotNull();
+		assertThat(handler.getInvocationCount())
+				.isEqualTo(consumerProperties.getMaxAttempts());
+		assertThat(receivedMessage.getHeaders()
+				.get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC))
+						.isEqualTo("foo.bar".getBytes(StandardCharsets.UTF_8));
+		assertThat(new String((byte[]) receivedMessage.getHeaders()
+				.get(KafkaMessageChannelBinder.X_EXCEPTION_MESSAGE))).startsWith(
+						"Dispatcher failed to deliver Message; nested exception is java.lang.RuntimeException: fail");
+		assertThat(receivedMessage.getHeaders()
+				.get(KafkaMessageChannelBinder.X_EXCEPTION_STACKTRACE)).isNotNull();
 		binderBindUnbindLatency();
 
 		dlqConsumerBinding.unbind();
@@ -520,13 +559,15 @@ public class KafkaBinderTests extends
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testDlqWithNativeDecodingOnConsumerButMissingSerializerOnDlqProducer() throws Exception {
+	public void testDlqWithNativeDecodingOnConsumerButMissingSerializerOnDlqProducer()
+			throws Exception {
 		Binder binder = getBinder();
 		ExtendedProducerProperties producerProperties = createProducerProperties();
-		//Native serialization for producer
+		// Native serialization for producer
 		producerProperties.setUseNativeEncoding(true);
 		Map producerConfig = new HashMap<>();
-		producerConfig.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
+		producerConfig.put("value.serializer",
+				"org.apache.kafka.common.serialization.StringSerializer");
 		producerProperties.getExtension().setConfiguration(producerConfig);
 		BindingProperties outputBindingProperties = createProducerBindingProperties(
 				producerProperties);
@@ -534,18 +575,21 @@ public class KafkaBinderTests extends
 				outputBindingProperties);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		//Native Deserialization for consumer
+		// Native Deserialization for consumer
 		consumerProperties.setUseNativeDecoding(true);
 
 		Map consumerConfig = new HashMap<>();
-		consumerConfig.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
+		consumerConfig.put("value.deserializer",
+				"org.apache.kafka.common.serialization.StringDeserializer");
 
-		//No Dlq producer properties set on the consumer with a native serializer. This should cause an error for DLQ sending.
+		// No Dlq producer properties set on the consumer with a native serializer.
+		// This should cause an error for DLQ sending.
 
 		consumerProperties.getExtension().setConfiguration(consumerConfig);
 		consumerProperties.getExtension().setEnableDlq(true);
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		Binding producerBinding = binder.bindProducer("foo.bar",
 				moduleOutputChannel, outputBindingProperties.getProducer());
@@ -558,23 +602,25 @@ public class KafkaBinderTests extends
 		FailingInvocationCountingMessageHandler handler = new FailingInvocationCountingMessageHandler();
 		moduleInputChannel.subscribe(handler);
 
-		//Consumer for the DLQ destination
+		// Consumer for the DLQ destination
 		QueueChannel dlqChannel = new QueueChannel();
 		ExtendedConsumerProperties dlqConsumerProperties = createConsumerProperties();
 		dlqConsumerProperties.setMaxAttempts(1);
 
 		Binding dlqConsumerBinding = binder.bindConsumer(
-				"error.foo.bar." + "testDlqWithNativeEncoding-2", null, dlqChannel, dlqConsumerProperties);
+				"error.foo.bar." + "testDlqWithNativeEncoding-2", null, dlqChannel,
+				dlqConsumerProperties);
 		binderBindUnbindLatency();
 
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload("foo")
-				.build();
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload("foo").build();
 
 		moduleOutputChannel.send(message);
 
 		Message receivedMessage = dlqChannel.receive(5000);
-		//Ensure that we didn't receive anything on DLQ because of serializer config missing
-		//on dlq producer while native Decoding is enabled.
+		// Ensure that we didn't receive anything on DLQ because of serializer config
+		// missing
+		// on dlq producer while native Decoding is enabled.
 		assertThat(receivedMessage).isNull();
 
 		binderBindUnbindLatency();
@@ -609,7 +655,8 @@ public class KafkaBinderTests extends
 		AbstractKafkaTestBinder binder = getBinder();
 
 		ExtendedProducerProperties producerProperties = createProducerProperties();
-		producerProperties.getExtension().setHeaderPatterns(new String[]{MessageHeaders.CONTENT_TYPE});
+		producerProperties.getExtension()
+				.setHeaderPatterns(new String[] { MessageHeaders.CONTENT_TYPE });
 		producerProperties.setHeaderMode(headerMode);
 
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
@@ -624,7 +671,8 @@ public class KafkaBinderTests extends
 		consumerProperties.setHeaderMode(headerMode);
 		consumerProperties.setMultiplex(true);
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		QueueChannel dlqChannel = new QueueChannel();
 		FailingInvocationCountingMessageHandler handler = new FailingInvocationCountingMessageHandler();
@@ -641,91 +689,114 @@ public class KafkaBinderTests extends
 
 		MessageListenerContainer container = TestUtils.getPropertyValue(consumerBinding,
 				"lifecycle.messageListenerContainer", MessageListenerContainer.class);
-		assertThat(container.getContainerProperties().getTopicPartitions().length).isEqualTo(2);
+		assertThat(container.getContainerProperties().getTopicPartitions().length)
+				.isEqualTo(2);
 
 		ExtendedConsumerProperties dlqConsumerProperties = createConsumerProperties();
 		dlqConsumerProperties.setMaxAttempts(1);
 		dlqConsumerProperties.setHeaderMode(headerMode);
 
-		ApplicationContext context = TestUtils.getPropertyValue(binder.getBinder(), "applicationContext",
-				ApplicationContext.class);
+		ApplicationContext context = TestUtils.getPropertyValue(binder.getBinder(),
+				"applicationContext", ApplicationContext.class);
 		SubscribableChannel boundErrorChannel = context
 				.getBean(consumerDest + ".testGroup.errors-0", SubscribableChannel.class);
-		SubscribableChannel globalErrorChannel = context.getBean("errorChannel", SubscribableChannel.class);
+		SubscribableChannel globalErrorChannel = context.getBean("errorChannel",
+				SubscribableChannel.class);
 		final AtomicReference> boundErrorChannelMessage = new AtomicReference<>();
 		final AtomicReference> globalErrorChannelMessage = new AtomicReference<>();
 		final AtomicBoolean hasRecovererInCallStack = new AtomicBoolean(!withRetry);
 		boundErrorChannel.subscribe(message -> {
 			boundErrorChannelMessage.set(message);
 			String stackTrace = Arrays.toString(new RuntimeException().getStackTrace());
-			hasRecovererInCallStack.set(stackTrace.contains("ErrorMessageSendingRecoverer"));
+			hasRecovererInCallStack
+					.set(stackTrace.contains("ErrorMessageSendingRecoverer"));
 		});
 		globalErrorChannel.subscribe(globalErrorChannelMessage::set);
 
 		Binding dlqConsumerBinding = binder.bindConsumer(
-				"error.dlqTest." + uniqueBindingId + ".0.testGroup", null, dlqChannel, dlqConsumerProperties);
+				"error.dlqTest." + uniqueBindingId + ".0.testGroup", null, dlqChannel,
+				dlqConsumerProperties);
 		binderBindUnbindLatency();
 		String testMessagePayload = "test." + UUID.randomUUID().toString();
-		Message testMessage = MessageBuilder.withPayload(testMessagePayload.getBytes()).build();
+		Message testMessage = MessageBuilder
+				.withPayload(testMessagePayload.getBytes()).build();
 		moduleOutputChannel.send(testMessage);
 
 		Message receivedMessage = receive(dlqChannel, 3);
 		assertThat(receivedMessage).isNotNull();
 		assertThat(receivedMessage.getPayload()).isEqualTo(testMessagePayload.getBytes());
 		if (HeaderMode.embeddedHeaders.equals(headerMode)) {
-			assertThat(handler.getInvocationCount()).isEqualTo(consumerProperties.getMaxAttempts());
+			assertThat(handler.getInvocationCount())
+					.isEqualTo(consumerProperties.getMaxAttempts());
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC))
-					.isEqualTo(producerName);
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC))
+							.isEqualTo(producerName);
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_PARTITION)).isEqualTo(0);
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_PARTITION)).isEqualTo(0);
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_OFFSET))
-					.isEqualTo(0);
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_OFFSET)).isEqualTo(0);
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP)).isNotNull();
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP)).isNotNull();
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP_TYPE))
-					.isEqualTo(TimestampType.CREATE_TIME.toString());
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP_TYPE))
+							.isEqualTo(TimestampType.CREATE_TIME.toString());
 
-			assertThat(((String) receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_MESSAGE)))
-					.startsWith("Dispatcher failed to deliver Message; nested exception is java.lang.RuntimeException: fail");
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_STACKTRACE))
-					.isNotNull();
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_FQCN)).isNotNull();
+			assertThat(((String) receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_EXCEPTION_MESSAGE))).startsWith(
+							"Dispatcher failed to deliver Message; nested exception "
+									+ "is java.lang.RuntimeException: fail");
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_EXCEPTION_STACKTRACE)).isNotNull();
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_EXCEPTION_FQCN)).isNotNull();
 		}
 		else if (!HeaderMode.none.equals(headerMode)) {
-			assertThat(handler.getInvocationCount()).isEqualTo(consumerProperties.getMaxAttempts());
+			assertThat(handler.getInvocationCount())
+					.isEqualTo(consumerProperties.getMaxAttempts());
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC))
-					.isEqualTo(producerName.getBytes(StandardCharsets.UTF_8));
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC))
+							.isEqualTo(producerName.getBytes(StandardCharsets.UTF_8));
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_PARTITION))
-					.isEqualTo(ByteBuffer.allocate(Integer.BYTES).putInt(0).array());
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_PARTITION)).isEqualTo(
+							ByteBuffer.allocate(Integer.BYTES).putInt(0).array());
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_OFFSET))
-					.isEqualTo(ByteBuffer.allocate(Long.BYTES).putLong(0).array());
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_OFFSET)).isEqualTo(
+							ByteBuffer.allocate(Long.BYTES).putLong(0).array());
 
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP)).isNotNull();
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP)).isNotNull();
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP_TYPE))
+							.isEqualTo(TimestampType.CREATE_TIME.toString().getBytes());
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TIMESTAMP_TYPE))
-					.isEqualTo(TimestampType.CREATE_TIME.toString().getBytes());
+			assertThat(new String((byte[]) receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_EXCEPTION_MESSAGE))).startsWith(
+							"Dispatcher failed to deliver Message; nested exception "
+									+ "is java.lang.RuntimeException: fail");
 
-			assertThat(new String((byte[]) receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_MESSAGE)))
-					.startsWith("Dispatcher failed to deliver Message; nested exception is java.lang.RuntimeException: fail");
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_EXCEPTION_STACKTRACE)).isNotNull();
 
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_STACKTRACE))
-					.isNotNull();
-
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_EXCEPTION_FQCN)).isNotNull();
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_EXCEPTION_FQCN)).isNotNull();
 		}
 		else {
-			assertThat(receivedMessage.getHeaders().get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC)).isNull();
+			assertThat(receivedMessage.getHeaders()
+					.get(KafkaMessageChannelBinder.X_ORIGINAL_TOPIC)).isNull();
 		}
 		binderBindUnbindLatency();
 
-		// verify we got a message on the dedicated error channel and the global (via bridge)
+		// verify we got a message on the dedicated error channel and the global (via
+		// bridge)
 		assertThat(boundErrorChannelMessage.get()).isNotNull();
 		assertThat(globalErrorChannelMessage.get()).isNotNull();
 		assertThat(hasRecovererInCallStack.get()).isEqualTo(withRetry);
@@ -753,37 +824,47 @@ public class KafkaBinderTests extends
 		consumerProperties.setBackOffMaxInterval(150);
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		FailingInvocationCountingMessageHandler handler = new FailingInvocationCountingMessageHandler();
 		moduleInputChannel.subscribe(handler);
 
 		long uniqueBindingId = System.currentTimeMillis();
-		Binding producerBinding = binder.bindProducer("retryTest." + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0",
-				"testGroup", moduleInputChannel, consumerProperties);
+		Binding producerBinding = binder.bindProducer(
+				"retryTest." + uniqueBindingId + ".0", moduleOutputChannel,
+				producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"retryTest." + uniqueBindingId + ".0", "testGroup", moduleInputChannel,
+				consumerProperties);
 
 		String testMessagePayload = "test." + UUID.randomUUID().toString();
-		Message testMessage = MessageBuilder.withPayload(testMessagePayload.getBytes()).build();
+		Message testMessage = MessageBuilder
+				.withPayload(testMessagePayload.getBytes()).build();
 		moduleOutputChannel.send(testMessage);
 
-		assertThat(handler.getLatch().await((int) (timeoutMultiplier * 1000), TimeUnit.MILLISECONDS));
+		assertThat(handler.getLatch().await((int) (timeoutMultiplier * 1000),
+				TimeUnit.MILLISECONDS));
 		// first attempt fails
 		assertThat(handler.getReceivedMessages().entrySet()).hasSize(1);
-		Message receivedMessage = handler.getReceivedMessages().entrySet().iterator().next().getValue();
+		Message receivedMessage = handler.getReceivedMessages().entrySet().iterator()
+				.next().getValue();
 		assertThat(receivedMessage).isNotNull();
-		assertThat(new String((byte[])receivedMessage.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testMessagePayload);
-		assertThat(handler.getInvocationCount()).isEqualTo(consumerProperties.getMaxAttempts());
+		assertThat(
+				new String((byte[]) receivedMessage.getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo(testMessagePayload);
+		assertThat(handler.getInvocationCount())
+				.isEqualTo(consumerProperties.getMaxAttempts());
 		consumerBinding.unbind();
 
 		// on the second attempt the message is redelivered
 		QueueChannel successfulInputChannel = new QueueChannel();
-		consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0", "testGroup",
-				successfulInputChannel, consumerProperties);
+		consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0",
+				"testGroup", successfulInputChannel, consumerProperties);
 		binderBindUnbindLatency();
 		String testMessage2Payload = "test." + UUID.randomUUID().toString();
-		Message testMessage2 = MessageBuilder.withPayload(testMessage2Payload.getBytes()).build();
+		Message testMessage2 = MessageBuilder
+				.withPayload(testMessage2Payload.getBytes()).build();
 		moduleOutputChannel.send(testMessage2);
 
 		Message firstReceived = receive(successfulInputChannel);
@@ -812,23 +893,28 @@ public class KafkaBinderTests extends
 		consumerProperties.getExtension().setEnableDlq(true);
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		FailingInvocationCountingMessageHandler handler = new FailingInvocationCountingMessageHandler();
 		moduleInputChannel.subscribe(handler);
 		long uniqueBindingId = System.currentTimeMillis();
-		Binding producerBinding = binder.bindProducer("retryTest." + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0",
-				"testGroup", moduleInputChannel, consumerProperties);
+		Binding producerBinding = binder.bindProducer(
+				"retryTest." + uniqueBindingId + ".0", moduleOutputChannel,
+				producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"retryTest." + uniqueBindingId + ".0", "testGroup", moduleInputChannel,
+				consumerProperties);
 		ExtendedConsumerProperties dlqConsumerProperties = createConsumerProperties();
 		dlqConsumerProperties.setMaxAttempts(1);
 		QueueChannel dlqChannel = new QueueChannel();
 		Binding dlqConsumerBinding = binder.bindConsumer(
-				"error.retryTest." + uniqueBindingId + ".0.testGroup", null, dlqChannel, dlqConsumerProperties);
+				"error.retryTest." + uniqueBindingId + ".0.testGroup", null, dlqChannel,
+				dlqConsumerProperties);
 
 		String testMessagePayload = "test." + UUID.randomUUID().toString();
-		Message testMessage = MessageBuilder.withPayload(testMessagePayload.getBytes()).build();
+		Message testMessage = MessageBuilder
+				.withPayload(testMessagePayload.getBytes()).build();
 		moduleOutputChannel.send(testMessage);
 
 		Message dlqMessage = receive(dlqChannel, 3);
@@ -837,24 +923,30 @@ public class KafkaBinderTests extends
 
 		// first attempt fails
 		assertThat(handler.getReceivedMessages().entrySet()).hasSize(1);
-		Message handledMessage = handler.getReceivedMessages().entrySet().iterator().next().getValue();
+		Message handledMessage = handler.getReceivedMessages().entrySet().iterator()
+				.next().getValue();
 		assertThat(handledMessage).isNotNull();
-		assertThat(new String((byte[])handledMessage.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testMessagePayload);
-		assertThat(handler.getInvocationCount()).isEqualTo(consumerProperties.getMaxAttempts());
+		assertThat(
+				new String((byte[]) handledMessage.getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo(testMessagePayload);
+		assertThat(handler.getInvocationCount())
+				.isEqualTo(consumerProperties.getMaxAttempts());
 		binderBindUnbindLatency();
 		dlqConsumerBinding.unbind();
 		consumerBinding.unbind();
 
 		// on the second attempt the message is not redelivered because the DLQ is set
 		QueueChannel successfulInputChannel = new QueueChannel();
-		consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0", "testGroup",
-				successfulInputChannel, consumerProperties);
+		consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0",
+				"testGroup", successfulInputChannel, consumerProperties);
 		String testMessage2Payload = "test." + UUID.randomUUID().toString();
-		Message testMessage2 = MessageBuilder.withPayload(testMessage2Payload.getBytes()).build();
+		Message testMessage2 = MessageBuilder
+				.withPayload(testMessage2Payload.getBytes()).build();
 		moduleOutputChannel.send(testMessage2);
 
 		Message receivedMessage = receive(successfulInputChannel);
-		assertThat(receivedMessage.getPayload()).isEqualTo(testMessage2Payload.getBytes());
+		assertThat(receivedMessage.getPayload())
+				.isEqualTo(testMessage2Payload.getBytes());
 
 		binderBindUnbindLatency();
 		consumerBinding.unbind();
@@ -881,24 +973,28 @@ public class KafkaBinderTests extends
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
 				producerBindingProperties);
 
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		FailingInvocationCountingMessageHandler handler = new FailingInvocationCountingMessageHandler();
 		moduleInputChannel.subscribe(handler);
 
 		long uniqueBindingId = System.currentTimeMillis();
-		Binding producerBinding = binder.bindProducer("retryTest." + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0",
-				"testGroup", moduleInputChannel, consumerProperties);
+		Binding producerBinding = binder.bindProducer(
+				"retryTest." + uniqueBindingId + ".0", moduleOutputChannel,
+				producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"retryTest." + uniqueBindingId + ".0", "testGroup", moduleInputChannel,
+				consumerProperties);
 		ExtendedConsumerProperties dlqConsumerProperties = createConsumerProperties();
 		dlqConsumerProperties.setMaxAttempts(1);
 		QueueChannel dlqChannel = new QueueChannel();
-		Binding dlqConsumerBinding = binder.bindConsumer(dlqName, null, dlqChannel,
-				dlqConsumerProperties);
+		Binding dlqConsumerBinding = binder.bindConsumer(dlqName, null,
+				dlqChannel, dlqConsumerProperties);
 
 		String testMessagePayload = "test." + UUID.randomUUID().toString();
-		Message testMessage = MessageBuilder.withPayload(testMessagePayload.getBytes()).build();
+		Message testMessage = MessageBuilder
+				.withPayload(testMessagePayload.getBytes()).build();
 		moduleOutputChannel.send(testMessage);
 
 		Message dlqMessage = receive(dlqChannel, 3);
@@ -907,24 +1003,30 @@ public class KafkaBinderTests extends
 
 		// first attempt fails
 		assertThat(handler.getReceivedMessages().entrySet()).hasSize(1);
-		Message handledMessage = handler.getReceivedMessages().entrySet().iterator().next().getValue();
+		Message handledMessage = handler.getReceivedMessages().entrySet().iterator()
+				.next().getValue();
 		assertThat(handledMessage).isNotNull();
-		assertThat(new String((byte[])handledMessage.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testMessagePayload);
-		assertThat(handler.getInvocationCount()).isEqualTo(consumerProperties.getMaxAttempts());
+		assertThat(
+				new String((byte[]) handledMessage.getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo(testMessagePayload);
+		assertThat(handler.getInvocationCount())
+				.isEqualTo(consumerProperties.getMaxAttempts());
 		binderBindUnbindLatency();
 		dlqConsumerBinding.unbind();
 		consumerBinding.unbind();
 
 		// on the second attempt the message is not redelivered because the DLQ is set
 		QueueChannel successfulInputChannel = new QueueChannel();
-		consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0", "testGroup",
-				successfulInputChannel, consumerProperties);
+		consumerBinding = binder.bindConsumer("retryTest." + uniqueBindingId + ".0",
+				"testGroup", successfulInputChannel, consumerProperties);
 		String testMessage2Payload = "test." + UUID.randomUUID().toString();
-		Message testMessage2 = MessageBuilder.withPayload(testMessage2Payload.getBytes()).build();
+		Message testMessage2 = MessageBuilder
+				.withPayload(testMessage2Payload.getBytes()).build();
 		moduleOutputChannel.send(testMessage2);
 
 		Message receivedMessage = receive(successfulInputChannel);
-		assertThat(receivedMessage.getPayload()).isEqualTo(testMessage2Payload.getBytes());
+		assertThat(receivedMessage.getPayload())
+				.isEqualTo(testMessage2Payload.getBytes());
 
 		binderBindUnbindLatency();
 		consumerBinding.unbind();
@@ -938,11 +1040,14 @@ public class KafkaBinderTests extends
 
 	@Test
 	@SuppressWarnings("unchecked")
-	//TODO: This test needs to be rethought - sending byte[] without explicit content type - yet being converted by the json converter
+	// TODO: This test needs to be rethought - sending byte[] without explicit content
+	// type
+	// - yet being converted by the json converter
 	public void testCompression() throws Exception {
-		final KafkaProducerProperties.CompressionType[] codecs = new KafkaProducerProperties.CompressionType[]{
-				KafkaProducerProperties.CompressionType.none, KafkaProducerProperties.CompressionType.gzip,
-				KafkaProducerProperties.CompressionType.snappy};
+		final KafkaProducerProperties.CompressionType[] codecs = new KafkaProducerProperties.CompressionType[] {
+				KafkaProducerProperties.CompressionType.none,
+				KafkaProducerProperties.CompressionType.gzip,
+				KafkaProducerProperties.CompressionType.snappy };
 		byte[] testPayload = new byte[2048];
 		Arrays.fill(testPayload, (byte) 65);
 		Binder binder = getBinder();
@@ -956,14 +1061,15 @@ public class KafkaBinderTests extends
 
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
-			DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel moduleInputChannel = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 
-			Binding producerBinding = binder.bindProducer("testCompression", moduleOutputChannel,
-					producerProperties);
-			Binding consumerBinding = binder.bindConsumer("testCompression", "test", moduleInputChannel,
-					consumerProperties);
-			Message message = org.springframework.integration.support.MessageBuilder.withPayload(testPayload)
-					.build();
+			Binding producerBinding = binder.bindProducer(
+					"testCompression", moduleOutputChannel, producerProperties);
+			Binding consumerBinding = binder.bindConsumer(
+					"testCompression", "test", moduleInputChannel, consumerProperties);
+			Message message = org.springframework.integration.support.MessageBuilder
+					.withPayload(testPayload).build();
 			// Let the consumer actually bind to the producer before sending a msg
 			binderBindUnbindLatency();
 			moduleOutputChannel.send(message);
@@ -995,22 +1101,28 @@ public class KafkaBinderTests extends
 
 		try {
 			Binder binder = getBinder();
-			BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties());
-			DirectChannel output = createBindableChannel("output", producerBindingProperties);
+			BindingProperties producerBindingProperties = createProducerBindingProperties(
+					createProducerProperties());
+			DirectChannel output = createBindableChannel("output",
+					producerBindingProperties);
 
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 			consumerProperties.getExtension().setAutoRebalanceEnabled(false);
-			consumerProperties.getExtension().setStartOffset(KafkaConsumerProperties.StartOffset.earliest);
+			consumerProperties.getExtension()
+					.setStartOffset(KafkaConsumerProperties.StartOffset.earliest);
 			consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 
-			DirectChannel input1 = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel input1 = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 
 			String testTopicName = UUID.randomUUID().toString();
-			producerBinding = binder.bindProducer(testTopicName, output, producerBindingProperties.getProducer());
+			producerBinding = binder.bindProducer(testTopicName, output,
+					producerBindingProperties.getProducer());
 			String testPayload1 = "foo-" + UUID.randomUUID().toString();
 			output.send(new GenericMessage<>(testPayload1.getBytes()));
 
-			consumerBinding = binder.bindConsumer(testTopicName, "startOffsets", input1, consumerProperties);
+			consumerBinding = binder.bindConsumer(testTopicName, "startOffsets", input1,
+					consumerProperties);
 			CountDownLatch latch = new CountDownLatch(1);
 			AtomicReference> inboundMessageRef1 = new AtomicReference<>();
 			MessageHandler messageHandler = message1 -> {
@@ -1041,7 +1153,8 @@ public class KafkaBinderTests extends
 			Assert.isTrue(latch1.await(5, TimeUnit.SECONDS), "Failed to receive message");
 
 			assertThat(inboundMessageRef2.get()).isNotNull();
-			assertThat(new String(inboundMessageRef2.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload2);
+			assertThat(new String(inboundMessageRef2.get().getPayload(),
+					StandardCharsets.UTF_8)).isEqualTo(testPayload2);
 			Thread.sleep(2000);
 			producerBinding.unbind();
 			consumerBinding.unbind();
@@ -1069,24 +1182,24 @@ public class KafkaBinderTests extends
 
 		QueueChannel moduleInputChannel = new QueueChannel();
 
-		Binding producerBinding1 = binder.bindProducer("foo.x", moduleOutputChannel1,
-				createProducerProperties());
-		Binding producerBinding2 = binder.bindProducer("foo.y", moduleOutputChannel2,
-				createProducerProperties());
+		Binding producerBinding1 = binder.bindProducer("foo.x",
+				moduleOutputChannel1, createProducerProperties());
+		Binding producerBinding2 = binder.bindProducer("foo.y",
+				moduleOutputChannel2, createProducerProperties());
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
-		Binding consumerBinding1 = binder.bindConsumer("foo.x", "test", moduleInputChannel,
-				consumerProperties);
-		Binding consumerBinding2 = binder.bindConsumer("foo.y", "test", moduleInputChannel,
-				consumerProperties);
+		Binding consumerBinding1 = binder.bindConsumer("foo.x", "test",
+				moduleInputChannel, consumerProperties);
+		Binding consumerBinding2 = binder.bindConsumer("foo.y", "test",
+				moduleInputChannel, consumerProperties);
 
 		String testPayload1 = "foo" + UUID.randomUUID().toString();
-		Message message1 = org.springframework.integration.support.MessageBuilder.withPayload(
-				testPayload1.getBytes()).build();
+		Message message1 = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload1.getBytes()).build();
 		String testPayload2 = "foo" + UUID.randomUUID().toString();
-		Message message2 = org.springframework.integration.support.MessageBuilder.withPayload(
-				testPayload2.getBytes()).build();
+		Message message2 = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload2.getBytes()).build();
 
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
@@ -1099,8 +1212,8 @@ public class KafkaBinderTests extends
 
 		assertThat(messages[0]).isNotNull();
 		assertThat(messages[1]).isNotNull();
-		assertThat(messages).extracting("payload").containsExactlyInAnyOrder(testPayload1.getBytes(),
-				testPayload2.getBytes());
+		assertThat(messages).extracting("payload").containsExactlyInAnyOrder(
+				testPayload1.getBytes(), testPayload2.getBytes());
 
 		producerBinding1.unbind();
 		producerBinding2.unbind();
@@ -1119,19 +1232,19 @@ public class KafkaBinderTests extends
 		QueueChannel moduleInputChannel = new QueueChannel();
 
 		Binding producerBinding = binder.bindProducer(
-				"testManualAckSucceedsWhenAutoCommitOffsetIsTurnedOff", moduleOutputChannel,
-				createProducerProperties());
+				"testManualAckSucceedsWhenAutoCommitOffsetIsTurnedOff",
+				moduleOutputChannel, createProducerProperties());
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.getExtension().setAutoCommitOffset(false);
 
 		Binding consumerBinding = binder.bindConsumer(
-				"testManualAckSucceedsWhenAutoCommitOffsetIsTurnedOff", "test", moduleInputChannel,
-				consumerProperties);
+				"testManualAckSucceedsWhenAutoCommitOffsetIsTurnedOff", "test",
+				moduleInputChannel, consumerProperties);
 
 		String testPayload1 = "foo" + UUID.randomUUID().toString();
-		Message message1 = org.springframework.integration.support.MessageBuilder.withPayload(
-				testPayload1.getBytes()).build();
+		Message message1 = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload1.getBytes()).build();
 
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
@@ -1139,9 +1252,10 @@ public class KafkaBinderTests extends
 
 		Message receivedMessage = receive(moduleInputChannel);
 		assertThat(receivedMessage).isNotNull();
-		assertThat(receivedMessage.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT)).isNotNull();
-		Acknowledgment acknowledgment = receivedMessage.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT,
-				Acknowledgment.class);
+		assertThat(receivedMessage.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT))
+				.isNotNull();
+		Acknowledgment acknowledgment = receivedMessage.getHeaders()
+				.get(KafkaHeaders.ACKNOWLEDGMENT, Acknowledgment.class);
 		try {
 			acknowledgment.acknowledge();
 		}
@@ -1156,7 +1270,8 @@ public class KafkaBinderTests extends
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder() throws Exception {
+	public void testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder()
+			throws Exception {
 		Binder binder = getBinder();
 
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
@@ -1164,23 +1279,24 @@ public class KafkaBinderTests extends
 		QueueChannel moduleInputChannel = new QueueChannel();
 
 		Binding producerBinding = binder.bindProducer(
-				"testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder", moduleOutputChannel,
-				createProducerProperties());
+				"testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder",
+				moduleOutputChannel, createProducerProperties());
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
 		Binding consumerBinding = binder.bindConsumer(
-				"testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder", "test", moduleInputChannel,
-				consumerProperties);
+				"testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder",
+				"test", moduleInputChannel, consumerProperties);
 
-
-		AbstractMessageListenerContainer container = TestUtils.getPropertyValue(consumerBinding,
-				"lifecycle.messageListenerContainer", AbstractMessageListenerContainer.class);
-		assertThat(container.getContainerProperties().getAckMode()).isEqualTo(ContainerProperties.AckMode.BATCH);
+		AbstractMessageListenerContainer container = TestUtils.getPropertyValue(
+				consumerBinding, "lifecycle.messageListenerContainer",
+				AbstractMessageListenerContainer.class);
+		assertThat(container.getContainerProperties().getAckMode())
+				.isEqualTo(ContainerProperties.AckMode.BATCH);
 
 		String testPayload1 = "foo" + UUID.randomUUID().toString();
-		Message message1 = org.springframework.integration.support.MessageBuilder.withPayload(
-				testPayload1.getBytes()).build();
+		Message message1 = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload1.getBytes()).build();
 
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
@@ -1188,7 +1304,8 @@ public class KafkaBinderTests extends
 
 		Message receivedMessage = receive(moduleInputChannel);
 		assertThat(receivedMessage).isNotNull();
-		assertThat(receivedMessage.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT)).isNull();
+		assertThat(receivedMessage.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT))
+				.isNull();
 
 		producerBinding.unbind();
 		consumerBinding.unbind();
@@ -1201,12 +1318,15 @@ public class KafkaBinderTests extends
 		Binder binder = getBinder();
 		ExtendedProducerProperties producerProperties = createProducerProperties();
 
-		DirectChannel output = createBindableChannel("output", createProducerBindingProperties(producerProperties));
+		DirectChannel output = createBindableChannel("output",
+				createProducerBindingProperties(producerProperties));
 
-		String testDestination = "testDestination" + UUID.randomUUID().toString().replace("-", "");
+		String testDestination = "testDestination"
+				+ UUID.randomUUID().toString().replace("-", "");
 
 		producerProperties.setRequiredGroups("test1", "test2");
-		Binding producerBinding = binder.bindProducer(testDestination, output, producerProperties);
+		Binding producerBinding = binder.bindProducer(testDestination,
+				output, producerProperties);
 
 		String testPayload = "foo-" + UUID.randomUUID().toString();
 		output.send(new GenericMessage<>(testPayload.getBytes()));
@@ -1215,22 +1335,26 @@ public class KafkaBinderTests extends
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 		consumerProperties.getExtension().setAckEachRecord(true);
-		Binding consumerBinding1 = binder.bindConsumer(testDestination, "test1", inbound1,
-				consumerProperties);
+		Binding consumerBinding1 = binder.bindConsumer(testDestination,
+				"test1", inbound1, consumerProperties);
 		QueueChannel inbound2 = new QueueChannel();
-		Binding consumerBinding2 = binder.bindConsumer(testDestination, "test2", inbound2,
-				consumerProperties);
+		Binding consumerBinding2 = binder.bindConsumer(testDestination,
+				"test2", inbound2, consumerProperties);
 
-		AbstractMessageListenerContainer container = TestUtils.getPropertyValue(consumerBinding2,
-				"lifecycle.messageListenerContainer", AbstractMessageListenerContainer.class);
-		assertThat(container.getContainerProperties().getAckMode()).isEqualTo(ContainerProperties.AckMode.RECORD);
+		AbstractMessageListenerContainer container = TestUtils.getPropertyValue(
+				consumerBinding2, "lifecycle.messageListenerContainer",
+				AbstractMessageListenerContainer.class);
+		assertThat(container.getContainerProperties().getAckMode())
+				.isEqualTo(ContainerProperties.AckMode.RECORD);
 
 		Message receivedMessage1 = receive(inbound1);
 		assertThat(receivedMessage1).isNotNull();
-		assertThat(new String((byte[]) receivedMessage1.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload);
+		assertThat(new String((byte[]) receivedMessage1.getPayload(),
+				StandardCharsets.UTF_8)).isEqualTo(testPayload);
 		Message receivedMessage2 = receive(inbound2);
 		assertThat(receivedMessage2).isNotNull();
-		assertThat(new String((byte[]) receivedMessage2.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload);
+		assertThat(new String((byte[]) receivedMessage2.getPayload(),
+				StandardCharsets.UTF_8)).isEqualTo(testPayload);
 
 		consumerBinding1.unbind();
 		consumerBinding2.unbind();
@@ -1251,29 +1375,37 @@ public class KafkaBinderTests extends
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 		QueueChannel input0 = new QueueChannel();
 		input0.setBeanName("test.input0S");
-		Binding input0Binding = binder.bindConsumer("part.0", "test", input0, consumerProperties);
+		Binding input0Binding = binder.bindConsumer("part.0", "test",
+				input0, consumerProperties);
 		consumerProperties.setInstanceIndex(1);
 		QueueChannel input1 = new QueueChannel();
 		input1.setBeanName("test.input1S");
-		Binding input1Binding = binder.bindConsumer("part.0", "test", input1, consumerProperties);
+		Binding input1Binding = binder.bindConsumer("part.0", "test",
+				input1, consumerProperties);
 		consumerProperties.setInstanceIndex(2);
 		QueueChannel input2 = new QueueChannel();
 		input2.setBeanName("test.input2S");
-		Binding input2Binding = binder.bindConsumer("part.0", "test", input2, consumerProperties);
+		Binding input2Binding = binder.bindConsumer("part.0", "test",
+				input2, consumerProperties);
 
 		ExtendedProducerProperties producerProperties = createProducerProperties();
-		producerProperties.setPartitionKeyExpression(spelExpressionParser.parseExpression("payload"));
-		producerProperties.setPartitionSelectorExpression(spelExpressionParser.parseExpression("hashCode()"));
+		producerProperties.setPartitionKeyExpression(
+				spelExpressionParser.parseExpression("payload"));
+		producerProperties.setPartitionSelectorExpression(
+				spelExpressionParser.parseExpression("hashCode()"));
 		producerProperties.setPartitionCount(3);
 		invokeCreateTopic("output", 6, 1);
 
-		DirectChannel output = createBindableChannel("output", createProducerBindingProperties(producerProperties));
+		DirectChannel output = createBindableChannel("output",
+				createProducerBindingProperties(producerProperties));
 		output.setBeanName("test.output");
-		Binding outputBinding = binder.bindProducer("part.0", output, producerProperties);
+		Binding outputBinding = binder.bindProducer("part.0", output,
+				producerProperties);
 		try {
 			Object endpoint = extractEndpoint(outputBinding);
 			assertThat(getEndpointRouting(endpoint))
-					.contains(getExpectedRoutingBaseDestination("part.0", "test") + "-' + headers['partition']");
+					.contains(getExpectedRoutingBaseDestination("part.0", "test")
+							+ "-' + headers['partition']");
 		}
 		catch (UnsupportedOperationException ignored) {
 		}
@@ -1281,11 +1413,13 @@ public class KafkaBinderTests extends
 		AtomicInteger count = new AtomicInteger();
 		interceptors.forEach(interceptor -> {
 			if (interceptor instanceof PartitioningInterceptor) {
-				count.set(TestUtils.getPropertyValue(interceptor, "partitionHandler.partitionCount", Integer.class));
+				count.set(TestUtils.getPropertyValue(interceptor,
+						"partitionHandler.partitionCount", Integer.class));
 			}
 		});
 		assertThat(count.get()).isEqualTo(6);
-		Message message2 = org.springframework.integration.support.MessageBuilder.withPayload(2)
+		Message message2 = org.springframework.integration.support.MessageBuilder
+				.withPayload(2)
 				.setHeader(IntegrationMessageHeaderAccessor.CORRELATION_ID, "foo")
 				.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, 42)
 				.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, 43).build();
@@ -1304,8 +1438,10 @@ public class KafkaBinderTests extends
 
 			@Override
 			public boolean matches(Message value) {
-				IntegrationMessageHeaderAccessor accessor = new IntegrationMessageHeaderAccessor(value);
-				return "foo".equals(accessor.getCorrelationId()) && 42 == accessor.getSequenceNumber()
+				IntegrationMessageHeaderAccessor accessor = new IntegrationMessageHeaderAccessor(
+						value);
+				return "foo".equals(accessor.getCorrelationId())
+						&& 42 == accessor.getSequenceNumber()
 						&& 43 == accessor.getSequenceSize();
 			}
 		};
@@ -1313,20 +1449,26 @@ public class KafkaBinderTests extends
 		ObjectMapper om = new ObjectMapper();
 
 		if (usesExplicitRouting()) {
-			assertThat(om.readValue((byte[]) receive0.getPayload(), Integer.class)).isEqualTo(0);
-			assertThat(om.readValue((byte[]) receive1.getPayload(), Integer.class)).isEqualTo(1);
-			assertThat(om.readValue((byte[]) receive2.getPayload(), Integer.class)).isEqualTo(2);
+			assertThat(om.readValue((byte[]) receive0.getPayload(), Integer.class))
+					.isEqualTo(0);
+			assertThat(om.readValue((byte[]) receive1.getPayload(), Integer.class))
+					.isEqualTo(1);
+			assertThat(om.readValue((byte[]) receive2.getPayload(), Integer.class))
+					.isEqualTo(2);
 			assertThat(receive2).has(correlationHeadersForPayload2);
 		}
 		else {
-			List> receivedMessages = Arrays.asList(receive0, receive1, receive2);
-			assertThat(receivedMessages).extracting("payload").containsExactlyInAnyOrder(new byte[]{48}, new byte[]{49}, new byte[]{50});
+			List> receivedMessages = Arrays.asList(receive0, receive1,
+					receive2);
+			assertThat(receivedMessages).extracting("payload").containsExactlyInAnyOrder(
+					new byte[] { 48 }, new byte[] { 49 }, new byte[] { 50 });
 			Condition> payloadIs2 = new Condition>() {
 
 				@Override
 				public boolean matches(Message value) {
 					try {
-						return om.readValue((byte[]) value.getPayload(), Integer.class).equals(2);
+						return om.readValue((byte[]) value.getPayload(), Integer.class)
+								.equals(2);
 					}
 					catch (IOException e) {
 						//
@@ -1334,7 +1476,8 @@ public class KafkaBinderTests extends
 					return false;
 				}
 			};
-			assertThat(receivedMessages).filteredOn(payloadIs2).areExactly(1, correlationHeadersForPayload2);
+			assertThat(receivedMessages).filteredOn(payloadIs2).areExactly(1,
+					correlationHeadersForPayload2);
 
 		}
 		input0Binding.unbind();
@@ -1345,7 +1488,7 @@ public class KafkaBinderTests extends
 
 	@Test
 	@Override
-	@SuppressWarnings({"unchecked", "rawtypes"})
+	@SuppressWarnings({ "unchecked", "rawtypes" })
 	public void testPartitionedModuleJava() throws Exception {
 		Binder binder = getBinder();
 
@@ -1359,31 +1502,38 @@ public class KafkaBinderTests extends
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 		QueueChannel input0 = new QueueChannel();
 		input0.setBeanName("test.input0J");
-		Binding input0Binding = binder.bindConsumer("partJ.0", "test", input0, consumerProperties);
+		Binding input0Binding = binder.bindConsumer("partJ.0", "test",
+				input0, consumerProperties);
 		consumerProperties.setInstanceIndex(1);
 		QueueChannel input1 = new QueueChannel();
 		input1.setBeanName("test.input1J");
-		Binding input1Binding = binder.bindConsumer("partJ.0", "test", input1, consumerProperties);
+		Binding input1Binding = binder.bindConsumer("partJ.0", "test",
+				input1, consumerProperties);
 		consumerProperties.setInstanceIndex(2);
 		QueueChannel input2 = new QueueChannel();
 		input2.setBeanName("test.input2J");
-		Binding input2Binding = binder.bindConsumer("partJ.0", "test", input2, consumerProperties);
+		Binding input2Binding = binder.bindConsumer("partJ.0", "test",
+				input2, consumerProperties);
 		consumerProperties.setInstanceIndex(3);
 		QueueChannel input3 = new QueueChannel();
 		input3.setBeanName("test.input3J");
-		Binding input3Binding = binder.bindConsumer("partJ.0", "test", input3, consumerProperties);
+		Binding input3Binding = binder.bindConsumer("partJ.0", "test",
+				input3, consumerProperties);
 
 		ExtendedProducerProperties producerProperties = createProducerProperties();
 		producerProperties.setPartitionKeyExtractorClass(PartitionTestSupport.class);
 		producerProperties.setPartitionSelectorClass(PartitionTestSupport.class);
 		producerProperties.setPartitionCount(3); // overridden to 8 on the actual topic
-		DirectChannel output = createBindableChannel("output", createProducerBindingProperties(producerProperties));
+		DirectChannel output = createBindableChannel("output",
+				createProducerBindingProperties(producerProperties));
 		output.setBeanName("test.output");
-		Binding outputBinding = binder.bindProducer("partJ.0", output, producerProperties);
+		Binding outputBinding = binder.bindProducer("partJ.0", output,
+				producerProperties);
 		if (usesExplicitRouting()) {
 			Object endpoint = extractEndpoint(outputBinding);
 			assertThat(getEndpointRouting(endpoint))
-					.contains(getExpectedRoutingBaseDestination("partJ.0", "test") + "-' + headers['partition']");
+					.contains(getExpectedRoutingBaseDestination("partJ.0", "test")
+							+ "-' + headers['partition']");
 		}
 
 		output.send(new GenericMessage<>(2));
@@ -1401,10 +1551,14 @@ public class KafkaBinderTests extends
 		assertThat(receive3).isNotNull();
 		ObjectMapper om = new ObjectMapper();
 
-		assertThat(om.readValue((byte[]) receive0.getPayload(), Integer.class)).isEqualTo(0);
-		assertThat(om.readValue((byte[]) receive1.getPayload(), Integer.class)).isEqualTo(1);
-		assertThat(om.readValue((byte[]) receive2.getPayload(), Integer.class)).isEqualTo(2);
-		assertThat(om.readValue((byte[]) receive3.getPayload(), Integer.class)).isEqualTo(3);
+		assertThat(om.readValue((byte[]) receive0.getPayload(), Integer.class))
+				.isEqualTo(0);
+		assertThat(om.readValue((byte[]) receive1.getPayload(), Integer.class))
+				.isEqualTo(1);
+		assertThat(om.readValue((byte[]) receive2.getPayload(), Integer.class))
+				.isEqualTo(2);
+		assertThat(om.readValue((byte[]) receive3.getPayload(), Integer.class))
+				.isEqualTo(3);
 
 		input0Binding.unbind();
 		input1Binding.unbind();
@@ -1418,19 +1572,20 @@ public class KafkaBinderTests extends
 	@SuppressWarnings("unchecked")
 	public void testAnonymousGroup() throws Exception {
 		Binder binder = getBinder();
-		BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties());
+		BindingProperties producerBindingProperties = createProducerBindingProperties(
+				createProducerProperties());
 		DirectChannel output = createBindableChannel("output", producerBindingProperties);
-		Binding producerBinding = binder.bindProducer("defaultGroup.0", output,
-				producerBindingProperties.getProducer());
+		Binding producerBinding = binder.bindProducer("defaultGroup.0",
+				output, producerBindingProperties.getProducer());
 
 		QueueChannel input1 = new QueueChannel();
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		Binding binding1 = binder.bindConsumer("defaultGroup.0", null, input1,
-				consumerProperties);
+		Binding binding1 = binder.bindConsumer("defaultGroup.0", null,
+				input1, consumerProperties);
 
 		QueueChannel input2 = new QueueChannel();
-		Binding binding2 = binder.bindConsumer("defaultGroup.0", null, input2,
-				consumerProperties);
+		Binding binding2 = binder.bindConsumer("defaultGroup.0", null,
+				input2, consumerProperties);
 		// Since we don't provide any topic info, let Kafka bind the consumer successfully
 		Thread.sleep(1000);
 		String testPayload1 = "foo-" + UUID.randomUUID().toString();
@@ -1438,18 +1593,21 @@ public class KafkaBinderTests extends
 
 		Message receivedMessage1 = (Message) receive(input1);
 		assertThat(receivedMessage1).isNotNull();
-		assertThat(new String(receivedMessage1.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload1);
+		assertThat(new String(receivedMessage1.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo(testPayload1);
 
 		Message receivedMessage2 = (Message) receive(input2);
 		assertThat(receivedMessage2).isNotNull();
-		assertThat(new String(receivedMessage2.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload1);
+		assertThat(new String(receivedMessage2.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo(testPayload1);
 
 		binding2.unbind();
 
 		String testPayload2 = "foo-" + UUID.randomUUID().toString();
 		output.send(new GenericMessage<>(testPayload2.getBytes()));
 
-		binding2 = binder.bindConsumer("defaultGroup.0", null, input2, consumerProperties);
+		binding2 = binder.bindConsumer("defaultGroup.0", null, input2,
+				consumerProperties);
 		// Since we don't provide any topic info, let Kafka bind the consumer successfully
 		Thread.sleep(1000);
 		String testPayload3 = "foo-" + UUID.randomUUID().toString();
@@ -1457,16 +1615,20 @@ public class KafkaBinderTests extends
 
 		receivedMessage1 = (Message) receive(input1);
 		assertThat(receivedMessage1).isNotNull();
-		assertThat(new String(receivedMessage1.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload2);
+		assertThat(new String(receivedMessage1.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo(testPayload2);
 		receivedMessage1 = (Message) receive(input1);
 		assertThat(receivedMessage1).isNotNull();
-		assertThat(new String(receivedMessage1.getPayload(), StandardCharsets.UTF_8)).isNotNull();
+		assertThat(new String(receivedMessage1.getPayload(), StandardCharsets.UTF_8))
+				.isNotNull();
 
 		receivedMessage2 = (Message) receive(input2);
 		assertThat(receivedMessage2).isNotNull();
-		assertThat(new String(receivedMessage2.getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload3);
+		assertThat(new String(receivedMessage2.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo(testPayload3);
 
-		Map topicsInUse = ((KafkaTestBinder)binder).getCoreBinder().getTopicsInUse();
+		Map topicsInUse = ((KafkaTestBinder) binder)
+				.getCoreBinder().getTopicsInUse();
 		assertThat(topicsInUse.keySet()).contains("defaultGroup.0");
 		TopicInformation topic = topicsInUse.get("defaultGroup.0");
 		assertThat(topic.isConsumerTopic()).isTrue();
@@ -1487,9 +1649,11 @@ public class KafkaBinderTests extends
 		properties.setPartitionSelectorClass(RawKafkaPartitionTestSupport.class);
 		properties.setPartitionCount(6);
 
-		DirectChannel output = createBindableChannel("output", createProducerBindingProperties(properties));
+		DirectChannel output = createBindableChannel("output",
+				createProducerBindingProperties(properties));
 		output.setBeanName("test.output");
-		Binding outputBinding = binder.bindProducer("partJ.raw.0", output, properties);
+		Binding outputBinding = binder.bindProducer("partJ.raw.0", output,
+				properties);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.setConcurrency(2);
@@ -1500,19 +1664,22 @@ public class KafkaBinderTests extends
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 		QueueChannel input0 = new QueueChannel();
 		input0.setBeanName("test.input0J");
-		Binding input0Binding = binder.bindConsumer("partJ.raw.0", "test", input0, consumerProperties);
+		Binding input0Binding = binder.bindConsumer("partJ.raw.0", "test",
+				input0, consumerProperties);
 		consumerProperties.setInstanceIndex(1);
 		QueueChannel input1 = new QueueChannel();
 		input1.setBeanName("test.input1J");
-		Binding input1Binding = binder.bindConsumer("partJ.raw.0", "test", input1, consumerProperties);
+		Binding input1Binding = binder.bindConsumer("partJ.raw.0", "test",
+				input1, consumerProperties);
 		consumerProperties.setInstanceIndex(2);
 		QueueChannel input2 = new QueueChannel();
 		input2.setBeanName("test.input2J");
-		Binding input2Binding = binder.bindConsumer("partJ.raw.0", "test", input2, consumerProperties);
+		Binding input2Binding = binder.bindConsumer("partJ.raw.0", "test",
+				input2, consumerProperties);
 
-		output.send(new GenericMessage<>(new byte[]{(byte) 0}));
-		output.send(new GenericMessage<>(new byte[]{(byte) 1}));
-		output.send(new GenericMessage<>(new byte[]{(byte) 2}));
+		output.send(new GenericMessage<>(new byte[] { (byte) 0 }));
+		output.send(new GenericMessage<>(new byte[] { (byte) 1 }));
+		output.send(new GenericMessage<>(new byte[] { (byte) 2 }));
 
 		Message receive0 = receive(input0);
 		assertThat(receive0).isNotNull();
@@ -1521,8 +1688,9 @@ public class KafkaBinderTests extends
 		Message receive2 = receive(input2);
 		assertThat(receive2).isNotNull();
 
-		assertThat(Arrays.asList(((byte[]) receive0.getPayload())[0], ((byte[]) receive1.getPayload())[0],
-				((byte[]) receive2.getPayload())[0])).containsExactlyInAnyOrder((byte) 0, (byte) 1, (byte) 2);
+		assertThat(Arrays.asList(((byte[]) receive0.getPayload())[0],
+				((byte[]) receive1.getPayload())[0], ((byte[]) receive2.getPayload())[0]))
+						.containsExactlyInAnyOrder((byte) 0, (byte) 1, (byte) 2);
 
 		input0Binding.unbind();
 		input1Binding.unbind();
@@ -1535,18 +1703,23 @@ public class KafkaBinderTests extends
 	public void testPartitionedModuleSpELWithRawMode() throws Exception {
 		Binder binder = getBinder();
 		ExtendedProducerProperties properties = createProducerProperties();
-		properties.setPartitionKeyExpression(spelExpressionParser.parseExpression("payload[0]"));
-		properties.setPartitionSelectorExpression(spelExpressionParser.parseExpression("hashCode()"));
+		properties.setPartitionKeyExpression(
+				spelExpressionParser.parseExpression("payload[0]"));
+		properties.setPartitionSelectorExpression(
+				spelExpressionParser.parseExpression("hashCode()"));
 		properties.setPartitionCount(6);
 		properties.setHeaderMode(HeaderMode.none);
 
-		DirectChannel output = createBindableChannel("output", createProducerBindingProperties(properties));
+		DirectChannel output = createBindableChannel("output",
+				createProducerBindingProperties(properties));
 		output.setBeanName("test.output");
-		Binding outputBinding = binder.bindProducer("part.raw.0", output, properties);
+		Binding outputBinding = binder.bindProducer("part.raw.0", output,
+				properties);
 		try {
 			Object endpoint = extractEndpoint(outputBinding);
 			assertThat(getEndpointRouting(endpoint))
-					.contains(getExpectedRoutingBaseDestination("part.raw.0", "test") + "-' + headers['partition']");
+					.contains(getExpectedRoutingBaseDestination("part.raw.0", "test")
+							+ "-' + headers['partition']");
 		}
 		catch (UnsupportedOperationException ignored) {
 		}
@@ -1560,31 +1733,37 @@ public class KafkaBinderTests extends
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 		QueueChannel input0 = new QueueChannel();
 		input0.setBeanName("test.input0S");
-		Binding input0Binding = binder.bindConsumer("part.raw.0", "test", input0, consumerProperties);
+		Binding input0Binding = binder.bindConsumer("part.raw.0", "test",
+				input0, consumerProperties);
 		consumerProperties.setInstanceIndex(1);
 		QueueChannel input1 = new QueueChannel();
 		input1.setBeanName("test.input1S");
-		Binding input1Binding = binder.bindConsumer("part.raw.0", "test", input1, consumerProperties);
+		Binding input1Binding = binder.bindConsumer("part.raw.0", "test",
+				input1, consumerProperties);
 		consumerProperties.setInstanceIndex(2);
 		QueueChannel input2 = new QueueChannel();
 		input2.setBeanName("test.input2S");
-		Binding input2Binding = binder.bindConsumer("part.raw.0", "test", input2, consumerProperties);
+		Binding input2Binding = binder.bindConsumer("part.raw.0", "test",
+				input2, consumerProperties);
 
-		Message message2 = org.springframework.integration.support.MessageBuilder.withPayload(new byte[]{2})
-				.setHeader(IntegrationMessageHeaderAccessor.CORRELATION_ID, "kafkaBinderTestCommonsDelegate")
+		Message message2 = org.springframework.integration.support.MessageBuilder
+				.withPayload(new byte[] { 2 })
+				.setHeader(IntegrationMessageHeaderAccessor.CORRELATION_ID,
+						"kafkaBinderTestCommonsDelegate")
 				.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, 42)
 				.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, 43).build();
 		output.send(message2);
-		output.send(new GenericMessage<>(new byte[]{1}));
-		output.send(new GenericMessage<>(new byte[]{0}));
+		output.send(new GenericMessage<>(new byte[] { 1 }));
+		output.send(new GenericMessage<>(new byte[] { 0 }));
 		Message receive0 = receive(input0);
 		assertThat(receive0).isNotNull();
 		Message receive1 = receive(input1);
 		assertThat(receive1).isNotNull();
 		Message receive2 = receive(input2);
 		assertThat(receive2).isNotNull();
-		assertThat(Arrays.asList(((byte[]) receive0.getPayload())[0], ((byte[]) receive1.getPayload())[0],
-				((byte[]) receive2.getPayload())[0])).containsExactlyInAnyOrder((byte) 0, (byte) 1, (byte) 2);
+		assertThat(Arrays.asList(((byte[]) receive0.getPayload())[0],
+				((byte[]) receive1.getPayload())[0], ((byte[]) receive2.getPayload())[0]))
+						.containsExactlyInAnyOrder((byte) 0, (byte) 1, (byte) 2);
 		input0Binding.unbind();
 		input1Binding.unbind();
 		input2Binding.unbind();
@@ -1598,30 +1777,34 @@ public class KafkaBinderTests extends
 		ExtendedProducerProperties properties = createProducerProperties();
 		properties.setPartitionCount(6);
 
-		DirectChannel output = createBindableChannel("output", createProducerBindingProperties(properties));
+		DirectChannel output = createBindableChannel("output",
+				createProducerBindingProperties(properties));
 		output.setBeanName("test.output");
-		Binding outputBinding = binder.bindProducer("partNative.raw.0", output, properties);
+		Binding outputBinding = binder.bindProducer("partNative.raw.0",
+				output, properties);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		QueueChannel input0 = new QueueChannel();
 		input0.setBeanName("test.inputNative");
-		Binding inputBinding = binder.bindConsumer("partNative.raw.0", "test", input0, consumerProperties);
+		Binding inputBinding = binder.bindConsumer("partNative.raw.0",
+				"test", input0, consumerProperties);
 
-		output.send(
-				new GenericMessage<>("foo".getBytes(), Collections.singletonMap(KafkaHeaders.PARTITION_ID, 5)));
+		output.send(new GenericMessage<>("foo".getBytes(),
+				Collections.singletonMap(KafkaHeaders.PARTITION_ID, 5)));
 
 		Message received = receive(input0);
 		assertThat(received).isNotNull();
 
 		assertThat(received.getPayload()).isEqualTo("foo".getBytes());
-		assertThat(received.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID)).isEqualTo(5);
+		assertThat(received.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+				.isEqualTo(5);
 
 		inputBinding.unbind();
 		outputBinding.unbind();
 	}
 
 	@Test
-	@SuppressWarnings({"unchecked", "rawtypes"})
+	@SuppressWarnings({ "unchecked", "rawtypes" })
 	public void testSendAndReceiveWithRawMode() throws Exception {
 		Binder binder = getBinder();
 
@@ -1632,12 +1815,13 @@ public class KafkaBinderTests extends
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.setHeaderMode(HeaderMode.none);
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
-		Binding producerBinding = binder.bindProducer("raw.0", moduleOutputChannel,
-				producerProperties);
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
+		Binding producerBinding = binder.bindProducer("raw.0",
+				moduleOutputChannel, producerProperties);
 
-		Binding consumerBinding = binder.bindConsumer("raw.0", "test", moduleInputChannel,
-				consumerProperties);
+		Binding consumerBinding = binder.bindConsumer("raw.0", "test",
+				moduleInputChannel, consumerProperties);
 		Message message = org.springframework.integration.support.MessageBuilder
 				.withPayload("testSendAndReceiveWithRawMode".getBytes()).build();
 		// Let the consumer actually bind to the producer before sending a msg
@@ -1657,42 +1841,49 @@ public class KafkaBinderTests extends
 		Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
 
 		assertThat(inboundMessageRef.get()).isNotNull();
-		assertThat(new String(inboundMessageRef.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithRawMode");
+		assertThat(
+				new String(inboundMessageRef.get().getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo("testSendAndReceiveWithRawMode");
 		producerBinding.unbind();
 		consumerBinding.unbind();
 	}
 
-	@SuppressWarnings({"rawtypes", "unchecked"})
+	@SuppressWarnings({ "rawtypes", "unchecked" })
 	@Test
 	public void testProducerErrorChannel() throws Exception {
 		AbstractKafkaTestBinder binder = getBinder();
-		DirectChannel moduleOutputChannel = createBindableChannel("output", new BindingProperties());
+		DirectChannel moduleOutputChannel = createBindableChannel("output",
+				new BindingProperties());
 		ExtendedProducerProperties producerProps = new ExtendedProducerProperties<>(
 				new KafkaProducerProperties());
 		producerProps.setHeaderMode(HeaderMode.none);
 		producerProps.setErrorChannelEnabled(true);
-		Binding producerBinding = binder.bindProducer("ec.0", moduleOutputChannel, producerProps);
-		final Message message = MessageBuilder.withPayload("bad").setHeader(MessageHeaders.CONTENT_TYPE, "application/json")
-				.build();
-		SubscribableChannel ec = binder.getApplicationContext().getBean("ec.0.errors", SubscribableChannel.class);
+		Binding producerBinding = binder.bindProducer("ec.0",
+				moduleOutputChannel, producerProps);
+		final Message message = MessageBuilder.withPayload("bad")
+				.setHeader(MessageHeaders.CONTENT_TYPE, "application/json").build();
+		SubscribableChannel ec = binder.getApplicationContext().getBean("ec.0.errors",
+				SubscribableChannel.class);
 		final AtomicReference> errorMessage = new AtomicReference<>();
 		final CountDownLatch latch = new CountDownLatch(2);
 		ec.subscribe(message1 -> {
 			errorMessage.set(message1);
 			latch.countDown();
 		});
-		SubscribableChannel globalEc = binder.getApplicationContext()
-				.getBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME, SubscribableChannel.class);
+		SubscribableChannel globalEc = binder.getApplicationContext().getBean(
+				IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME,
+				SubscribableChannel.class);
 		globalEc.subscribe(message12 -> latch.countDown());
-		KafkaProducerMessageHandler endpoint = TestUtils.getPropertyValue(producerBinding, "lifecycle",
-				KafkaProducerMessageHandler.class);
+		KafkaProducerMessageHandler endpoint = TestUtils.getPropertyValue(producerBinding,
+				"lifecycle", KafkaProducerMessageHandler.class);
 		final RuntimeException fooException = new RuntimeException("foo");
 		final AtomicReference sent = new AtomicReference<>();
 		new DirectFieldAccessor(endpoint).setPropertyValue("kafkaTemplate",
 				new KafkaTemplate(mock(ProducerFactory.class)) {
 
 					@Override // SIK < 2.3
-					public ListenableFuture send(String topic, Object payload) {
+					public ListenableFuture send(String topic,
+							Object payload) {
 						sent.set(payload);
 						SettableListenableFuture future = new SettableListenableFuture<>();
 						future.setException(fooException);
@@ -1712,10 +1903,13 @@ public class KafkaBinderTests extends
 		moduleOutputChannel.send(message);
 		assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
 		assertThat(errorMessage.get()).isInstanceOf(ErrorMessage.class);
-		assertThat(errorMessage.get().getPayload()).isInstanceOf(KafkaSendFailureException.class);
-		KafkaSendFailureException exception = (KafkaSendFailureException) errorMessage.get().getPayload();
+		assertThat(errorMessage.get().getPayload())
+				.isInstanceOf(KafkaSendFailureException.class);
+		KafkaSendFailureException exception = (KafkaSendFailureException) errorMessage
+				.get().getPayload();
 		assertThat(exception.getCause()).isSameAs(fooException);
-		assertThat(new String((byte[]) exception.getFailedMessage().getPayload(), StandardCharsets.UTF_8)).isEqualTo(message.getPayload());
+		assertThat(new String((byte[]) exception.getFailedMessage().getPayload(),
+				StandardCharsets.UTF_8)).isEqualTo(message.getPayload());
 		assertThat(exception.getRecord().value()).isSameAs(sent.get());
 		producerBinding.unbind();
 	}
@@ -1728,9 +1922,11 @@ public class KafkaBinderTests extends
 		Binder binder = getBinder(configurationProperties);
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		String testTopicName = "nonexisting" + System.currentTimeMillis();
-		DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel moduleInputChannel = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
-		Binding binding = binder.bindConsumer(testTopicName, "test", moduleInputChannel, consumerProperties);
+		Binding binding = binder.bindConsumer(testTopicName, "test",
+				moduleInputChannel, consumerProperties);
 		binding.unbind();
 	}
 
@@ -1752,12 +1948,13 @@ public class KafkaBinderTests extends
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		long uniqueBindingId = System.currentTimeMillis();
-		Binding producerBinding = binder.bindProducer("foo" + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("foo" + uniqueBindingId + ".0", null,
-				moduleInputChannel, consumerProperties);
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload(testPayload)
-				.build();
+		Binding producerBinding = binder.bindProducer(
+				"foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"foo" + uniqueBindingId + ".0", null, moduleInputChannel,
+				consumerProperties);
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload).build();
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
 		moduleOutputChannel.send(message);
@@ -1772,7 +1969,8 @@ public class KafkaBinderTests extends
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testCustomPartitionCountDoesNotOverridePartitioningIfSmaller() throws Exception {
+	public void testCustomPartitionCountDoesNotOverridePartitioningIfSmaller()
+			throws Exception {
 		byte[] testPayload = new byte[2048];
 		Arrays.fill(testPayload, (byte) 65);
 		KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
@@ -1781,18 +1979,20 @@ public class KafkaBinderTests extends
 		QueueChannel moduleInputChannel = new QueueChannel();
 		ExtendedProducerProperties producerProperties = createProducerProperties();
 		producerProperties.setPartitionCount(5);
-		producerProperties.setPartitionKeyExpression(spelExpressionParser.parseExpression("payload"));
+		producerProperties.setPartitionKeyExpression(
+				spelExpressionParser.parseExpression("payload"));
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		long uniqueBindingId = System.currentTimeMillis();
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
 				createProducerBindingProperties(producerProperties));
-		Binding producerBinding = binder.bindProducer("foo" + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("foo" + uniqueBindingId + ".0", null,
-				moduleInputChannel, consumerProperties);
+		Binding producerBinding = binder.bindProducer(
+				"foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"foo" + uniqueBindingId + ".0", null, moduleInputChannel,
+				consumerProperties);
 		Thread.sleep(1000);
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload(testPayload)
-				.build();
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload).build();
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
 		moduleOutputChannel.send(message);
@@ -1811,24 +2011,29 @@ public class KafkaBinderTests extends
 		Binder binder = getBinder(createConfigurationProperties());
 		QueueChannel moduleInputChannel = new QueueChannel();
 		ExtendedProducerProperties producerProperties = createProducerProperties();
-		producerProperties.getExtension().getConfiguration().put("key.serializer", StringSerializer.class.getName());
-		producerProperties.getExtension().setMessageKeyExpression(spelExpressionParser.parseExpression("headers.key"));
+		producerProperties.getExtension().getConfiguration().put("key.serializer",
+				StringSerializer.class.getName());
+		producerProperties.getExtension().setMessageKeyExpression(
+				spelExpressionParser.parseExpression("headers.key"));
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		String uniqueBindingId = UUID.randomUUID().toString();
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
 				createProducerBindingProperties(producerProperties));
-		Binding producerBinding = binder.bindProducer("foo" + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("foo" + uniqueBindingId + ".0", null,
-				moduleInputChannel, consumerProperties);
+		Binding producerBinding = binder.bindProducer(
+				"foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"foo" + uniqueBindingId + ".0", null, moduleInputChannel,
+				consumerProperties);
 		Thread.sleep(1000);
-		Message message = MessageBuilder.withPayload("somePayload").setHeader("key", "myDynamicKey").build();
+		Message message = MessageBuilder.withPayload("somePayload")
+				.setHeader("key", "myDynamicKey").build();
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
 		moduleOutputChannel.send(message);
 		Message inbound = receive(moduleInputChannel);
 		assertThat(inbound).isNotNull();
-		String receivedKey = new String(inbound.getHeaders().get(KafkaHeaders.RECEIVED_MESSAGE_KEY, byte[].class));
+		String receivedKey = new String(inbound.getHeaders()
+				.get(KafkaHeaders.RECEIVED_MESSAGE_KEY, byte[].class));
 		assertThat(receivedKey).isEqualTo("myDynamicKey");
 		producerBinding.unbind();
 		consumerBinding.unbind();
@@ -1846,17 +2051,19 @@ public class KafkaBinderTests extends
 		QueueChannel moduleInputChannel = new QueueChannel();
 		ExtendedProducerProperties producerProperties = createProducerProperties();
 		producerProperties.setPartitionCount(5);
-		producerProperties.setPartitionKeyExpression(spelExpressionParser.parseExpression("payload"));
+		producerProperties.setPartitionKeyExpression(
+				spelExpressionParser.parseExpression("payload"));
 		DirectChannel moduleOutputChannel = createBindableChannel("output",
 				createProducerBindingProperties(producerProperties));
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		long uniqueBindingId = System.currentTimeMillis();
-		Binding producerBinding = binder.bindProducer("foo" + uniqueBindingId + ".0",
-				moduleOutputChannel, producerProperties);
-		Binding consumerBinding = binder.bindConsumer("foo" + uniqueBindingId + ".0", null,
-				moduleInputChannel, consumerProperties);
-		Message message = org.springframework.integration.support.MessageBuilder.withPayload(testPayload)
-				.build();
+		Binding producerBinding = binder.bindProducer(
+				"foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
+		Binding consumerBinding = binder.bindConsumer(
+				"foo" + uniqueBindingId + ".0", null, moduleInputChannel,
+				consumerProperties);
+		Message message = org.springframework.integration.support.MessageBuilder
+				.withPayload(testPayload).build();
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
 		moduleOutputChannel.send(message);
@@ -1873,22 +2080,24 @@ public class KafkaBinderTests extends
 	public void testDefaultConsumerStartsAtEarliest() throws Exception {
 		Binder binder = getBinder(createConfigurationProperties());
 
-		BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties());
+		BindingProperties producerBindingProperties = createProducerBindingProperties(
+				createProducerProperties());
 		DirectChannel output = createBindableChannel("output", producerBindingProperties);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 
-		DirectChannel input1 = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel input1 = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		String testTopicName = UUID.randomUUID().toString();
-		Binding producerBinding = binder.bindProducer(testTopicName, output,
-				createProducerProperties());
+		Binding producerBinding = binder.bindProducer(testTopicName,
+				output, createProducerProperties());
 		String testPayload1 = "foo-" + UUID.randomUUID().toString();
 		output.send(new GenericMessage<>(testPayload1.getBytes()));
 
-		Binding consumerBinding = binder.bindConsumer(testTopicName, "startOffsets", input1,
-				consumerProperties);
+		Binding consumerBinding = binder.bindConsumer(testTopicName,
+				"startOffsets", input1, consumerProperties);
 
 		CountDownLatch latch = new CountDownLatch(1);
 		AtomicReference> inboundMessageRef1 = new AtomicReference<>();
@@ -1903,7 +2112,9 @@ public class KafkaBinderTests extends
 		input1.subscribe(messageHandler);
 		Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
 		assertThat(inboundMessageRef1.get()).isNotNull();
-		assertThat(new String(inboundMessageRef1.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload1);
+		assertThat(
+				new String(inboundMessageRef1.get().getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo(testPayload1);
 
 		String testPayload2 = "foo-" + UUID.randomUUID().toString();
 		input1.unsubscribe(messageHandler);
@@ -1922,7 +2133,9 @@ public class KafkaBinderTests extends
 		Assert.isTrue(latch1.await(5, TimeUnit.SECONDS), "Failed to receive message");
 
 		assertThat(inboundMessageRef2.get()).isNotNull();
-		assertThat(new String(inboundMessageRef2.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload2);
+		assertThat(
+				new String(inboundMessageRef2.get().getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo(testPayload2);
 
 		producerBinding.unbind();
 		consumerBinding.unbind();
@@ -1938,10 +2151,13 @@ public class KafkaBinderTests extends
 			KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 			Binder binder = getBinder(configurationProperties);
 
-			BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties());
-			DirectChannel output = createBindableChannel("output", producerBindingProperties);
+			BindingProperties producerBindingProperties = createProducerBindingProperties(
+					createProducerProperties());
+			DirectChannel output = createBindableChannel("output",
+					producerBindingProperties);
 
-			DirectChannel input1 = createBindableChannel("input", createConsumerBindingProperties(createConsumerProperties()));
+			DirectChannel input1 = createBindableChannel("input",
+					createConsumerBindingProperties(createConsumerProperties()));
 
 			String testTopicName = UUID.randomUUID().toString();
 			producerBinding = binder.bindProducer(testTopicName, output,
@@ -1980,20 +2196,22 @@ public class KafkaBinderTests extends
 			input1.subscribe(messageHandler1);
 			String testPayload2 = "foo2-" + UUID.randomUUID().toString();
 			output.send(new GenericMessage<>(testPayload2.getBytes()));
-			Assert.isTrue(latch1.await(15, TimeUnit.SECONDS), "Failed to receive message");
+			Assert.isTrue(latch1.await(15, TimeUnit.SECONDS),
+					"Failed to receive message");
 			assertThat(inboundMessageRef2.get()).isNotNull();
 			assertThat(inboundMessageRef2.get().getPayload()).isNotNull();
 			consumerBinding.unbind();
 
 			Thread.sleep(2000);
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-			consumerBinding = binder.bindConsumer(testTopicName, "startOffsets", input1, consumerProperties);
+			consumerBinding = binder.bindConsumer(testTopicName, "startOffsets", input1,
+					consumerProperties);
 			input1.unsubscribe(messageHandler1);
 			CountDownLatch latch2 = new CountDownLatch(1);
 			AtomicReference> inboundMessageRef3 = new AtomicReference<>();
 			MessageHandler messageHandler2 = message1 -> {
 				try {
-					inboundMessageRef3.set((Message< byte[]>) message1);
+					inboundMessageRef3.set((Message) message1);
 				}
 				finally {
 					latch2.countDown();
@@ -2002,9 +2220,11 @@ public class KafkaBinderTests extends
 			input1.subscribe(messageHandler2);
 			String testPayload3 = "foo3-" + UUID.randomUUID().toString();
 			output.send(new GenericMessage<>(testPayload3.getBytes()));
-			Assert.isTrue(latch2.await(15, TimeUnit.SECONDS), "Failed to receive message");
+			Assert.isTrue(latch2.await(15, TimeUnit.SECONDS),
+					"Failed to receive message");
 			assertThat(inboundMessageRef3.get()).isNotNull();
-			assertThat(new String(inboundMessageRef3.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload3);
+			assertThat(new String(inboundMessageRef3.get().getPayload(),
+					StandardCharsets.UTF_8)).isEqualTo(testPayload3);
 		}
 		finally {
 			if (consumerBinding != null) {
@@ -2024,36 +2244,44 @@ public class KafkaBinderTests extends
 		String testTopicName = UUID.randomUUID().toString();
 		ExtendedProducerProperties properties = createProducerProperties();
 		properties.getExtension().setSync(true);
-		Binding producerBinding = binder.bindProducer(testTopicName, output, properties);
-		DirectFieldAccessor accessor = new DirectFieldAccessor(extractEndpoint(producerBinding));
-		KafkaProducerMessageHandler wrappedInstance = (KafkaProducerMessageHandler) accessor.getWrappedInstance();
-		assertThat(new DirectFieldAccessor(wrappedInstance).getPropertyValue("sync").equals(Boolean.TRUE))
-				.withFailMessage("Kafka Sync Producer should have been enabled.");
+		Binding producerBinding = binder.bindProducer(testTopicName,
+				output, properties);
+		DirectFieldAccessor accessor = new DirectFieldAccessor(
+				extractEndpoint(producerBinding));
+		KafkaProducerMessageHandler wrappedInstance = (KafkaProducerMessageHandler) accessor
+				.getWrappedInstance();
+		assertThat(new DirectFieldAccessor(wrappedInstance).getPropertyValue("sync")
+				.equals(Boolean.TRUE))
+						.withFailMessage("Kafka Sync Producer should have been enabled.");
 		producerBinding.unbind();
 	}
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testAutoCreateTopicsDisabledOnBinderStillWorksAsLongAsBrokerCreatesTopic() throws Exception {
+	public void testAutoCreateTopicsDisabledOnBinderStillWorksAsLongAsBrokerCreatesTopic()
+			throws Exception {
 		KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 		configurationProperties.setAutoCreateTopics(false);
 		Binder binder = getBinder(configurationProperties);
-		BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties());
+		BindingProperties producerBindingProperties = createProducerBindingProperties(
+				createProducerProperties());
 		DirectChannel output = createBindableChannel("output", producerBindingProperties);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
-		DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel input = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		String testTopicName = "createdByBroker-" + System.currentTimeMillis();
 
-		Binding producerBinding = binder.bindProducer(testTopicName, output,
-				producerBindingProperties.getProducer());
+		Binding producerBinding = binder.bindProducer(testTopicName,
+				output, producerBindingProperties.getProducer());
 
 		String testPayload = "foo1-" + UUID.randomUUID().toString();
 		output.send(new GenericMessage<>(testPayload));
 
-		Binding consumerBinding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
+		Binding consumerBinding = binder.bindConsumer(testTopicName,
+				"test", input, consumerProperties);
 		CountDownLatch latch = new CountDownLatch(1);
 		AtomicReference> inboundMessageRef = new AtomicReference<>();
 		input.subscribe(message1 -> {
@@ -2067,7 +2295,9 @@ public class KafkaBinderTests extends
 		Assert.isTrue(latch.await(5, TimeUnit.SECONDS), "Failed to receive message");
 
 		assertThat(inboundMessageRef.get()).isNotNull();
-		assertThat(new String(inboundMessageRef.get().getPayload(), StandardCharsets.UTF_8)).isEqualTo(testPayload);
+		assertThat(
+				new String(inboundMessageRef.get().getPayload(), StandardCharsets.UTF_8))
+						.isEqualTo(testPayload);
 
 		producerBinding.unbind();
 		consumerBinding.unbind();
@@ -2075,7 +2305,8 @@ public class KafkaBinderTests extends
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testAutoConfigureTopicsDisabledSucceedsIfTopicExisting() throws Throwable {
+	public void testAutoConfigureTopicsDisabledSucceedsIfTopicExisting()
+			throws Throwable {
 		KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 
 		String testTopicName = "existing" + System.currentTimeMillis();
@@ -2085,8 +2316,10 @@ public class KafkaBinderTests extends
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
-		DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
-		Binding binding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
+		DirectChannel input = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
+		Binding binding = binder.bindConsumer(testTopicName, "test",
+				input, consumerProperties);
 		binding.unbind();
 	}
 
@@ -2100,16 +2333,19 @@ public class KafkaBinderTests extends
 		configurationProperties.setAutoAddPartitions(true);
 		Binder binder = getBinder(configurationProperties);
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel input = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
-		Binding binding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
+		Binding binding = binder.bindConsumer(testTopicName, "test", input,
+				consumerProperties);
 		binding.unbind();
 		assertThat(invokePartitionSize(testTopicName)).isEqualTo(6);
 	}
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testAutoAddPartitionsDisabledSucceedsIfTopicUnderPartitionedAndAutoRebalanceEnabled() throws Throwable {
+	public void testAutoAddPartitionsDisabledSucceedsIfTopicUnderPartitionedAndAutoRebalanceEnabled()
+			throws Throwable {
 		KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 
 		String testTopicName = "existing" + System.currentTimeMillis();
@@ -2121,19 +2357,22 @@ public class KafkaBinderTests extends
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
-		DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel input = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
 		// this consumer must consume from partition 2
 		consumerProperties.setInstanceCount(3);
 		consumerProperties.setInstanceIndex(2);
-		Binding binding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
+		Binding binding = binder.bindConsumer(testTopicName, "test", input,
+				consumerProperties);
 		binding.unbind();
 		assertThat(invokePartitionSize(testTopicName)).isEqualTo(1);
 	}
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testAutoAddPartitionsDisabledFailsIfTopicUnderPartitionedAndAutoRebalanceDisabled() throws Throwable {
+	public void testAutoAddPartitionsDisabledFailsIfTopicUnderPartitionedAndAutoRebalanceDisabled()
+			throws Throwable {
 		KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 
 		String testTopicName = "existing" + System.currentTimeMillis();
@@ -2144,15 +2383,17 @@ public class KafkaBinderTests extends
 		context.refresh();
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		DirectChannel output = createBindableChannel("output", createConsumerBindingProperties(consumerProperties));
+		DirectChannel output = createBindableChannel("output",
+				createConsumerBindingProperties(consumerProperties));
 		// this consumer must consume from partition 2
 		consumerProperties.setInstanceCount(3);
 		consumerProperties.setInstanceIndex(2);
 		consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 		expectedProvisioningException.expect(ProvisioningException.class);
-		expectedProvisioningException
-				.expectMessage("The number of expected partitions was: 3, but 1 has been found instead");
-		Binding binding = binder.bindConsumer(testTopicName, "test", output, consumerProperties);
+		expectedProvisioningException.expectMessage(
+				"The number of expected partitions was: 3, but 1 has been found instead");
+		Binding binding = binder.bindConsumer(testTopicName, "test", output,
+				consumerProperties);
 		if (binding != null) {
 			binding.unbind();
 		}
@@ -2160,7 +2401,8 @@ public class KafkaBinderTests extends
 
 	@Test
 	@SuppressWarnings("unchecked")
-	public void testAutoAddPartitionsDisabledSucceedsIfTopicPartitionedCorrectly() throws Throwable {
+	public void testAutoAddPartitionsDisabledSucceedsIfTopicPartitionedCorrectly()
+			throws Throwable {
 		Binding binding = null;
 		try {
 			KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -2171,20 +2413,24 @@ public class KafkaBinderTests extends
 			Binder binder = getBinder(configurationProperties);
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 
-			DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel input = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 
 			// this consumer must consume from partition 2
 			consumerProperties.setInstanceCount(3);
 			consumerProperties.setInstanceIndex(2);
 			consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 
-			binding = binder.bindConsumer(testTopicName, "test-x", input, consumerProperties);
+			binding = binder.bindConsumer(testTopicName, "test-x", input,
+					consumerProperties);
 
-			TopicPartitionInitialOffset[] listenedPartitions = TestUtils.getPropertyValue(binding,
+			TopicPartitionInitialOffset[] listenedPartitions = TestUtils.getPropertyValue(
+					binding,
 					"lifecycle.messageListenerContainer.containerProperties.topicPartitions",
 					TopicPartitionInitialOffset[].class);
 			assertThat(listenedPartitions).hasSize(2);
-			assertThat(listenedPartitions).contains(new TopicPartitionInitialOffset(testTopicName, 2),
+			assertThat(listenedPartitions).contains(
+					new TopicPartitionInitialOffset(testTopicName, 2),
 					new TopicPartitionInitialOffset(testTopicName, 5));
 			int partitions = invokePartitionSize(testTopicName);
 			assertThat(partitions).isEqualTo(6);
@@ -2210,9 +2456,11 @@ public class KafkaBinderTests extends
 		context.refresh();
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-		DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+		DirectChannel input = createBindableChannel("input",
+				createConsumerBindingProperties(consumerProperties));
 
-		Binding binding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
+		Binding binding = binder.bindConsumer(testTopicName, "test", input,
+				consumerProperties);
 		binding.unbind();
 
 		assertThat(partitionSize(testTopicName)).isEqualTo(6);
@@ -2230,12 +2478,18 @@ public class KafkaBinderTests extends
 			Binder binder = getBinder(configurationProperties);
 
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-			DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel input = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 
-			binding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
-			DirectFieldAccessor consumerAccessor = new DirectFieldAccessor(getKafkaConsumer(binding));
-			assertTrue(consumerAccessor.getPropertyValue("keyDeserializer") instanceof ByteArrayDeserializer);
-			assertTrue(consumerAccessor.getPropertyValue("valueDeserializer") instanceof ByteArrayDeserializer);
+			binding = binder.bindConsumer(testTopicName, "test", input,
+					consumerProperties);
+			DirectFieldAccessor consumerAccessor = new DirectFieldAccessor(
+					getKafkaConsumer(binding));
+			assertThat(consumerAccessor
+					.getPropertyValue("keyDeserializer") instanceof ByteArrayDeserializer)
+							.isTrue();
+			assertThat(consumerAccessor.getPropertyValue(
+					"valueDeserializer") instanceof ByteArrayDeserializer).isTrue();
 		}
 		finally {
 			if (binding != null) {
@@ -2250,23 +2504,31 @@ public class KafkaBinderTests extends
 		Binding binding = null;
 		try {
 			KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
-			Map propertiesToOverride = configurationProperties.getConfiguration();
-			propertiesToOverride.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
-			propertiesToOverride.put("value.deserializer", "org.apache.kafka.common.serialization.LongDeserializer");
+			Map propertiesToOverride = configurationProperties
+					.getConfiguration();
+			propertiesToOverride.put("key.deserializer",
+					"org.apache.kafka.common.serialization.StringDeserializer");
+			propertiesToOverride.put("value.deserializer",
+					"org.apache.kafka.common.serialization.LongDeserializer");
 			configurationProperties.setConfiguration(propertiesToOverride);
 			String testTopicName = "existing" + System.currentTimeMillis();
 			configurationProperties.setAutoCreateTopics(false);
 			Binder binder = getBinder(configurationProperties);
 
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
-			DirectChannel input = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel input = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 
-			binding = binder.bindConsumer(testTopicName, "test", input, consumerProperties);
-			DirectFieldAccessor consumerAccessor = new DirectFieldAccessor(getKafkaConsumer(binding));
-			assertTrue("Expected StringDeserializer as a custom key deserializer",
-					consumerAccessor.getPropertyValue("keyDeserializer") instanceof StringDeserializer);
-			assertTrue("Expected LongDeserializer as a custom value deserializer",
-					consumerAccessor.getPropertyValue("valueDeserializer") instanceof LongDeserializer);
+			binding = binder.bindConsumer(testTopicName, "test", input,
+					consumerProperties);
+			DirectFieldAccessor consumerAccessor = new DirectFieldAccessor(
+					getKafkaConsumer(binding));
+			assertThat(consumerAccessor
+					.getPropertyValue("keyDeserializer") instanceof StringDeserializer)
+							.isTrue();
+			assertThat(consumerAccessor
+					.getPropertyValue("valueDeserializer") instanceof LongDeserializer)
+							.isTrue();
 		}
 		finally {
 			if (binding != null) {
@@ -2276,8 +2538,9 @@ public class KafkaBinderTests extends
 	}
 
 	@Test
-	@SuppressWarnings({"unchecked", "rawtypes"})
-	public void testNativeSerializationWithCustomSerializerDeserializer() throws Exception {
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public void testNativeSerializationWithCustomSerializerDeserializer()
+			throws Exception {
 		Binding producerBinding = null;
 		Binding consumerBinding = null;
 		try {
@@ -2293,13 +2556,16 @@ public class KafkaBinderTests extends
 			producerProperties.setUseNativeEncoding(true);
 			producerProperties.getExtension().getConfiguration().put("value.serializer",
 					"org.apache.kafka.common.serialization.IntegerSerializer");
-			producerBinding = binder.bindProducer(testTopicName, moduleOutputChannel, producerProperties);
+			producerBinding = binder.bindProducer(testTopicName, moduleOutputChannel,
+					producerProperties);
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 			consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 			consumerProperties.getExtension().getConfiguration().put("value.deserializer",
 					"org.apache.kafka.common.serialization.IntegerDeserializer");
-			consumerProperties.getExtension().setStandardHeaders(KafkaConsumerProperties.StandardHeaders.both);
-			consumerBinding = binder.bindConsumer(testTopicName, "test", moduleInputChannel, consumerProperties);
+			consumerProperties.getExtension()
+					.setStandardHeaders(KafkaConsumerProperties.StandardHeaders.both);
+			consumerBinding = binder.bindConsumer(testTopicName, "test",
+					moduleInputChannel, consumerProperties);
 			// Let the consumer actually bind to the producer before sending a msg
 			binderBindUnbindLatency();
 			moduleOutputChannel.send(message);
@@ -2325,31 +2591,32 @@ public class KafkaBinderTests extends
 		KafkaMessageDrivenChannelAdapter adapter = (KafkaMessageDrivenChannelAdapter) bindingAccessor
 				.getPropertyValue("lifecycle");
 		DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
-		ConcurrentMessageListenerContainer messageListenerContainer =
-				(ConcurrentMessageListenerContainer) adapterAccessor.getPropertyValue("messageListenerContainer");
-		DirectFieldAccessor containerAccessor = new DirectFieldAccessor(messageListenerContainer);
+		ConcurrentMessageListenerContainer messageListenerContainer = (ConcurrentMessageListenerContainer) adapterAccessor
+				.getPropertyValue("messageListenerContainer");
+		DirectFieldAccessor containerAccessor = new DirectFieldAccessor(
+				messageListenerContainer);
 		DefaultKafkaConsumerFactory consumerFactory = (DefaultKafkaConsumerFactory) containerAccessor
 				.getPropertyValue("consumerFactory");
 		return (KafkaConsumer) consumerFactory.createConsumer();
 	}
 
 	@Test
-	@SuppressWarnings({"unchecked", "rawtypes"})
-	public void testNativeSerializationWithCustomSerializerDeserializerBytesPayload() throws Exception {
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public void testNativeSerializationWithCustomSerializerDeserializerBytesPayload()
+			throws Exception {
 		Binding producerBinding = null;
 		Binding consumerBinding = null;
 		try {
 			byte[] testPayload = new byte[1];
 			Message message = MessageBuilder.withPayload(testPayload)
-					.setHeader(MessageHeaders.CONTENT_TYPE, "something/funky")
-					.build();
+					.setHeader(MessageHeaders.CONTENT_TYPE, "something/funky").build();
 			SubscribableChannel moduleOutputChannel = new DirectChannel();
 			String testTopicName = "existing" + System.currentTimeMillis();
 			KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 			configurationProperties.setAutoAddPartitions(true);
 			Binder binder = getBinder(configurationProperties);
-			ConfigurableApplicationContext context = TestUtils.getPropertyValue(binder, "binder.applicationContext",
-					ConfigurableApplicationContext.class);
+			ConfigurableApplicationContext context = TestUtils.getPropertyValue(binder,
+					"binder.applicationContext", ConfigurableApplicationContext.class);
 			MessagingMessageConverter converter = new MessagingMessageConverter();
 			converter.setGenerateMessageId(true);
 			converter.setGenerateTimestamp(true);
@@ -2357,17 +2624,19 @@ public class KafkaBinderTests extends
 			QueueChannel moduleInputChannel = new QueueChannel();
 			ExtendedProducerProperties producerProperties = createProducerProperties();
 			producerProperties.setUseNativeEncoding(true);
-			producerProperties.getExtension()
-					.getConfiguration()
-					.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getName());
-			producerBinding = binder.bindProducer(testTopicName, moduleOutputChannel, producerProperties);
+			producerProperties.getExtension().getConfiguration().put(
+					ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
+					ByteArraySerializer.class.getName());
+			producerBinding = binder.bindProducer(testTopicName, moduleOutputChannel,
+					producerProperties);
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 			consumerProperties.getExtension().setAutoRebalanceEnabled(false);
-			consumerProperties.getExtension()
-					.getConfiguration()
-					.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());
+			consumerProperties.getExtension().getConfiguration().put(
+					ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+					ByteArrayDeserializer.class.getName());
 			consumerProperties.getExtension().setConverterBeanName("testConverter");
-			consumerBinding = binder.bindConsumer(testTopicName, "test", moduleInputChannel, consumerProperties);
+			consumerBinding = binder.bindConsumer(testTopicName, "test",
+					moduleInputChannel, consumerProperties);
 			// Let the consumer actually bind to the producer before sending a msg
 			binderBindUnbindLatency();
 			moduleOutputChannel.send(message);
@@ -2375,7 +2644,8 @@ public class KafkaBinderTests extends
 			assertThat(inbound).isNotNull();
 			assertThat(inbound.getPayload()).isEqualTo(new byte[1]);
 			assertThat(inbound.getHeaders()).containsKey("contentType");
-			assertThat(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString()).isEqualTo("something/funky");
+			assertThat(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString())
+					.isEqualTo("something/funky");
 			assertThat(inbound.getHeaders().getId()).isNotNull();
 			assertThat(inbound.getHeaders().getTimestamp()).isNotNull();
 		}
@@ -2408,15 +2678,18 @@ public class KafkaBinderTests extends
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 			consumerProperties.getExtension().setAutoRebalanceEnabled(false);
 
-			DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel moduleInputChannel = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 
 			String testTopicName = "existing" + System.currentTimeMillis();
 			KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
 			configurationProperties.setAutoAddPartitions(true);
 			Binder binder = getBinder(configurationProperties);
-			producerBinding = binder.bindProducer(testTopicName, moduleOutputChannel, producerProperties);
+			producerBinding = binder.bindProducer(testTopicName, moduleOutputChannel,
+					producerProperties);
 
-			consumerBinding = binder.bindConsumer(testTopicName, "test", moduleInputChannel, consumerProperties);
+			consumerBinding = binder.bindConsumer(testTopicName, "test",
+					moduleInputChannel, consumerProperties);
 			// Let the consumer actually bind to the producer before sending a msg
 			binderBindUnbindLatency();
 			moduleOutputChannel.send(message);
@@ -2434,7 +2707,8 @@ public class KafkaBinderTests extends
 
 			assertThat(inboundMessageRef.get()).isNotNull();
 			assertThat(inboundMessageRef.get().getPayload()).isEqualTo("test".getBytes());
-			assertThat(inboundMessageRef.get().getHeaders()).containsEntry("contentType", MimeTypeUtils.TEXT_PLAIN);
+			assertThat(inboundMessageRef.get().getHeaders()).containsEntry("contentType",
+					MimeTypeUtils.TEXT_PLAIN);
 		}
 		finally {
 			if (producerBinding != null) {
@@ -2447,11 +2721,11 @@ public class KafkaBinderTests extends
 	}
 
 	/*
-	 * Verify that a consumer configured to handle embedded headers can handle
-	 * all three variants.
+	 * Verify that a consumer configured to handle embedded headers can handle all three
+	 * variants.
 	 */
 	@Test
-	@SuppressWarnings({"unchecked", "rawtypes"})
+	@SuppressWarnings({ "unchecked", "rawtypes" })
 	public void testSendAndReceiveWithMixedMode() throws Exception {
 		KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
 		binderConfiguration.setHeaders("foo");
@@ -2459,20 +2733,20 @@ public class KafkaBinderTests extends
 		DirectChannel moduleOutputChannel1 = new DirectChannel();
 		ExtendedProducerProperties producerProperties1 = createProducerProperties();
 		producerProperties1.setHeaderMode(HeaderMode.embeddedHeaders);
-		Binding producerBinding1 = binder.bindProducer("mixed.0", moduleOutputChannel1,
-				producerProperties1);
+		Binding producerBinding1 = binder.bindProducer("mixed.0",
+				moduleOutputChannel1, producerProperties1);
 
 		DirectChannel moduleOutputChannel2 = new DirectChannel();
 		ExtendedProducerProperties producerProperties2 = createProducerProperties();
 		producerProperties2.setHeaderMode(HeaderMode.headers);
-		Binding producerBinding2 = binder.bindProducer("mixed.0", moduleOutputChannel2,
-				producerProperties2);
+		Binding producerBinding2 = binder.bindProducer("mixed.0",
+				moduleOutputChannel2, producerProperties2);
 
 		DirectChannel moduleOutputChannel3 = new DirectChannel();
 		ExtendedProducerProperties producerProperties3 = createProducerProperties();
 		producerProperties3.setHeaderMode(HeaderMode.none);
-		Binding producerBinding3 = binder.bindProducer("mixed.0", moduleOutputChannel3,
-				producerProperties3);
+		Binding producerBinding3 = binder.bindProducer("mixed.0",
+				moduleOutputChannel3, producerProperties3);
 
 		ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 		consumerProperties.setHeaderMode(HeaderMode.embeddedHeaders);
@@ -2482,12 +2756,11 @@ public class KafkaBinderTests extends
 		BridgeHandler bridge = new BridgeHandler();
 		bridge.setOutputChannel(bridged);
 		moduleInputChannel.subscribe(bridge);
-		Binding consumerBinding = binder.bindConsumer("mixed.0", "test", moduleInputChannel,
-				consumerProperties);
+		Binding consumerBinding = binder.bindConsumer("mixed.0", "test",
+				moduleInputChannel, consumerProperties);
 		Message message = org.springframework.integration.support.MessageBuilder
 				.withPayload("testSendAndReceiveWithMixedMode".getBytes())
-				.setHeader("foo", "bar")
-				.build();
+				.setHeader("foo", "bar").build();
 		// Let the consumer actually bind to the producer before sending a msg
 		binderBindUnbindLatency();
 		moduleOutputChannel1.send(message);
@@ -2495,25 +2768,34 @@ public class KafkaBinderTests extends
 		moduleOutputChannel3.send(message);
 		Message inbound = receive(bridged, 10_000);
 		assertThat(inbound).isNotNull();
-		assertThat(new String((byte[])inbound.getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithMixedMode");
+		assertThat(new String((byte[]) inbound.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo("testSendAndReceiveWithMixedMode");
 		assertThat(inbound.getHeaders().get("foo")).isEqualTo("bar");
-		assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT)).isNull();
+		assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT))
+				.isNull();
 		inbound = receive(bridged);
 		assertThat(inbound).isNotNull();
-		assertThat(new String((byte[])inbound.getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithMixedMode");
+		assertThat(new String((byte[]) inbound.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo("testSendAndReceiveWithMixedMode");
 		assertThat(inbound.getHeaders().get("foo")).isEqualTo("bar");
-		assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT)).isEqualTo(Boolean.TRUE);
+		assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT))
+				.isEqualTo(Boolean.TRUE);
 		inbound = receive(bridged);
 		assertThat(inbound).isNotNull();
-		assertThat(new String((byte[])inbound.getPayload(), StandardCharsets.UTF_8)).isEqualTo("testSendAndReceiveWithMixedMode");
+		assertThat(new String((byte[]) inbound.getPayload(), StandardCharsets.UTF_8))
+				.isEqualTo("testSendAndReceiveWithMixedMode");
 		assertThat(inbound.getHeaders().get("foo")).isNull();
-		assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT)).isNull();
+		assertThat(inbound.getHeaders().get(BinderHeaders.NATIVE_HEADERS_PRESENT))
+				.isNull();
 
-		Map consumerProps = KafkaTestUtils.consumerProps("testSendAndReceiveWithMixedMode", "false",
+		Map consumerProps = KafkaTestUtils.consumerProps(
+				"testSendAndReceiveWithMixedMode", "false",
 				embeddedKafka.getEmbeddedKafka());
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
-		consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
-		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class);
+		consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
+		consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
+				ByteArrayDeserializer.class);
 		DefaultKafkaConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
 		Consumer consumer = cf.createConsumer();
 		consumer.subscribe(Collections.singletonList("mixed.0"));
@@ -2544,13 +2826,17 @@ public class KafkaBinderTests extends
 	@Test
 	public void testPolledConsumer() throws Exception {
 		KafkaTestBinder binder = getBinder();
-		PollableSource inboundBindTarget = new DefaultPollableMessageSource(this.messageConverter);
+		PollableSource inboundBindTarget = new DefaultPollableMessageSource(
+				this.messageConverter);
 		ExtendedConsumerProperties consumerProps = createConsumerProperties();
 		consumerProps.setMultiplex(true);
-		Binding> binding = binder.bindPollableConsumer("pollable,anotherOne", "group-polledConsumer",
-				inboundBindTarget, consumerProps);
-		Map producerProps = KafkaTestUtils.producerProps(embeddedKafka.getEmbeddedKafka());
-		KafkaTemplate template = new KafkaTemplate(new DefaultKafkaProducerFactory<>(producerProps));
+		Binding> binding = binder.bindPollableConsumer(
+				"pollable,anotherOne", "group-polledConsumer", inboundBindTarget,
+				consumerProps);
+		Map producerProps = KafkaTestUtils
+				.producerProps(embeddedKafka.getEmbeddedKafka());
+		KafkaTemplate template = new KafkaTemplate(
+				new DefaultKafkaProducerFactory<>(producerProps));
 		template.send("pollable", "testPollable");
 		boolean polled = inboundBindTarget.poll(m -> {
 			assertThat(m.getPayload()).isEqualTo("testPollable");
@@ -2577,11 +2863,14 @@ public class KafkaBinderTests extends
 		}
 		assertThat(polled).isTrue();
 		// Bind a second pollable consumer GH-521
-		consumerProps.getExtension().getConfiguration().put(ConsumerConfig.CLIENT_ID_CONFIG, "pollable2");
-		PollableSource second = new DefaultPollableMessageSource(this.messageConverter);
-		Binding> binding2 = binder.bindPollableConsumer("pollable2",
-				"group-polledConsumer2", second, consumerProps);
-		second.poll(m -> { });
+		consumerProps.getExtension().getConfiguration()
+				.put(ConsumerConfig.CLIENT_ID_CONFIG, "pollable2");
+		PollableSource second = new DefaultPollableMessageSource(
+				this.messageConverter);
+		Binding> binding2 = binder.bindPollableConsumer(
+				"pollable2", "group-polledConsumer2", second, consumerProps);
+		second.poll(m -> {
+		});
 		binding.unbind();
 		binding2.unbind();
 	}
@@ -2590,12 +2879,15 @@ public class KafkaBinderTests extends
 	@Test
 	public void testPolledConsumerRequeue() throws Exception {
 		KafkaTestBinder binder = getBinder();
-		PollableSource inboundBindTarget = new DefaultPollableMessageSource(this.messageConverter);
+		PollableSource inboundBindTarget = new DefaultPollableMessageSource(
+				this.messageConverter);
 		ExtendedConsumerProperties properties = createConsumerProperties();
-		Binding> binding = binder.bindPollableConsumer("pollableRequeue", "group",
-				inboundBindTarget, properties);
-		Map producerProps = KafkaTestUtils.producerProps(embeddedKafka.getEmbeddedKafka());
-		KafkaTemplate template = new KafkaTemplate(new DefaultKafkaProducerFactory<>(producerProps));
+		Binding> binding = binder.bindPollableConsumer(
+				"pollableRequeue", "group", inboundBindTarget, properties);
+		Map producerProps = KafkaTestUtils
+				.producerProps(embeddedKafka.getEmbeddedKafka());
+		KafkaTemplate template = new KafkaTemplate(
+				new DefaultKafkaProducerFactory<>(producerProps));
 		template.send("pollableRequeue", "testPollable");
 		try {
 			boolean polled = false;
@@ -2621,15 +2913,18 @@ public class KafkaBinderTests extends
 	@Test
 	public void testPolledConsumerWithDlq() throws Exception {
 		KafkaTestBinder binder = getBinder();
-		PollableSource inboundBindTarget = new DefaultPollableMessageSource(this.messageConverter);
+		PollableSource inboundBindTarget = new DefaultPollableMessageSource(
+				this.messageConverter);
 		ExtendedConsumerProperties properties = createConsumerProperties();
 		properties.setMaxAttempts(2);
 		properties.setBackOffInitialInterval(0);
 		properties.getExtension().setEnableDlq(true);
-		Map producerProps = KafkaTestUtils.producerProps(embeddedKafka.getEmbeddedKafka());
-		Binding> binding = binder.bindPollableConsumer("pollableDlq", "group-pcWithDlq",
-				inboundBindTarget, properties);
-		KafkaTemplate template = new KafkaTemplate(new DefaultKafkaProducerFactory<>(producerProps));
+		Map producerProps = KafkaTestUtils
+				.producerProps(embeddedKafka.getEmbeddedKafka());
+		Binding> binding = binder.bindPollableConsumer(
+				"pollableDlq", "group-pcWithDlq", inboundBindTarget, properties);
+		KafkaTemplate template = new KafkaTemplate(
+				new DefaultKafkaProducerFactory<>(producerProps));
 		template.send("pollableDlq", "testPollableDLQ");
 		try {
 			int n = 0;
@@ -2643,12 +2938,15 @@ public class KafkaBinderTests extends
 		catch (MessageHandlingException e) {
 			assertThat(e.getCause().getMessage()).isEqualTo("test DLQ");
 		}
-		Map consumerProps = KafkaTestUtils.consumerProps("dlq", "false", embeddedKafka.getEmbeddedKafka());
+		Map consumerProps = KafkaTestUtils.consumerProps("dlq", "false",
+				embeddedKafka.getEmbeddedKafka());
 		consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
 		ConsumerFactory cf = new DefaultKafkaConsumerFactory<>(consumerProps);
 		Consumer consumer = cf.createConsumer();
-		embeddedKafka.getEmbeddedKafka().consumeFromAnEmbeddedTopic(consumer, "error.pollableDlq.group-pcWithDlq");
-		ConsumerRecord deadLetter = KafkaTestUtils.getSingleRecord(consumer, "error.pollableDlq.group-pcWithDlq");
+		embeddedKafka.getEmbeddedKafka().consumeFromAnEmbeddedTopic(consumer,
+				"error.pollableDlq.group-pcWithDlq");
+		ConsumerRecord deadLetter = KafkaTestUtils.getSingleRecord(consumer,
+				"error.pollableDlq.group-pcWithDlq");
 		assertThat(deadLetter).isNotNull();
 		assertThat(deadLetter.value()).isEqualTo("testPollableDLQ");
 		binding.unbind();
@@ -2658,21 +2956,26 @@ public class KafkaBinderTests extends
 	@SuppressWarnings({ "rawtypes", "unchecked" })
 	@Test
 	public void testTopicPatterns() throws Exception {
-		try (AdminClient admin = AdminClient.create(Collections.singletonMap(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
-				embeddedKafka.getEmbeddedKafka().getBrokersAsString()))) {
-			admin.createTopics(Collections.singletonList(new NewTopic("topicPatterns.1", 1, (short) 1))).all().get();
+		try (AdminClient admin = AdminClient.create(
+				Collections.singletonMap(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
+						embeddedKafka.getEmbeddedKafka().getBrokersAsString()))) {
+			admin.createTopics(Collections
+					.singletonList(new NewTopic("topicPatterns.1", 1, (short) 1))).all()
+					.get();
 			Binder binder = getBinder();
 			ExtendedConsumerProperties consumerProperties = createConsumerProperties();
 			consumerProperties.getExtension().setDestinationIsPattern(true);
-			DirectChannel moduleInputChannel = createBindableChannel("input", createConsumerBindingProperties(consumerProperties));
+			DirectChannel moduleInputChannel = createBindableChannel("input",
+					createConsumerBindingProperties(consumerProperties));
 			final CountDownLatch latch = new CountDownLatch(1);
 			final AtomicReference topic = new AtomicReference<>();
 			moduleInputChannel.subscribe(m -> {
 				topic.set(m.getHeaders().get(KafkaHeaders.RECEIVED_TOPIC, String.class));
 				latch.countDown();
 			});
-			Binding consumerBinding = binder.bindConsumer("topicPatterns\\..*",
-					"testTopicPatterns", moduleInputChannel, consumerProperties);
+			Binding consumerBinding = binder.bindConsumer(
+					"topicPatterns\\..*", "testTopicPatterns", moduleInputChannel,
+					consumerProperties);
 			DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory(
 					KafkaTestUtils.producerProps(embeddedKafka.getEmbeddedKafka()));
 			KafkaTemplate template = new KafkaTemplate(pf);
@@ -2684,13 +2987,18 @@ public class KafkaBinderTests extends
 		}
 	}
 
-	@Test (expected = TopicExistsException.class)
+	@Test(expected = TopicExistsException.class)
 	public void testSameTopicCannotBeProvisionedAgain() throws Throwable {
-		try (AdminClient admin = AdminClient.create(Collections.singletonMap(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
-				embeddedKafka.getEmbeddedKafka().getBrokersAsString()))) {
-			admin.createTopics(Collections.singletonList(new NewTopic("fooUniqueTopic", 1, (short) 1))).all().get();
+		try (AdminClient admin = AdminClient.create(
+				Collections.singletonMap(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
+						embeddedKafka.getEmbeddedKafka().getBrokersAsString()))) {
+			admin.createTopics(Collections
+					.singletonList(new NewTopic("fooUniqueTopic", 1, (short) 1))).all()
+					.get();
 			try {
-				admin.createTopics(Collections.singletonList(new NewTopic("fooUniqueTopic", 1, (short) 1))).all().get();
+				admin.createTopics(Collections
+						.singletonList(new NewTopic("fooUniqueTopic", 1, (short) 1)))
+						.all().get();
 			}
 			catch (Exception ex) {
 				assertThat(ex.getCause() instanceof TopicExistsException).isTrue();
@@ -2699,7 +3007,8 @@ public class KafkaBinderTests extends
 		}
 	}
 
-	private final class FailingInvocationCountingMessageHandler implements MessageHandler {
+	private final class FailingInvocationCountingMessageHandler
+			implements MessageHandler {
 
 		private int invocationCount;
 
@@ -2718,7 +3027,8 @@ public class KafkaBinderTests extends
 		@Override
 		public void handleMessage(Message message) throws MessagingException {
 			invocationCount++;
-			Long offset = message.getHeaders().get(KafkaBinderTests.this.getKafkaOffsetHeaderKey(), Long.class);
+			Long offset = message.getHeaders()
+					.get(KafkaBinderTests.this.getKafkaOffsetHeaderKey(), Long.class);
 			// using the offset as key allows to ensure that we don't store duplicate
 			// messages on retry
 			if (!receivedMessages.containsKey(offset)) {
@@ -2739,5 +3049,7 @@ public class KafkaBinderTests extends
 		public CountDownLatch getLatch() {
 			return latch;
 		}
+
 	}
+
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderUnitTests.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderUnitTests.java
index 6dcf4862e..b5f95231e 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderUnitTests.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderUnitTests.java
@@ -72,87 +72,108 @@ public class KafkaBinderUnitTests {
 	@Test
 	public void testPropertyOverrides() throws Exception {
 		KafkaProperties kafkaProperties = new TestKafkaProperties();
-		KafkaBinderConfigurationProperties binderConfigurationProperties =
-				new KafkaBinderConfigurationProperties(kafkaProperties);
-		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(binderConfigurationProperties, kafkaProperties);
-		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(binderConfigurationProperties,
-				provisioningProvider);
+		KafkaBinderConfigurationProperties binderConfigurationProperties = new KafkaBinderConfigurationProperties(
+				kafkaProperties);
+		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(
+				binderConfigurationProperties, kafkaProperties);
+		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(
+				binderConfigurationProperties, provisioningProvider);
 		KafkaConsumerProperties consumerProps = new KafkaConsumerProperties();
-		ExtendedConsumerProperties ecp =
-				new ExtendedConsumerProperties(consumerProps);
-		Method method = KafkaMessageChannelBinder.class.getDeclaredMethod("createKafkaConsumerFactory", boolean.class,
-				String.class, ExtendedConsumerProperties.class);
+		ExtendedConsumerProperties ecp = new ExtendedConsumerProperties(
+				consumerProps);
+		Method method = KafkaMessageChannelBinder.class.getDeclaredMethod(
+				"createKafkaConsumerFactory", boolean.class, String.class,
+				ExtendedConsumerProperties.class);
 		method.setAccessible(true);
 
 		// test default for anon
 		Object factory = method.invoke(binder, true, "foo-1", ecp);
 		Map configs = TestUtils.getPropertyValue(factory, "configs", Map.class);
-		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("latest");
+		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG))
+				.isEqualTo("latest");
 
 		// test default for named
 		factory = method.invoke(binder, false, "foo-2", ecp);
 		configs = TestUtils.getPropertyValue(factory, "configs", Map.class);
-		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("earliest");
+		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG))
+				.isEqualTo("earliest");
 
 		// binder level setting
-		binderConfigurationProperties.setConfiguration(
-				Collections.singletonMap(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest"));
+		binderConfigurationProperties.setConfiguration(Collections
+				.singletonMap(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest"));
 		factory = method.invoke(binder, false, "foo-3", ecp);
 		configs = TestUtils.getPropertyValue(factory, "configs", Map.class);
-		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("latest");
+		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG))
+				.isEqualTo("latest");
 
 		// consumer level setting
-		consumerProps.setConfiguration(Collections.singletonMap(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"));
+		consumerProps.setConfiguration(Collections
+				.singletonMap(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"));
 		factory = method.invoke(binder, false, "foo-4", ecp);
 		configs = TestUtils.getPropertyValue(factory, "configs", Map.class);
-		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("earliest");
+		assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG))
+				.isEqualTo("earliest");
 	}
 
 	@Test
 	public void testMergedConsumerProperties() {
 		KafkaProperties bootProps = new TestKafkaProperties();
-		bootProps.getConsumer().getProperties().put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "bar");
-		KafkaBinderConfigurationProperties props = new KafkaBinderConfigurationProperties(bootProps);
-		assertThat(props.mergedConsumerConfiguration().get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("bar");
+		bootProps.getConsumer().getProperties()
+				.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "bar");
+		KafkaBinderConfigurationProperties props = new KafkaBinderConfigurationProperties(
+				bootProps);
+		assertThat(props.mergedConsumerConfiguration()
+				.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("bar");
 		props.getConfiguration().put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "baz");
-		assertThat(props.mergedConsumerConfiguration().get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("baz");
+		assertThat(props.mergedConsumerConfiguration()
+				.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("baz");
 		props.getConsumerProperties().put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "qux");
-		assertThat(props.mergedConsumerConfiguration().get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("qux");
+		assertThat(props.mergedConsumerConfiguration()
+				.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)).isEqualTo("qux");
 	}
 
 	@Test
 	public void testMergedProducerProperties() {
 		KafkaProperties bootProps = new TestKafkaProperties();
 		bootProps.getProducer().getProperties().put(ProducerConfig.RETRIES_CONFIG, "bar");
-		KafkaBinderConfigurationProperties props = new KafkaBinderConfigurationProperties(bootProps);
-		assertThat(props.mergedProducerConfiguration().get(ProducerConfig.RETRIES_CONFIG)).isEqualTo("bar");
+		KafkaBinderConfigurationProperties props = new KafkaBinderConfigurationProperties(
+				bootProps);
+		assertThat(props.mergedProducerConfiguration().get(ProducerConfig.RETRIES_CONFIG))
+				.isEqualTo("bar");
 		props.getConfiguration().put(ProducerConfig.RETRIES_CONFIG, "baz");
-		assertThat(props.mergedProducerConfiguration().get(ProducerConfig.RETRIES_CONFIG)).isEqualTo("baz");
+		assertThat(props.mergedProducerConfiguration().get(ProducerConfig.RETRIES_CONFIG))
+				.isEqualTo("baz");
 		props.getProducerProperties().put(ProducerConfig.RETRIES_CONFIG, "qux");
-		assertThat(props.mergedProducerConfiguration().get(ProducerConfig.RETRIES_CONFIG)).isEqualTo("qux");
+		assertThat(props.mergedProducerConfiguration().get(ProducerConfig.RETRIES_CONFIG))
+				.isEqualTo("qux");
 	}
 
 	@Test
 	public void testOffsetResetWithGroupManagementEarliest() throws Exception {
-		testOffsetResetWithGroupManagement(true, true, "foo-100", "testOffsetResetWithGroupManagementEarliest");
+		testOffsetResetWithGroupManagement(true, true, "foo-100",
+				"testOffsetResetWithGroupManagementEarliest");
 	}
 
 	@Test
 	public void testOffsetResetWithGroupManagementLatest() throws Throwable {
-		testOffsetResetWithGroupManagement(false, true, "foo-101", "testOffsetResetWithGroupManagementLatest");
+		testOffsetResetWithGroupManagement(false, true, "foo-101",
+				"testOffsetResetWithGroupManagementLatest");
 	}
 
 	@Test
 	public void testOffsetResetWithManualAssignmentEarliest() throws Exception {
-		testOffsetResetWithGroupManagement(true, false, "foo-102", "testOffsetResetWithManualAssignmentEarliest");
+		testOffsetResetWithGroupManagement(true, false, "foo-102",
+				"testOffsetResetWithManualAssignmentEarliest");
 	}
 
 	@Test
 	public void testOffsetResetWithGroupManualAssignmentLatest() throws Throwable {
-		testOffsetResetWithGroupManagement(false, false, "foo-103", "testOffsetResetWithGroupManualAssignmentLatest");
+		testOffsetResetWithGroupManagement(false, false, "foo-103",
+				"testOffsetResetWithGroupManualAssignmentLatest");
 	}
 
-	private void testOffsetResetWithGroupManagement(final boolean earliest, boolean groupManage, String topic, String group) throws Exception {
+	private void testOffsetResetWithGroupManagement(final boolean earliest,
+			boolean groupManage, String topic, String group) throws Exception {
 		final List partitions = new ArrayList<>();
 		partitions.add(new TopicPartition(topic, 0));
 		partitions.add(new TopicPartition(topic, 1));
@@ -161,13 +182,15 @@ public class KafkaBinderUnitTests {
 		KafkaTopicProvisioner provisioningProvider = mock(KafkaTopicProvisioner.class);
 		ConsumerDestination dest = mock(ConsumerDestination.class);
 		given(dest.getName()).willReturn(topic);
-		given(provisioningProvider.provisionConsumerDestination(anyString(), anyString(), any())).willReturn(dest);
+		given(provisioningProvider.provisionConsumerDestination(anyString(), anyString(),
+				any())).willReturn(dest);
 		final AtomicInteger part = new AtomicInteger();
 		willAnswer(i -> {
-			return partitions.stream()
-					.map(p -> new PartitionInfo(topic, part.getAndIncrement(), null, null, null))
+			return partitions.stream().map(p -> new PartitionInfo(topic,
+					part.getAndIncrement(), null, null, null))
 					.collect(Collectors.toList());
-		}).given(provisioningProvider).getPartitionsForTopic(anyInt(), anyBoolean(), any(), any());
+		}).given(provisioningProvider).getPartitionsForTopic(anyInt(), anyBoolean(),
+				any(), any());
 		@SuppressWarnings("unchecked")
 		final Consumer consumer = mock(Consumer.class);
 		final CountDownLatch latch = new CountDownLatch(1);
@@ -181,8 +204,8 @@ public class KafkaBinderUnitTests {
 			return new ConsumerRecords<>(Collections.emptyMap());
 		}).given(consumer).poll(any(Duration.class));
 		willAnswer(i -> {
-			((org.apache.kafka.clients.consumer.ConsumerRebalanceListener) i.getArgument(1))
-					.onPartitionsAssigned(partitions);
+			((org.apache.kafka.clients.consumer.ConsumerRebalanceListener) i
+					.getArgument(1)).onPartitionsAssigned(partitions);
 			latch.countDown();
 			return null;
 		}).given(consumer).subscribe(eq(Collections.singletonList(topic)), any());
@@ -194,11 +217,13 @@ public class KafkaBinderUnitTests {
 			latch.countDown();
 			return null;
 		}).given(consumer).seekToEnd(any());
-		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(configurationProperties, provisioningProvider) {
+		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(
+				configurationProperties, provisioningProvider) {
 
 			@Override
-			protected ConsumerFactory createKafkaConsumerFactory(boolean anonymous, String consumerGroup,
-																	ExtendedConsumerProperties consumerProperties) {
+			protected ConsumerFactory createKafkaConsumerFactory(boolean anonymous,
+					String consumerGroup,
+					ExtendedConsumerProperties consumerProperties) {
 
 				return new ConsumerFactory() {
 
@@ -213,12 +238,14 @@ public class KafkaBinderUnitTests {
 					}
 
 					@Override
-					public Consumer createConsumer(String arg0, String arg1) {
+					public Consumer createConsumer(String arg0,
+							String arg1) {
 						return consumer;
 					}
 
 					@Override
-					public Consumer createConsumer(String groupId, String clientIdPrefix, String clientIdSuffix) {
+					public Consumer createConsumer(String groupId,
+							String clientIdPrefix, String clientIdSuffix) {
 						return consumer;
 					}
 
@@ -247,10 +274,11 @@ public class KafkaBinderUnitTests {
 		KafkaConsumerProperties extension = new KafkaConsumerProperties();
 		extension.setResetOffsets(true);
 		extension.setAutoRebalanceEnabled(groupManage);
-		ExtendedConsumerProperties consumerProperties = new ExtendedConsumerProperties(
+		ExtendedConsumerProperties consumerProperties = new ExtendedConsumerProperties<>(
 				extension);
 		consumerProperties.setInstanceCount(1);
-		Binding messageChannelBinding = binder.bindConsumer(topic, group, channel, consumerProperties);
+		Binding messageChannelBinding = binder.bindConsumer(topic, group,
+				channel, consumerProperties);
 		assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
 		@SuppressWarnings("unchecked")
 		ArgumentCaptor> captor = ArgumentCaptor.forClass(Set.class);
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTestBinder.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTestBinder.java
index 20b6fd572..bf77d1fe3 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTestBinder.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTestBinder.java
@@ -38,28 +38,31 @@ import org.springframework.kafka.support.ProducerListener;
  */
 public class KafkaTestBinder extends AbstractKafkaTestBinder {
 
-	@SuppressWarnings({"rawtypes", "unchecked"})
-	KafkaTestBinder(KafkaBinderConfigurationProperties binderConfiguration, KafkaTopicProvisioner kafkaTopicProvisioner) {
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	KafkaTestBinder(KafkaBinderConfigurationProperties binderConfiguration,
+			KafkaTopicProvisioner kafkaTopicProvisioner) {
 		try {
-			KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(binderConfiguration,
-					kafkaTopicProvisioner) {
+			KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(
+					binderConfiguration, kafkaTopicProvisioner) {
 
 				/*
-				 * Some tests use multiple instance indexes for the same topic; we need to make
-				 * the error infrastructure beans unique.
+				 * Some tests use multiple instance indexes for the same topic; we need to
+				 * make the error infrastructure beans unique.
 				 */
 				@Override
-				protected String errorsBaseName(ConsumerDestination destination, String group,
-												ExtendedConsumerProperties consumerProperties) {
-					return super.errorsBaseName(destination, group, consumerProperties) + "-"
-							+ consumerProperties.getInstanceIndex();
+				protected String errorsBaseName(ConsumerDestination destination,
+						String group,
+						ExtendedConsumerProperties consumerProperties) {
+					return super.errorsBaseName(destination, group, consumerProperties)
+							+ "-" + consumerProperties.getInstanceIndex();
 				}
 
 			};
 
 			ProducerListener producerListener = new LoggingProducerListener();
 			binder.setProducerListener(producerListener);
-			AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
+			AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
+					Config.class);
 			setApplicationContext(context);
 			binder.setApplicationContext(context);
 			binder.afterPropertiesSet();
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTransactionTests.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTransactionTests.java
index 4aaa9e035..88ce1c39d 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTransactionTests.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaTransactionTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -61,22 +61,28 @@ public class KafkaTransactionTests {
 	@Test
 	public void testProducerRunsInTx() {
 		KafkaProperties kafkaProperties = new TestKafkaProperties();
-		kafkaProperties.setBootstrapServers(Collections.singletonList(embeddedKafka.getEmbeddedKafka().getBrokersAsString()));
-		KafkaBinderConfigurationProperties configurationProperties =
-				new KafkaBinderConfigurationProperties(kafkaProperties);
+		kafkaProperties.setBootstrapServers(Collections
+				.singletonList(embeddedKafka.getEmbeddedKafka().getBrokersAsString()));
+		KafkaBinderConfigurationProperties configurationProperties = new KafkaBinderConfigurationProperties(
+				kafkaProperties);
 		configurationProperties.getTransaction().setTransactionIdPrefix("foo-");
 		configurationProperties.getTransaction().getProducer().setUseNativeEncoding(true);
-		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(configurationProperties, kafkaProperties);
+		KafkaTopicProvisioner provisioningProvider = new KafkaTopicProvisioner(
+				configurationProperties, kafkaProperties);
 		provisioningProvider.setMetadataRetryOperations(new RetryTemplate());
 		final Producer mockProducer = mock(Producer.class);
-		willReturn(Collections.singletonList(new TopicPartition("foo", 0))).given(mockProducer).partitionsFor(anyString());
-		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(configurationProperties, provisioningProvider) {
+		willReturn(Collections.singletonList(new TopicPartition("foo", 0)))
+				.given(mockProducer).partitionsFor(anyString());
+		KafkaMessageChannelBinder binder = new KafkaMessageChannelBinder(
+				configurationProperties, provisioningProvider) {
 
 			@Override
-			protected DefaultKafkaProducerFactory getProducerFactory(String transactionIdPrefix,
+			protected DefaultKafkaProducerFactory getProducerFactory(
+					String transactionIdPrefix,
 					ExtendedProducerProperties producerProperties) {
-				DefaultKafkaProducerFactory producerFactory =
-						spy(super.getProducerFactory(transactionIdPrefix, producerProperties));
+				DefaultKafkaProducerFactory producerFactory = spy(
+						super.getProducerFactory(transactionIdPrefix,
+								producerProperties));
 				willReturn(mockProducer).given(producerFactory).createProducer();
 				return producerFactory;
 			}
@@ -87,7 +93,8 @@ public class KafkaTransactionTests {
 		binder.setApplicationContext(applicationContext);
 		DirectChannel channel = new DirectChannel();
 		KafkaProducerProperties extension = new KafkaProducerProperties();
-		ExtendedProducerProperties properties = new ExtendedProducerProperties<>(extension);
+		ExtendedProducerProperties properties = new ExtendedProducerProperties<>(
+				extension);
 		binder.bindProducer("foo", channel, properties);
 		channel.send(new GenericMessage<>("foo".getBytes()));
 		InOrder inOrder = inOrder(mockProducer);
@@ -96,8 +103,8 @@ public class KafkaTransactionTests {
 		inOrder.verify(mockProducer).commitTransaction();
 		inOrder.verify(mockProducer).close();
 		inOrder.verifyNoMoreInteractions();
-		assertThat(TestUtils.getPropertyValue(channel, "dispatcher.theOneHandler.useNativeEncoding", Boolean.class))
-				.isTrue();
+		assertThat(TestUtils.getPropertyValue(channel,
+				"dispatcher.theOneHandler.useNativeEncoding", Boolean.class)).isTrue();
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/RawKafkaPartitionTestSupport.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/RawKafkaPartitionTestSupport.java
index b0f8da029..9e474ba0b 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/RawKafkaPartitionTestSupport.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/RawKafkaPartitionTestSupport.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,7 +23,8 @@ import org.springframework.messaging.Message;
 /**
  * @author Marius Bogoevici
  */
-public class RawKafkaPartitionTestSupport implements PartitionKeyExtractorStrategy, PartitionSelectorStrategy {
+public class RawKafkaPartitionTestSupport
+		implements PartitionKeyExtractorStrategy, PartitionSelectorStrategy {
 
 	@Override
 	public int selectPartition(Object key, int divisor) {
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/TestKafkaProperties.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/TestKafkaProperties.java
index cf52d42e8..e03a9e9e3 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/TestKafkaProperties.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/TestKafkaProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/bootstrap/KafkaBinderBootstrapTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/bootstrap/KafkaBinderBootstrapTest.java
index a4de2c2ac..01dd42c10 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/bootstrap/KafkaBinderBootstrapTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/bootstrap/KafkaBinderBootstrapTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,15 +35,18 @@ public class KafkaBinderBootstrapTest {
 
 	@Test
 	public void testKafkaBinderConfiguration() throws Exception {
-		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(SimpleApplication.class)
-				.web(WebApplicationType.NONE)
-				.run("--spring.cloud.stream.kafka.binder.brokers=" + embeddedKafka.getEmbeddedKafka().getBrokersAsString(),
-					"--spring.cloud.stream.kafka.binder.zkNodes=" + embeddedKafka.getEmbeddedKafka().getZookeeperConnectionString());
+		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(
+				SimpleApplication.class).web(WebApplicationType.NONE).run(
+						"--spring.cloud.stream.kafka.binder.brokers="
+								+ embeddedKafka.getEmbeddedKafka().getBrokersAsString(),
+						"--spring.cloud.stream.kafka.binder.zkNodes=" + embeddedKafka
+								.getEmbeddedKafka().getZookeeperConnectionString());
 		applicationContext.close();
 	}
 
 	@SpringBootApplication
 	static class SimpleApplication {
+
 	}
 
 }
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderActuatorTests.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderActuatorTests.java
index 926b0ed3b..f36785045 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderActuatorTests.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderActuatorTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -52,12 +52,13 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author Artem Bilan
  * @author Oleg Zhurakousky
  * @author Jon Schneider
- *
  * @since 2.0
  */
 @RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
-		properties = "spring.cloud.stream.bindings.input.group=" + KafkaBinderActuatorTests.TEST_CONSUMER_GROUP)
+// @checkstyle:off
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = "spring.cloud.stream.bindings.input.group="
+		+ KafkaBinderActuatorTests.TEST_CONSUMER_GROUP)
+// @checkstyle:on
 public class KafkaBinderActuatorTests {
 
 	static final String TEST_CONSUMER_GROUP = "testGroup-actuatorTests";
@@ -69,7 +70,8 @@ public class KafkaBinderActuatorTests {
 
 	@BeforeClass
 	public static void setup() {
-		System.setProperty(KAFKA_BROKERS_PROPERTY, kafkaEmbedded.getEmbeddedKafka().getBrokersAsString());
+		System.setProperty(KAFKA_BROKERS_PROPERTY,
+				kafkaEmbedded.getEmbeddedKafka().getBrokersAsString());
 	}
 
 	@AfterClass
@@ -89,26 +91,30 @@ public class KafkaBinderActuatorTests {
 		this.kafkaTemplate.flush();
 
 		assertThat(this.meterRegistry.get("spring.cloud.stream.binder.kafka.offset")
-				.tag("group", TEST_CONSUMER_GROUP)
-				.tag("topic", Sink.INPUT)
-				.gauge().value()).isGreaterThan(0);
+				.tag("group", TEST_CONSUMER_GROUP).tag("topic", Sink.INPUT).gauge()
+				.value()).isGreaterThan(0);
 	}
 
 	@Test
 	public void testKafkaBinderMetricsWhenNoMicrometer() {
-		new ApplicationContextRunner()
-				.withUserConfiguration(KafkaMetricsTestConfig.class)
+		new ApplicationContextRunner().withUserConfiguration(KafkaMetricsTestConfig.class)
 				.withClassLoader(new FilteredClassLoader("io.micrometer.core"))
 				.run(context -> {
-					assertThat(context.getBeanNamesForType(MeterRegistry.class)).isEmpty();
+					assertThat(context.getBeanNamesForType(MeterRegistry.class))
+							.isEmpty();
 					assertThat(context.getBeanNamesForType(MeterBinder.class)).isEmpty();
 
-					DirectFieldAccessor channelBindingServiceAccessor = new DirectFieldAccessor(context.getBean(BindingService.class));
+					DirectFieldAccessor channelBindingServiceAccessor = new DirectFieldAccessor(
+							context.getBean(BindingService.class));
+					// @checkstyle:off
 					@SuppressWarnings("unchecked")
 					Map>> consumerBindings = (Map>>) channelBindingServiceAccessor
 							.getPropertyValue("consumerBindings");
-					assertThat(new DirectFieldAccessor(consumerBindings.get("input").get(0)).getPropertyValue("lifecycle.messageListenerContainer.beanName"))
-						.isEqualTo("setByCustomizer:input");
+					// @checkstyle:on
+					assertThat(new DirectFieldAccessor(
+							consumerBindings.get("input").get(0)).getPropertyValue(
+									"lifecycle.messageListenerContainer.beanName"))
+											.isEqualTo("setByCustomizer:input");
 				});
 	}
 
diff --git a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java
index 9a1009ae1..f6effa631 100644
--- a/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java
+++ b/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,17 +60,18 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author Gary Russell
  */
 @RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
-properties = {"spring.cloud.stream.kafka.bindings.standard-out.producer.configuration.key.serializer=FooSerializer.class",
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = {
+		"spring.cloud.stream.kafka.bindings.standard-out.producer.configuration.key.serializer=FooSerializer.class",
 		"spring.cloud.stream.kafka.default.producer.configuration.key.serializer=BarSerializer.class",
 		"spring.cloud.stream.kafka.default.producer.configuration.value.serializer=BarSerializer.class",
 		"spring.cloud.stream.kafka.bindings.standard-in.consumer.configuration.key.serializer=FooSerializer.class",
 		"spring.cloud.stream.kafka.default.consumer.configuration.key.serializer=BarSerializer.class",
 		"spring.cloud.stream.kafka.default.consumer.configuration.value.serializer=BarSerializer.class",
 		"spring.cloud.stream.kafka.default.producer.configuration.foo=bar",
-		"spring.cloud.stream.kafka.bindings.standard-out.producer.configuration.foo=bindingSpecificPropertyShouldWinOverDefault",
+		"spring.cloud.stream.kafka.bindings.standard-out.producer.configuration.foo="
+				+ "bindingSpecificPropertyShouldWinOverDefault",
 		"spring.cloud.stream.kafka.default.consumer.ackEachRecord=true",
-		"spring.cloud.stream.kafka.bindings.custom-in.consumer.ackEachRecord=false"})
+		"spring.cloud.stream.kafka.bindings.custom-in.consumer.ackEachRecord=false" })
 public class KafkaBinderExtendedPropertiesTest {
 
 	private static final String KAFKA_BROKERS_PROPERTY = "spring.cloud.stream.kafka.binder.brokers";
@@ -80,7 +81,8 @@ public class KafkaBinderExtendedPropertiesTest {
 
 	@BeforeClass
 	public static void setup() {
-		System.setProperty(KAFKA_BROKERS_PROPERTY, kafkaEmbedded.getEmbeddedKafka().getBrokersAsString());
+		System.setProperty(KAFKA_BROKERS_PROPERTY,
+				kafkaEmbedded.getEmbeddedKafka().getBrokersAsString());
 	}
 
 	@AfterClass
@@ -94,50 +96,73 @@ public class KafkaBinderExtendedPropertiesTest {
 	@Test
 	public void testKafkaBinderExtendedProperties() throws Exception {
 
-		BinderFactory binderFactory = context.getBeanFactory().getBean(BinderFactory.class);
-		Binder kafkaBinder =
-				binderFactory.getBinder("kafka", MessageChannel.class);
+		BinderFactory binderFactory = context.getBeanFactory()
+				.getBean(BinderFactory.class);
+		Binder kafkaBinder = binderFactory
+				.getBinder("kafka", MessageChannel.class);
 
-		KafkaProducerProperties kafkaProducerProperties =
-				(KafkaProducerProperties)((ExtendedPropertiesBinder) kafkaBinder).getExtendedProducerProperties("standard-out");
+		KafkaProducerProperties kafkaProducerProperties = (KafkaProducerProperties) ((ExtendedPropertiesBinder) kafkaBinder)
+				.getExtendedProducerProperties("standard-out");
 
-		//binding "standard-out" gets FooSerializer defined on the binding itself and BarSerializer through default property.
-		assertThat(kafkaProducerProperties.getConfiguration().get("key.serializer")).isEqualTo("FooSerializer.class");
-		assertThat(kafkaProducerProperties.getConfiguration().get("value.serializer")).isEqualTo("BarSerializer.class");
+		// binding "standard-out" gets FooSerializer defined on the binding itself
+		// and BarSerializer through default property.
+		assertThat(kafkaProducerProperties.getConfiguration().get("key.serializer"))
+				.isEqualTo("FooSerializer.class");
+		assertThat(kafkaProducerProperties.getConfiguration().get("value.serializer"))
+				.isEqualTo("BarSerializer.class");
 
-		assertThat(kafkaProducerProperties.getConfiguration().get("foo")).isEqualTo("bindingSpecificPropertyShouldWinOverDefault");
+		assertThat(kafkaProducerProperties.getConfiguration().get("foo"))
+				.isEqualTo("bindingSpecificPropertyShouldWinOverDefault");
 
-		KafkaConsumerProperties kafkaConsumerProperties =
-				(KafkaConsumerProperties)((ExtendedPropertiesBinder) kafkaBinder).getExtendedConsumerProperties("standard-in");
+		// @checkstyle:off
+		KafkaConsumerProperties kafkaConsumerProperties = (KafkaConsumerProperties) ((ExtendedPropertiesBinder) kafkaBinder)
+				.getExtendedConsumerProperties("standard-in");
+		// @checkstyle:on
+		// binding "standard-in" gets FooSerializer defined on the binding itself
+		// and BarSerializer through default property.
+		assertThat(kafkaConsumerProperties.getConfiguration().get("key.serializer"))
+				.isEqualTo("FooSerializer.class");
+		assertThat(kafkaConsumerProperties.getConfiguration().get("value.serializer"))
+				.isEqualTo("BarSerializer.class");
 
-		//binding "standard-in" gets FooSerializer defined on the binding itself and BarSerializer through default property.
-		assertThat(kafkaConsumerProperties.getConfiguration().get("key.serializer")).isEqualTo("FooSerializer.class");
-		assertThat(kafkaConsumerProperties.getConfiguration().get("value.serializer")).isEqualTo("BarSerializer.class");
+		// @checkstyle:off
+		KafkaProducerProperties customKafkaProducerProperties = (KafkaProducerProperties) ((ExtendedPropertiesBinder) kafkaBinder)
+				.getExtendedProducerProperties("custom-out");
+		// @checkstyle:on
 
-		KafkaProducerProperties customKafkaProducerProperties =
-				(KafkaProducerProperties)((ExtendedPropertiesBinder) kafkaBinder).getExtendedProducerProperties("custom-out");
+		// binding "standard-out" gets BarSerializer and BarSerializer for
+		// key.serializer/value.serializer through default properties.
+		assertThat(customKafkaProducerProperties.getConfiguration().get("key.serializer"))
+				.isEqualTo("BarSerializer.class");
+		assertThat(
+				customKafkaProducerProperties.getConfiguration().get("value.serializer"))
+						.isEqualTo("BarSerializer.class");
 
-		//binding "standard-out" gets BarSerializer and BarSerializer for ker.serializer/value.serializer through default properties.
-		assertThat(customKafkaProducerProperties.getConfiguration().get("key.serializer")).isEqualTo("BarSerializer.class");
-		assertThat(customKafkaProducerProperties.getConfiguration().get("value.serializer")).isEqualTo("BarSerializer.class");
+		// through default properties.
+		assertThat(customKafkaProducerProperties.getConfiguration().get("foo"))
+				.isEqualTo("bar");
 
-		//through default properties.
-		assertThat(customKafkaProducerProperties.getConfiguration().get("foo")).isEqualTo("bar");
-
-		KafkaConsumerProperties customKafkaConsumerProperties =
-				(KafkaConsumerProperties)((ExtendedPropertiesBinder) kafkaBinder).getExtendedConsumerProperties("custom-in");
-
-		//binding "standard-in" gets BarSerializer and BarSerializer for ker.serializer/value.serializer through default properties.
-		assertThat(customKafkaConsumerProperties.getConfiguration().get("key.serializer")).isEqualTo("BarSerializer.class");
-		assertThat(customKafkaConsumerProperties.getConfiguration().get("value.serializer")).isEqualTo("BarSerializer.class");
+		// @checkstyle:off
+		KafkaConsumerProperties customKafkaConsumerProperties = (KafkaConsumerProperties) ((ExtendedPropertiesBinder) kafkaBinder)
+				.getExtendedConsumerProperties("custom-in");
+		// @checkstyle:on
+		// binding "standard-in" gets BarSerializer and BarSerializer for
+		// key.serializer/value.serializer through default properties.
+		assertThat(customKafkaConsumerProperties.getConfiguration().get("key.serializer"))
+				.isEqualTo("BarSerializer.class");
+		assertThat(
+				customKafkaConsumerProperties.getConfiguration().get("value.serializer"))
+						.isEqualTo("BarSerializer.class");
 
 		assertThat(kafkaConsumerProperties.isAckEachRecord()).isEqualTo(true);
 		assertThat(customKafkaConsumerProperties.isAckEachRecord()).isEqualTo(false);
 
 		RebalanceListener rebalanceListener = context.getBean(RebalanceListener.class);
 		assertThat(rebalanceListener.latch.await(10, TimeUnit.SECONDS)).isTrue();
-		assertThat(rebalanceListener.bindings.keySet()).contains("standard-in", "custom-in");
-		assertThat(rebalanceListener.bindings.values()).containsExactly(Boolean.TRUE, Boolean.TRUE);
+		assertThat(rebalanceListener.bindings.keySet()).contains("standard-in",
+				"custom-in");
+		assertThat(rebalanceListener.bindings.values()).containsExactly(Boolean.TRUE,
+				Boolean.TRUE);
 	}
 
 	@EnableBinding(CustomBindingForExtendedPropertyTesting.class)
@@ -176,6 +201,7 @@ public class KafkaBinderExtendedPropertiesTest {
 
 		@Output("custom-out")
 		MessageChannel customOut();
+
 	}
 
 	public static class RebalanceListener implements KafkaBindingRebalanceListener {
@@ -185,14 +211,14 @@ public class KafkaBinderExtendedPropertiesTest {
 		private final CountDownLatch latch = new CountDownLatch(2);
 
 		@Override
-		public void onPartitionsRevokedBeforeCommit(String bindingName, Consumer consumer,
-				Collection partitions) {
+		public void onPartitionsRevokedBeforeCommit(String bindingName,
+				Consumer consumer, Collection partitions) {
 
 		}
 
 		@Override
-		public void onPartitionsRevokedAfterCommit(String bindingName, Consumer consumer,
-				Collection partitions) {
+		public void onPartitionsRevokedAfterCommit(String bindingName,
+				Consumer consumer, Collection partitions) {
 
 		}