From 687b4eb9bdb867aa42a0f73429b4519573176f77 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Fri, 2 Mar 2018 19:55:55 -0500 Subject: [PATCH] Non self contained aggregate application sample cleanup --- .../.mvn | 0 non-self-contained-aggregate-app/README.adoc | 49 ++++ non-self-contained-aggregate-app/README.md | 30 --- .../docker-compose.yml | 18 ++ .../mvnw | 0 .../mvnw.cmd | 0 non-self-contained-aggregate-app/pom.xml | 78 ++++-- ...on.java => ProcessorAppConfiguration.java} | 3 +- ...ition.java => SourceAppConfiguration.java} | 8 +- .../NonSelfContainedAggregateApplication.java | 4 +- .../start-kafka-shell.sh | 2 + pom.xml | 4 +- self-contained-aggregate-app/.mvn | 1 + .../README.adoc | 7 +- self-contained-aggregate-app/mvnw | 226 ++++++++++++++++++ self-contained-aggregate-app/mvnw.cmd | 145 +++++++++++ .../pom.xml | 7 +- .../processor/ProcessorAppConfiguration.java | 0 .../processor/ProcessorApplication.java | 0 .../config/sink/SinkAppConfiguration.java | 0 .../java/config/sink/SinkApplication.java | 0 .../config/source/SourceAppConfiguration.java | 0 .../java/config/source/SourceApplication.java | 0 .../main/java/demo/AggregateApplication.java | 0 .../java/demo/ModuleApplicationTests.java | 0 25 files changed, 513 insertions(+), 69 deletions(-) rename {aggregate-application => non-self-contained-aggregate-app}/.mvn (100%) create mode 100644 non-self-contained-aggregate-app/README.adoc delete mode 100644 non-self-contained-aggregate-app/README.md create mode 100644 non-self-contained-aggregate-app/docker-compose.yml rename {aggregate-application => non-self-contained-aggregate-app}/mvnw (100%) rename {aggregate-application => non-self-contained-aggregate-app}/mvnw.cmd (100%) rename non-self-contained-aggregate-app/src/main/java/config/processor/{ProcessorModuleDefinition.java => ProcessorAppConfiguration.java} (96%) rename non-self-contained-aggregate-app/src/main/java/config/source/{SourceModuleDefinition.java => SourceAppConfiguration.java} (97%) create mode 100755 non-self-contained-aggregate-app/start-kafka-shell.sh create mode 120000 self-contained-aggregate-app/.mvn rename {aggregate-application => self-contained-aggregate-app}/README.adoc (90%) create mode 100755 self-contained-aggregate-app/mvnw create mode 100644 self-contained-aggregate-app/mvnw.cmd rename {aggregate-application => self-contained-aggregate-app}/pom.xml (96%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/config/processor/ProcessorAppConfiguration.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/config/processor/ProcessorApplication.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/config/sink/SinkAppConfiguration.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/config/sink/SinkApplication.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/config/source/SourceAppConfiguration.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/config/source/SourceApplication.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/main/java/demo/AggregateApplication.java (100%) rename {aggregate-application => self-contained-aggregate-app}/src/test/java/demo/ModuleApplicationTests.java (100%) diff --git a/aggregate-application/.mvn b/non-self-contained-aggregate-app/.mvn similarity index 100% rename from aggregate-application/.mvn rename to non-self-contained-aggregate-app/.mvn diff --git a/non-self-contained-aggregate-app/README.adoc b/non-self-contained-aggregate-app/README.adoc new file mode 100644 index 0000000..e04f97d --- /dev/null +++ b/non-self-contained-aggregate-app/README.adoc @@ -0,0 +1,49 @@ +Spring Cloud Stream - Non self-contained Aggregate application sample +===================================================================== + +In this *Spring Cloud Stream* sample, the application shows how to write a non self-contained aggregate application. +A non self-contained application is the one that has its applications directly bound but either or both the input and output of the application is bound to the external broker. + +## Requirements + +To run this sample, you will need to have installed: + +* Java 8 or Above + +## Code Tour + +* NonSelfContainedAggregateApplication - the Spring Boot Main Aggregate Application that directly binds `Source` and `Processor` application while the processor application's output is bound to Kafka. +* SourceAppConfiguration - Configuration for the source +* ProcessorAppConfiguraion - Configuration for the processor +* SourceApplication - Spring Boot app for the source +* ProcessorApplication - Spring Boot app for the processor + +## Running the application + +* Go to the application root + +* Ensure that you have Kafka running + +* Run the Kafka console consume as below: + +`bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic processor-output` + +`processor-output` is the destination that is bound from the processor. + +* `./mvnw clean package` + +* `java -jar target/non-self-contained-aggregate-app-0.0.1-SNAPSHOT.jar` + +Source application sends a message every second which will initiate the processor which will produce the output into a destination on the broker (Kafka topic in this case). +You will see output similar to the following printed on the kafka console consumer. + +``` +2018-03-02 19:46:07 +2018-03-02 19:46:08 +2018-03-02 19:46:09 +2018-03-02 19:46:10 +2018-03-02 19:46:11 +2018-03-02 19:46:12 +2018-03-02 19:46:13 +2018-03-02 19:46:14 +``` \ No newline at end of file diff --git a/non-self-contained-aggregate-app/README.md b/non-self-contained-aggregate-app/README.md deleted file mode 100644 index 3f955b1..0000000 --- a/non-self-contained-aggregate-app/README.md +++ /dev/null @@ -1,30 +0,0 @@ -Spring Cloud Stream - Non self-contained Aggregate application sample -============================= - -In this *Spring Cloud Stream* sample, the application shows how to write a non self-contained aggregate application. -A non self-contained application is the one that has its applications directly bound but either or both the input and output of the application is bound to the external broker. - -## Requirements - -To run this sample, you will need to have installed: - -* Java 8 or Above - -## Code Tour - -* NonSelfContainedAggregateApplication - the Spring Boot Main Aggregate Application that directly binds `Source` and `Processor` application while the processor application's output is bound to RabbitMQ. -* ProcessorModuleDefinition - the processor application configuration -* SourceModuleDefinition - the source application configuration - -## Building with Maven - -Build the sample by executing: - - >$ mvn clean package - -## Running the Sample - -To start the non self-contained aggregate application execute the following: - - >$ java -jar target/spring-cloud-stream-sample-non-self-contained-aggregate-app--exec.jar - diff --git a/non-self-contained-aggregate-app/docker-compose.yml b/non-self-contained-aggregate-app/docker-compose.yml new file mode 100644 index 0000000..d47d783 --- /dev/null +++ b/non-self-contained-aggregate-app/docker-compose.yml @@ -0,0 +1,18 @@ +version: '2' +services: + kafka: + image: wurstmeister/kafka + ports: + - "9092:9092" + environment: + - KAFKA_ADVERTISED_HOST_NAME=127.0.0.1 + - KAFKA_ADVERTISED_PORT=9092 + - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 + depends_on: + - zookeeper + zookeeper: + image: wurstmeister/zookeeper + ports: + - "2181:2181" + environment: + - KAFKA_ADVERTISED_HOST_NAME=zookeeper \ No newline at end of file diff --git a/aggregate-application/mvnw b/non-self-contained-aggregate-app/mvnw similarity index 100% rename from aggregate-application/mvnw rename to non-self-contained-aggregate-app/mvnw diff --git a/aggregate-application/mvnw.cmd b/non-self-contained-aggregate-app/mvnw.cmd similarity index 100% rename from aggregate-application/mvnw.cmd rename to non-self-contained-aggregate-app/mvnw.cmd diff --git a/non-self-contained-aggregate-app/pom.xml b/non-self-contained-aggregate-app/pom.xml index cd88834..e2423dc 100644 --- a/non-self-contained-aggregate-app/pom.xml +++ b/non-self-contained-aggregate-app/pom.xml @@ -2,55 +2,93 @@ 4.0.0 - spring-cloud-stream-sample-non-self-contained-aggregate-app + spring.cloud.stream.samples + non-self-contained-aggregate-app + 0.0.1-SNAPSHOT jar - spring-cloud-stream-sample-non-self-contained-aggregate-app - Demo project for non self contained Aggregate Application + non-self-contained-aggregate-app + Demo project for Spring Boot - org.springframework.cloud - spring-cloud-stream-samples - 1.2.0.BUILD-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 2.0.0.BUILD-SNAPSHOT + - demo.NonSelfContainedAggregateApplication + UTF-8 + UTF-8 + 1.8 + Finchley.BUILD-SNAPSHOT - org.springframework.cloud - spring-cloud-stream + org.springframework.boot + spring-boot-starter-actuator org.springframework.boot - spring-boot-configuration-processor - true + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter + + + org.springframework.cloud + spring-cloud-stream-binder-kafka - org.springframework.boot spring-boot-starter-test test - - - org.springframework.cloud - spring-cloud-stream-binder-rabbit - + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + org.springframework.boot spring-boot-maven-plugin - - exec - + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + diff --git a/non-self-contained-aggregate-app/src/main/java/config/processor/ProcessorModuleDefinition.java b/non-self-contained-aggregate-app/src/main/java/config/processor/ProcessorAppConfiguration.java similarity index 96% rename from non-self-contained-aggregate-app/src/main/java/config/processor/ProcessorModuleDefinition.java rename to non-self-contained-aggregate-app/src/main/java/config/processor/ProcessorAppConfiguration.java index 8b3e263..fe32143 100644 --- a/non-self-contained-aggregate-app/src/main/java/config/processor/ProcessorModuleDefinition.java +++ b/non-self-contained-aggregate-app/src/main/java/config/processor/ProcessorAppConfiguration.java @@ -25,10 +25,11 @@ import org.springframework.messaging.Message; * @author Marius Bogoevici */ @EnableBinding(Processor.class) -public class ProcessorModuleDefinition { +public class ProcessorAppConfiguration { @Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT) public Message transform(Message inbound) { return inbound; } + } diff --git a/non-self-contained-aggregate-app/src/main/java/config/source/SourceModuleDefinition.java b/non-self-contained-aggregate-app/src/main/java/config/source/SourceAppConfiguration.java similarity index 97% rename from non-self-contained-aggregate-app/src/main/java/config/source/SourceModuleDefinition.java rename to non-self-contained-aggregate-app/src/main/java/config/source/SourceAppConfiguration.java index 45742f0..3de2e84 100644 --- a/non-self-contained-aggregate-app/src/main/java/config/source/SourceModuleDefinition.java +++ b/non-self-contained-aggregate-app/src/main/java/config/source/SourceAppConfiguration.java @@ -16,9 +16,6 @@ package config.source; -import java.text.SimpleDateFormat; -import java.util.Date; - import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.messaging.Source; import org.springframework.context.annotation.Bean; @@ -27,12 +24,15 @@ import org.springframework.integration.annotation.Poller; import org.springframework.integration.core.MessageSource; import org.springframework.messaging.support.GenericMessage; +import java.text.SimpleDateFormat; +import java.util.Date; + /** * @author Dave Syer * @author Marius Bogoevici */ @EnableBinding(Source.class) -public class SourceModuleDefinition { +public class SourceAppConfiguration { private String format = "yyyy-MM-dd HH:mm:ss"; diff --git a/non-self-contained-aggregate-app/src/main/java/demo/NonSelfContainedAggregateApplication.java b/non-self-contained-aggregate-app/src/main/java/demo/NonSelfContainedAggregateApplication.java index d68efed..0aae5ab 100644 --- a/non-self-contained-aggregate-app/src/main/java/demo/NonSelfContainedAggregateApplication.java +++ b/non-self-contained-aggregate-app/src/main/java/demo/NonSelfContainedAggregateApplication.java @@ -18,7 +18,6 @@ package demo; import config.processor.ProcessorApplication; import config.source.SourceApplication; - import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder; @@ -30,8 +29,7 @@ public class NonSelfContainedAggregateApplication { public static void main(String[] args) { new AggregateApplicationBuilder(NonSelfContainedAggregateApplication.class) - .from(SourceApplication.class).args("--fixedDelay=5000") + .from(SourceApplication.class).args("--fixedDelay=1000") .via(ProcessorApplication.class).namespace("a").run("--spring.cloud.stream.bindings.output.destination=processor-output"); } - } diff --git a/non-self-contained-aggregate-app/start-kafka-shell.sh b/non-self-contained-aggregate-app/start-kafka-shell.sh new file mode 100755 index 0000000..62663e4 --- /dev/null +++ b/non-self-contained-aggregate-app/start-kafka-shell.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -e HOST_IP=$1 -e ZK=$2 -i -t wurstmeister/kafka /bin/bash diff --git a/pom.xml b/pom.xml index 067991f..5b20794 100644 --- a/pom.xml +++ b/pom.xml @@ -24,10 +24,10 @@ jdbc-sink jdbc-source streamlistener-basic - aggregate-application + self-contained-aggregate-application + non-self-contained-aggregate-app dynamic-source transform - non-self-contained-aggregate-app multibinder-differentsystems multi-io diff --git a/self-contained-aggregate-app/.mvn b/self-contained-aggregate-app/.mvn new file mode 120000 index 0000000..19172e1 --- /dev/null +++ b/self-contained-aggregate-app/.mvn @@ -0,0 +1 @@ +../.mvn \ No newline at end of file diff --git a/aggregate-application/README.adoc b/self-contained-aggregate-app/README.adoc similarity index 90% rename from aggregate-application/README.adoc rename to self-contained-aggregate-app/README.adoc index 7ba544b..4486f6d 100644 --- a/aggregate-application/README.adoc +++ b/self-contained-aggregate-app/README.adoc @@ -1,10 +1,9 @@ Spring Cloud Stream Aggregate Application Sample ================================================ -This is a basic example of a Spring Cloud Stream aggregate application. +This is a basic example of a Spring Cloud Stream aggregate application that is self contained. This sample follows the chain of source -> processor -> sink. -Since the final component is a sink, we can run this aggregate sample without using a middleware, i.e. the entire chain is done in memory using the channels. -Alternatively, we can stop the application at a processor and send the outbound to a middleware through a binder. +Since the final component is a sink, we can run this aggregate sample without using a middleware, i.e. the entire chain is done in memory using the channels and thus self contained. ## Requirements @@ -28,7 +27,7 @@ To run this sample, you will need to have installed: * `./mvnw clean package` -* `java -jar target/aggregate-application-0.0.1-SNAPSHOT.jar` +* `java -jar target/self-contained-aggregate-app-0.0.1-SNAPSHOT.jar` Source application sends a message every second which will initiate the processor and then the sink (all in memory through the aggregate app). You will see output similar to the following printed on the console every second. diff --git a/self-contained-aggregate-app/mvnw b/self-contained-aggregate-app/mvnw new file mode 100755 index 0000000..6efc7bd --- /dev/null +++ b/self-contained-aggregate-app/mvnw @@ -0,0 +1,226 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # 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 + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + 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 + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +echo $MAVEN_PROJECTBASEDIR +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# 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 + +"$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" + diff --git a/self-contained-aggregate-app/mvnw.cmd b/self-contained-aggregate-app/mvnw.cmd new file mode 100644 index 0000000..b0dc0e7 --- /dev/null +++ b/self-contained-aggregate-app/mvnw.cmd @@ -0,0 +1,145 @@ +@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% diff --git a/aggregate-application/pom.xml b/self-contained-aggregate-app/pom.xml similarity index 96% rename from aggregate-application/pom.xml rename to self-contained-aggregate-app/pom.xml index e217702..1932e81 100644 --- a/aggregate-application/pom.xml +++ b/self-contained-aggregate-app/pom.xml @@ -2,13 +2,12 @@ 4.0.0 - spring.cloud.stream.samples - aggregate-application + self-contained-aggregate-app 0.0.1-SNAPSHOT jar - aggregate-application + self-contained-aggregate-app Demo project for Spring Boot @@ -91,6 +90,4 @@ - - diff --git a/aggregate-application/src/main/java/config/processor/ProcessorAppConfiguration.java b/self-contained-aggregate-app/src/main/java/config/processor/ProcessorAppConfiguration.java similarity index 100% rename from aggregate-application/src/main/java/config/processor/ProcessorAppConfiguration.java rename to self-contained-aggregate-app/src/main/java/config/processor/ProcessorAppConfiguration.java diff --git a/aggregate-application/src/main/java/config/processor/ProcessorApplication.java b/self-contained-aggregate-app/src/main/java/config/processor/ProcessorApplication.java similarity index 100% rename from aggregate-application/src/main/java/config/processor/ProcessorApplication.java rename to self-contained-aggregate-app/src/main/java/config/processor/ProcessorApplication.java diff --git a/aggregate-application/src/main/java/config/sink/SinkAppConfiguration.java b/self-contained-aggregate-app/src/main/java/config/sink/SinkAppConfiguration.java similarity index 100% rename from aggregate-application/src/main/java/config/sink/SinkAppConfiguration.java rename to self-contained-aggregate-app/src/main/java/config/sink/SinkAppConfiguration.java diff --git a/aggregate-application/src/main/java/config/sink/SinkApplication.java b/self-contained-aggregate-app/src/main/java/config/sink/SinkApplication.java similarity index 100% rename from aggregate-application/src/main/java/config/sink/SinkApplication.java rename to self-contained-aggregate-app/src/main/java/config/sink/SinkApplication.java diff --git a/aggregate-application/src/main/java/config/source/SourceAppConfiguration.java b/self-contained-aggregate-app/src/main/java/config/source/SourceAppConfiguration.java similarity index 100% rename from aggregate-application/src/main/java/config/source/SourceAppConfiguration.java rename to self-contained-aggregate-app/src/main/java/config/source/SourceAppConfiguration.java diff --git a/aggregate-application/src/main/java/config/source/SourceApplication.java b/self-contained-aggregate-app/src/main/java/config/source/SourceApplication.java similarity index 100% rename from aggregate-application/src/main/java/config/source/SourceApplication.java rename to self-contained-aggregate-app/src/main/java/config/source/SourceApplication.java diff --git a/aggregate-application/src/main/java/demo/AggregateApplication.java b/self-contained-aggregate-app/src/main/java/demo/AggregateApplication.java similarity index 100% rename from aggregate-application/src/main/java/demo/AggregateApplication.java rename to self-contained-aggregate-app/src/main/java/demo/AggregateApplication.java diff --git a/aggregate-application/src/test/java/demo/ModuleApplicationTests.java b/self-contained-aggregate-app/src/test/java/demo/ModuleApplicationTests.java similarity index 100% rename from aggregate-application/src/test/java/demo/ModuleApplicationTests.java rename to self-contained-aggregate-app/src/test/java/demo/ModuleApplicationTests.java