diff --git a/custom-dataflow-builds/dataflow-server-21x/.mvn/wrapper/maven-wrapper.properties b/custom-dataflow-builds/dataflow-server-21x/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/custom-dataflow-builds/dataflow-server-21x/.mvn/wrapper/maven-wrapper.properties +++ b/custom-dataflow-builds/dataflow-server-21x/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/custom-dataflow-builds/dataflow-server-22x/.mvn/wrapper/maven-wrapper.properties b/custom-dataflow-builds/dataflow-server-22x/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/custom-dataflow-builds/dataflow-server-22x/.mvn/wrapper/maven-wrapper.properties +++ b/custom-dataflow-builds/dataflow-server-22x/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/custom-dataflow-builds/dataflow-server-25x/.mvn/wrapper/maven-wrapper.properties b/custom-dataflow-builds/dataflow-server-25x/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/custom-dataflow-builds/dataflow-server-25x/.mvn/wrapper/maven-wrapper.properties +++ b/custom-dataflow-builds/dataflow-server-25x/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-migrate-schedules/.mvn/wrapper/maven-wrapper.properties b/dataflow-migrate-schedules/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-migrate-schedules/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-migrate-schedules/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-template-example/.mvn/wrapper/maven-wrapper.properties b/dataflow-template-example/.mvn/wrapper/maven-wrapper.properties index 6c8c0e0..9a9978a 100644 --- a/dataflow-template-example/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-template-example/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/batch-developer-guides/batch/batchsamples/.mvn/wrapper/maven-wrapper.properties index fa87ad7..f74cae6 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/recipes/file-ingest/file-to-jdbc/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/recipes/file-ingest/file-to-jdbc/.mvn/wrapper/maven-wrapper.properties index fa87ad7..f74cae6 100644 --- a/dataflow-website/recipes/file-ingest/file-to-jdbc/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/recipes/file-ingest/file-to-jdbc/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/dataflow-website/recipes/kinesisdemo/kinesisconsumer/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/recipes/kinesisdemo/kinesisconsumer/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/recipes/kinesisdemo/kinesisconsumer/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/recipes/kinesisdemo/kinesisconsumer/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/recipes/kinesisdemo/kinesisproducer/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/recipes/kinesisdemo/kinesisproducer/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/recipes/kinesisdemo/kinesisproducer/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/recipes/kinesisdemo/kinesisproducer/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/recipes/scaling/scdf-alert-webhook/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/recipes/scaling/scdf-alert-webhook/.mvn/wrapper/maven-wrapper.properties index 7d59a01..f74cae6 100644 --- a/dataflow-website/recipes/scaling/scdf-alert-webhook/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/recipes/scaling/scdf-alert-webhook/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kafka/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kafka/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kafka/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kafka/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-kafka/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-kafka/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-kafka/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-kafka/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-rabbitmq/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-rabbitmq/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-rabbitmq/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-kotlin-rabbitmq/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-rabbitmq/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-rabbitmq/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-rabbitmq/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/feature-guides/streams/function-composition/composed-http-transformer-rabbitmq/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-logger/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-logger/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-logger/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-logger/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-processor/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-processor/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-processor/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-cost-processor/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-detail-sender/.mvn/wrapper/maven-wrapper.properties b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-detail-sender/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-detail-sender/.mvn/wrapper/maven-wrapper.properties +++ b/dataflow-website/stream-developer-guides/streams/standalone-stream-sample/usage-detail-sender/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/function-samples/.mvn/wrapper/maven-wrapper.properties b/function-samples/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/function-samples/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/function-samples/http-click-ingest/.mvn/wrapper/maven-wrapper.properties b/function-samples/http-click-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/function-samples/http-click-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/http-click-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/function-samples/http-region-ingest/.mvn/wrapper/maven-wrapper.properties b/function-samples/http-region-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/function-samples/http-region-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/http-region-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/function-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties b/function-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties index c315043..9a9978a 100644 --- a/function-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/function-samples/kstreams-log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/function-samples/kstreams-log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/function-samples/kstreams-log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/kstreams-log-user-clicks-per-region/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/function-samples/transform-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/function-samples/transform-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/function-samples/transform-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/transform-user-clicks-per-region/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/function-samples/uppercase-processor/.mvn/wrapper/maven-wrapper.properties b/function-samples/uppercase-processor/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/function-samples/uppercase-processor/.mvn/wrapper/maven-wrapper.properties +++ b/function-samples/uppercase-processor/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/javadsl/.mvn/wrapper/maven-wrapper.properties b/javadsl/.mvn/wrapper/maven-wrapper.properties index 9dda3b6..9a9978a 100644 --- a/javadsl/.mvn/wrapper/maven-wrapper.properties +++ b/javadsl/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/kafka-samples/.mvn/wrapper/maven-wrapper.properties b/kafka-samples/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/kafka-samples/.mvn/wrapper/maven-wrapper.properties +++ b/kafka-samples/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/kafka-samples/http-ingest/.mvn/wrapper/maven-wrapper.properties b/kafka-samples/http-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/kafka-samples/http-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/kafka-samples/http-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/kafka-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties b/kafka-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties index c315043..9a9978a 100644 --- a/kafka-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties +++ b/kafka-samples/kstreams-join-user-clicks-and-region/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/kafka-samples/kstreams-log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/kafka-samples/kstreams-log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/kafka-samples/kstreams-log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties +++ b/kafka-samples/kstreams-log-user-clicks-per-region/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/kafka-samples/kstreams-word-count/.mvn/wrapper/maven-wrapper.properties b/kafka-samples/kstreams-word-count/.mvn/wrapper/maven-wrapper.properties index c315043..9a9978a 100644 --- a/kafka-samples/kstreams-word-count/.mvn/wrapper/maven-wrapper.properties +++ b/kafka-samples/kstreams-word-count/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/spring-cloud-dataflow-prometheus-service-discovery/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/spring-cloud-dataflow-prometheus-service-discovery/.mvn/wrapper/maven-wrapper.properties index b573bb5..9a9978a 100644 --- a/monitoring-samples/spring-cloud-dataflow-prometheus-service-discovery/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/spring-cloud-dataflow-prometheus-service-discovery/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/stream-apps/demo-processor/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/stream-apps/demo-processor/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/monitoring-samples/stream-apps/demo-processor/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/stream-apps/demo-processor/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/stream-apps/demo-sink/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/stream-apps/demo-sink/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/monitoring-samples/stream-apps/demo-sink/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/stream-apps/demo-sink/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/stream-apps/demo-source/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/stream-apps/demo-source/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/monitoring-samples/stream-apps/demo-source/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/stream-apps/demo-source/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/task-apps/task-demo-metrics-influxdb/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/task-apps/task-demo-metrics-influxdb/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/monitoring-samples/task-apps/task-demo-metrics-influxdb/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/task-apps/task-demo-metrics-influxdb/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/task-apps/task-demo-metrics-prometheus/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/task-apps/task-demo-metrics-prometheus/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/monitoring-samples/task-apps/task-demo-metrics-prometheus/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/task-apps/task-demo-metrics-prometheus/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/monitoring-samples/task-apps/task-demo-metrics-wavefront/.mvn/wrapper/maven-wrapper.properties b/monitoring-samples/task-apps/task-demo-metrics-wavefront/.mvn/wrapper/maven-wrapper.properties index cd0d451..9a9978a 100644 --- a/monitoring-samples/task-apps/task-demo-metrics-wavefront/.mvn/wrapper/maven-wrapper.properties +++ b/monitoring-samples/task-apps/task-demo-metrics-wavefront/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/.mvn/wrapper/maven-wrapper.properties index 642d572..f74cae6 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-click-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-clicks-and-region-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/http-region-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/log-user-clicks-per-region/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties index c315043..9a9978a 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-1.2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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. + * 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 { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * 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/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + 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/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/README.md b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/README.md new file mode 100644 index 0000000..1469b20 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/README.md @@ -0,0 +1,70 @@ +Step 1: Register the applications: + +Go to App Registry and bulk import the following: + +``` +source.clicks-ingest=docker://springcloudstream/multi-io-sample-http-click-ingest:1.0.0-SNAPSHOT +source.regions-ingest=docker://springcloudstream/multi-io-sample-http-region-ingest:1.0.0-SNAPSHOT +processor.clicks-per-region=docker://springcloudstream/multi-io-sample-user-clicks-per-region-processor:1.0.0-SNAPSHOT +sink.clicks-per-region-logger=docker://springcloudstream/multi-io-sample-log-user-clicks-per-region:1.0.0-SNAPSHOT + +``` + +Once added, create a streaming pipeline by using the Stream Editor, as follows: + + +You can also create a stream by using the following DSL and deploy the stream: + +``` +clicks-ingest --server.port=9001 || regions-ingest --server.port=9000 || clicks-per-region :userRegions<:regions-ingest.user-regions :userClicks<:clicks-ingest.user-clicks || clicks-per-region-logger :_<:clicks-per-region.clicksPerRegion +``` + +As you can see the `clicks-per-region` is a KStream application with two inputs and one output. + + +Note: In order to post the HTTP events, you might either need to port-forward your pods (on minikube) or use the service endpoints(if you have a Service endpoint available) of `click-ingest` and `regions-ingest` deployments. Since this sample is now set up on `minikube`, the following sample data is posted to `http://localhost:9000` and `http://localhost:9001` after port-forwarding the associated pods. + +Post some HTTP events as user region events: + +``` +curl -X POST http://localhost:9000 -H "username: Glenn" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Soby" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Janne" -d "europe" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: David" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Ilaya" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Mark" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Sabby" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Ilaya" -d "asia" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Chris" -d "americas" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Damien" -d "europe" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Christian" -d "europe" -H "Content-Type: text/plain" +curl -X POST http://localhost:9000 -H "username: Thomas" -d "americas" -H "Content-Type: text/plain" +``` + +We can also post some HTTP events as user click events: + +``` +curl -X POST http://localhost:9001 -H "username: Glenn" -d 9 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Soby" -d 15 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Janne" -d 10 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Mark" -d 7 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: David" -d 15 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Sabby" -d 20 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Ilaya" -d 10 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Chris" -d 5 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Damien" -d 21 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Christian" -d 12 -H "Content-Type: text/plain" +curl -X POST http://localhost:9001 -H "username: Thomas" -d 12 -H "Content-Type: text/plain" +``` + + +Once both the user clicks and the user region events are posted, the KStream processor will start processing the user clicks per region and you can see the result at the logger application’s log: + +``` +2020-08-04 21:53:36.735 INFO 1 --- [container-0-C-1] user-clicks-per-region : europe: 139 +2020-08-04 21:53:36.751 INFO 1 --- [container-0-C-1] user-clicks-per-region : americas: 297 +2020-08-04 21:53:36.754 INFO 1 --- [container-0-C-1] user-clicks-per-region : asia: 40 +2020-08-04 21:53:37.623 INFO 1 --- [container-0-C-1] user-clicks-per-region : europe: 172 +2020-08-04 21:53:37.625 INFO 1 --- [container-0-C-1] user-clicks-per-region : americas: 314 + +``` diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..5fd4d50 Binary files /dev/null and b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f77b5d1 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/README.adoc b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/README.adoc new file mode 100644 index 0000000..601e53c --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/README.adoc @@ -0,0 +1,20 @@ +# HTTP Ingest Source + +This source application is an extension of out-of-the-box HTTP source application. + +The `http-ingest` has a function bean definition that looks like: + +``` +@Bean +public Function sendAsUserClicks() { + return value -> Long.parseLong(value); +} + +``` + +When this function bean is enabled, the incoming `String` value is converted to `Long` value. +When sending user clicks count as `Long` we can enable this function for the `http-ingest` while the same application can be used for sending the user region `String` value. + +To build this application: + +./mvnw clean package diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/mvnw b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/mvnw new file mode 100755 index 0000000..a1ba1bf --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/mvnw @@ -0,0 +1,233 @@ +#!/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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/mvnw.cmd b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/mvnw.cmd new file mode 100644 index 0000000..2b934e8 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/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% \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/pom.xml new file mode 100644 index 0000000..c3d0dd0 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/pom.xml @@ -0,0 +1,275 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + org.springframework.cloud.dataflow.samples + http-click-ingest + 2.0.0-SNAPSHOT + http-click-ingest + Http click ingest application + + + + + + org.springframework.cloud.fn + function-dependencies + 1.0.0-SNAPSHOT + pom + import + + + org.springframework.cloud + spring-cloud-stream-dependencies + Horsham.SR6 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 3.0.8.RELEASE + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR6 + pom + import + + + + + + + + + org.springframework.cloud.fn + payload-converter-function + 1.0.0-SNAPSHOT + + + + org.springframework.cloud.fn + http-supplier + 1.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 3.0.0-SNAPSHOT + + + io.micrometer + micrometer-registry-influx + + + io.micrometer + micrometer-registry-prometheus + + + io.micrometer + micrometer-registry-wavefront + + + io.micrometer.prometheus + prometheus-rsocket-spring + 0.9.0 + + + io.micrometer + micrometer-registry-datadog + + + io.pivotal.cfenv + java-cfenv-boot + 2.1.2.RELEASE + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 2.0.0 + + + springcloud/openjdk + + + springcloudstream/multi-io-sample-${project.artifactId} + + 1.0.0-SNAPSHOT + + + + USE_CURRENT_TIMESTAMP + Docker + + + ${org.springframework.cloud.dataflow.spring.configuration.metadata.json} + + ${configuration-properties.outbound-ports} + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + process-classes + + read-project-properties + + + + + ${project.build.outputDirectory}/META-INF/spring-configuration-metadata-encoded.properties + + + ${project.build.outputDirectory}/META-INF/dataflow-configuration-port-mapping.properties + + + + + + + + org.springframework.cloud + spring-cloud-app-starter-metadata-maven-plugin + 2.0.2.BUILD-SNAPSHOT + + true + + + server.port + + + org.springframework.cloud.fn.supplier.http.HttpSupplierProperties + + + + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpClickIngest.java b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpClickIngest.java new file mode 100644 index 0000000..45bc42b --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpClickIngest.java @@ -0,0 +1,42 @@ +/* + * Copyright 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. + * You may obtain a copy of the License at + * + * https://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. + */ + +package org.springframework.cloud.dataflow.samples.source; + +import java.util.function.Function; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.integration.support.MutableMessage; +import org.springframework.messaging.Message; + +@SpringBootApplication +@Import({ org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration.class }) +public class HttpClickIngest { + + @Bean + public Function, Message> toUserClicks() { + return message -> { + return new MutableMessage<>(Long.valueOf(new String((byte[])message.getPayload())), message.getHeaders()); + }; + } + + public static void main(String[] args) { + SpringApplication.run(HttpClickIngest.class, args); + } +} diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/resources/META-INF/dataflow-configuration-metadata.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/resources/META-INF/dataflow-configuration-metadata.properties new file mode 100644 index 0000000..f3adc7f --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/resources/META-INF/dataflow-configuration-metadata.properties @@ -0,0 +1,3 @@ +configuration-properties.classes=org.springframework.cloud.fn.supplier.http.HttpSupplierProperties +configuration-properties.names=server.port +configuration-properties.outbound-ports=user-clicks diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/resources/application.yml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/resources/application.yml new file mode 100644 index 0000000..0b9da76 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-click-ingest/src/main/resources/application.yml @@ -0,0 +1,23 @@ +spring.cloud.stream.function.definition: httpSupplier|toUserClicks +spring.cloud.stream.function.bindings.httpSupplier|toUserClicks-out-0: user-clicks + +http.mapped-request-headers: username + +spring.cloud.stream.bindings.user-clicks.producer: + useNativeEncoding: true + +spring.cloud.stream.kafka.bindings.user-clicks.producer: + messageKeyExpression: headers['username'] + configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer + configuration.value.serializer: org.apache.kafka.common.serialization.LongSerializer + +spring.main.web-application-type: reactive +spring.cloud.streamapp.security.enabled: false +spring.cloud.streamapp.security.csrf-enabled: false + +management.endpoints.web.exposure.include: health,info,bindings + +#spring.cloud.stream.kafka.binder.configuration.key: +# serializer: org.apache.kafka.common.serialization.StringSerializer +#spring.cloud.stream.kafka.binder.configuration.value: +# serializer: org.apache.kafka.common.serialization.LongSerializer diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..5fd4d50 Binary files /dev/null and b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f77b5d1 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/README.adoc b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/README.adoc new file mode 100644 index 0000000..ebd2cd7 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/README.adoc @@ -0,0 +1,5 @@ +# HTTP Clicks And Region Ingest Source + +To build this application: + +./mvnw clean package diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/mvnw b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/mvnw new file mode 100755 index 0000000..a1ba1bf --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/mvnw @@ -0,0 +1,233 @@ +#!/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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/mvnw.cmd b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/mvnw.cmd new file mode 100644 index 0000000..2b934e8 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/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% \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/pom.xml new file mode 100644 index 0000000..fae74da --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/pom.xml @@ -0,0 +1,231 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + org.springframework.cloud.dataflow.samples + http-clicks-and-region-ingest + 2.0.0-SNAPSHOT + http-clicks-and-region-ingest + Http clicks and region ingest application + + + + + + org.springframework.cloud.fn + function-dependencies + 1.0.0-SNAPSHOT + pom + import + + + org.springframework.cloud + spring-cloud-stream-dependencies + Horsham.SR6 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 3.0.8.RELEASE + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR6 + pom + import + + + + + + + + + + org.springframework.cloud.fn + http-supplier + 1.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 3.0.0-SNAPSHOT + + + io.micrometer + micrometer-registry-wavefront + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 2.0.0 + + + springcloud/openjdk + + + springcloudstream/multi-io-sample-${project.artifactId} + + 1.0.0-SNAPSHOT + + + + USE_CURRENT_TIMESTAMP + Docker + + ${configuration-properties.outbound-ports} + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + process-classes + + read-project-properties + + + + + ${project.build.outputDirectory}/META-INF/dataflow-configuration-port-mapping.properties + + + + + + + + org.springframework.cloud + spring-cloud-app-starter-metadata-maven-plugin + 2.0.2.BUILD-SNAPSHOT + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpClicksAndRegionIngest.java b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpClicksAndRegionIngest.java new file mode 100644 index 0000000..b6fff01 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpClicksAndRegionIngest.java @@ -0,0 +1,97 @@ +/* + * Copyright 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. + * You may obtain a copy of the License at + * + * https://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. + */ + +package org.springframework.cloud.dataflow.samples.source; + +import java.util.Collections; +import java.util.function.Supplier; + +import org.reactivestreams.Publisher; +import reactor.core.publisher.Flux; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; +import org.springframework.integration.expression.ValueExpression; +import org.springframework.integration.http.support.DefaultHttpHeaderMapper; +import org.springframework.integration.mapping.HeaderMapper; +import org.springframework.integration.support.MutableMessage; +import org.springframework.integration.webflux.dsl.WebFlux; +import org.springframework.integration.webflux.inbound.WebFluxInboundEndpoint; +import org.springframework.messaging.Message; + +/** + * @author Ilayaperumal Gopinathan + */ +@SpringBootApplication +public class HttpClicksAndRegionIngest { + + @Bean + public Publisher> clicksAndRegionsFlow() { + Publisher> publisher = IntegrationFlows.from( + WebFlux.inboundChannelAdapter("/clicks", "/regions") + .requestPayloadType(byte[].class) + .statusCodeExpression(new ValueExpression<>(HttpStatus.ACCEPTED)) + .mappedRequestHeaders("username") + .autoStartup(false)) + .channel(MessageChannels.flux()) + .toReactivePublisher(); + return publisher; + } + + @Bean + public HeaderMapper httpHeaderMapper() { + return DefaultHttpHeaderMapper.inboundMapper(); + } + + @Bean + public Supplier>> clickSupplier(Publisher> clickSupplier, + WebFluxInboundEndpoint webFluxInboundEndpoint) { + + return () -> Flux.from(clickSupplier) + .filter(message -> ((String) message.getHeaders().get("http_requestUrl")).endsWith("/clicks")) + .map(message -> { return toUserClicks(message);}) + .doOnSubscribe((subscription) -> webFluxInboundEndpoint.start()) + .doOnTerminate(webFluxInboundEndpoint::stop); + } + + @Bean + public Supplier>> regionSupplier(Publisher> regionSupplier, + WebFluxInboundEndpoint webFluxInboundEndpoint) { + + return () -> Flux.from(regionSupplier) + .filter(message -> ((String) message.getHeaders().get("http_requestUrl")).endsWith("/regions")) + .map(message -> { return toUserRegion(message); }) + .doOnSubscribe((subscription) -> webFluxInboundEndpoint.start()) + .doOnTerminate(webFluxInboundEndpoint::stop); + } + + public Message toUserClicks(Message message) { + return new MutableMessage<>(Long.valueOf(new String(message.getPayload())), Collections.singletonMap("username", message.getHeaders().get("username"))); + } + + public Message toUserRegion(Message message) { + return new MutableMessage<>(new String(message.getPayload()), Collections.singletonMap("username", message.getHeaders().get("username"))); + } + + public static void main(String[] args) { + SpringApplication.run(HttpClicksAndRegionIngest.class, args); + } +} diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/src/main/resources/application.yml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/src/main/resources/application.yml new file mode 100644 index 0000000..a64d55f --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-clicks-and-region-ingest/src/main/resources/application.yml @@ -0,0 +1,24 @@ +spring.cloud.stream.bindings.user-clicks.producer: + useNativeEncoding: true + +spring.cloud.stream.kafka.bindings.user-clicks.producer: + messageKeyExpression: headers['username'] + configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer + configuration.value.serializer: org.apache.kafka.common.serialization.LongSerializer + +spring.cloud.stream.bindings.user-regions.producer: + useNativeEncoding: true +spring.cloud.stream.kafka.bindings.user-regions.producer: + messageKeyExpression: headers['username'] + configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer + configuration.value.serializer: org.apache.kafka.common.serialization.StringSerializer + +spring.cloud.stream.function.definition: clickSupplier;regionSupplier +spring.cloud.stream.function.bindings.clickSupplier-out-0: user-clicks +spring.cloud.stream.function.bindings.regionSupplier-out-0: user-regions + +spring.main.web-application-type: reactive +spring.cloud.streamapp.security.enabled: false +spring.cloud.streamapp.security.csrf-enabled: false + +management.endpoints.web.exposure.include: health,info,bindings diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..5fd4d50 Binary files /dev/null and b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f77b5d1 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/README.adoc b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/README.adoc new file mode 100644 index 0000000..601e53c --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/README.adoc @@ -0,0 +1,20 @@ +# HTTP Ingest Source + +This source application is an extension of out-of-the-box HTTP source application. + +The `http-ingest` has a function bean definition that looks like: + +``` +@Bean +public Function sendAsUserClicks() { + return value -> Long.parseLong(value); +} + +``` + +When this function bean is enabled, the incoming `String` value is converted to `Long` value. +When sending user clicks count as `Long` we can enable this function for the `http-ingest` while the same application can be used for sending the user region `String` value. + +To build this application: + +./mvnw clean package diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/mvnw b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/mvnw new file mode 100755 index 0000000..a1ba1bf --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/mvnw @@ -0,0 +1,233 @@ +#!/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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/mvnw.cmd b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/mvnw.cmd new file mode 100644 index 0000000..2b934e8 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/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% \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/pom.xml new file mode 100644 index 0000000..e506da8 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/pom.xml @@ -0,0 +1,273 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + org.springframework.cloud.dataflow.samples + http-region-ingest + 2.0.0-SNAPSHOT + http-region-ingest + Http region ingest application + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + Horsham.SR6 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 3.0.8.RELEASE + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR1 + pom + import + + + + + + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + + + org.springframework.cloud.fn + http-supplier + 1.0.0-M2 + + + org.springframework.cloud.fn + payload-converter-function + 1.0.0-M2 + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 3.0.0-SNAPSHOT + + + io.micrometer + micrometer-registry-influx + + + io.micrometer + micrometer-registry-prometheus + + + io.micrometer + micrometer-registry-wavefront + + + io.micrometer.prometheus + prometheus-rsocket-spring + 0.9.0 + + + io.micrometer + micrometer-registry-datadog + + + io.pivotal.cfenv + java-cfenv-boot + 2.1.2.RELEASE + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 2.0.0 + + + springcloud/openjdk + + + springcloudstream/multi-io-sample-${project.artifactId} + + 1.0.0-SNAPSHOT + + + + USE_CURRENT_TIMESTAMP + Docker + + + ${org.springframework.cloud.dataflow.spring.configuration.metadata.json} + + ${configuration-properties.outbound-ports} + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + process-classes + + read-project-properties + + + + + ${project.build.outputDirectory}/META-INF/spring-configuration-metadata-encoded.properties + + + ${project.build.outputDirectory}/META-INF/dataflow-configuration-port-mapping.properties + + + + + + + + org.springframework.cloud + spring-cloud-app-starter-metadata-maven-plugin + 2.0.2.BUILD-SNAPSHOT + + true + + + server.port + + + org.springframework.cloud.fn.supplier.http.HttpSupplierProperties + + + + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpRegionIngest.java b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpRegionIngest.java new file mode 100644 index 0000000..045d398 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/java/org/springframework/cloud/dataflow/samples/source/HttpRegionIngest.java @@ -0,0 +1,35 @@ +/* + * Copyright 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. + * You may obtain a copy of the License at + * + * https://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. + */ + +package org.springframework.cloud.dataflow.samples.source; + +import java.util.function.Function; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; + +@SpringBootApplication +@Import({ org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration.class }) +public class HttpRegionIngest { + + public static void main(String[] args) { + SpringApplication.run(HttpRegionIngest.class, args); + } +} diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/resources/META-INF/dataflow-configuration-metadata.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/resources/META-INF/dataflow-configuration-metadata.properties new file mode 100644 index 0000000..3c22169 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/resources/META-INF/dataflow-configuration-metadata.properties @@ -0,0 +1,3 @@ +configuration-properties.classes=org.springframework.cloud.fn.supplier.http.HttpSupplierProperties +configuration-properties.names=server.port +configuration-properties.outbound-ports=user-regions diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/resources/application.yml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/resources/application.yml new file mode 100644 index 0000000..a016405 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/http-region-ingest/src/main/resources/application.yml @@ -0,0 +1,21 @@ +spring.cloud.stream.function.definition: httpSupplier|byteArrayTextToString +spring.cloud.stream.function.bindings.httpSupplier|byteArrayTextToString-out-0: user-regions + +http.mapped-request-headers: username + +spring.cloud.stream.bindings.user-regions.producer: + useNativeEncoding: true +spring.cloud.stream.kafka.bindings.user-regions.producer: + messageKeyExpression: headers['username'] + configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer + configuration.value.serializer: org.apache.kafka.common.serialization.StringSerializer + +spring.main.web-application-type: reactive +spring.cloud.streamapp.security.enabled: false +spring.cloud.streamapp.security.csrf-enabled: false + +management.endpoints.web.exposure.include: health,info,bindings +#spring.cloud.stream.kafka.binder.configuration.key: +# serializer: org.apache.kafka.common.serialization.StringSerializer +#spring.cloud.stream.kafka.binder.configuration.value: +# serializer: org.apache.kafka.common.serialization.StringSerializer \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..5fd4d50 Binary files /dev/null and b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..9a9978a --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/README.adoc b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/README.adoc new file mode 100644 index 0000000..8506c2f --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/README.adoc @@ -0,0 +1,14 @@ +# Logger sink that logs the output from the user clicks per region Kafka Streams application's output + +This sink application is a modification of out-of-the-box `log` application. + + +To build this application: + +./mvnw clean package + +To register this application from Spring Cloud Data Flow shell: + +``` +dataflow:> app register --name log-user-clicks-per-region --type app --uri file:///spring-cloud-dataflow-samples/kafka-samples/kstreams-log-user-clicks-per-region/target/kstreams-log-user-clicks-per-region-2.0.0-SNAPSHOT.jar +``` diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/mvnw b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/mvnw new file mode 100755 index 0000000..a1ba1bf --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/mvnw @@ -0,0 +1,233 @@ +#!/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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/mvnw.cmd b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/mvnw.cmd new file mode 100644 index 0000000..2b934e8 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/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% \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/pom.xml new file mode 100644 index 0000000..24665c4 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/pom.xml @@ -0,0 +1,189 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + org.springframework.cloud.dataflow.samples + log-user-clicks-per-region + 2.0.0-SNAPSHOT + log-user-clicks-per-region + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + Horsham.SR6 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 3.0.8.RELEASE + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR1 + pom + import + + + + + + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 3.0.0-SNAPSHOT + + + io.micrometer + micrometer-registry-wavefront + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 2.0.0 + + + springcloud/openjdk + + + springcloudstream/multi-io-sample-${project.artifactId} + + 1.0.0-SNAPSHOT + + + + USE_CURRENT_TIMESTAMP + Docker + + input + + + + + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java new file mode 100644 index 0000000..9a6e573 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java @@ -0,0 +1,51 @@ +/* + * Copyright 2015-2016 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. + * You may obtain a copy of the License at + * + * https://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. + */ + +package org.springframework.cloud.dataflow.samples.sink; + +import java.util.function.Consumer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.expression.common.LiteralExpression; +import org.springframework.integration.dsl.IntegrationFlow; +import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.handler.LoggingHandler; +import org.springframework.integration.support.MutableMessage; +import org.springframework.messaging.Message; + +@SpringBootApplication +public class UserClicksPerRegionLogger { + + @Bean + IntegrationFlow logConsumerFlow() { + return IntegrationFlows.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer")) + .handle((payload, headers) -> { + String userRegion = (String) headers.get("kafka_receivedMessageKey"); + return (userRegion + ": " + payload); + }) + .log(LoggingHandler.Level.INFO, "user-clicks-per-region", "payload") + .get(); + } + + private interface MessageConsumer extends Consumer> { + } + + public static void main(String[] args) { + SpringApplication.run(UserClicksPerRegionLogger.class, args); + } +} diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/src/main/resources/application.yml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/src/main/resources/application.yml new file mode 100644 index 0000000..c468657 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/log-user-clicks-per-region/src/main/resources/application.yml @@ -0,0 +1,10 @@ +spring.cloud.function.definition: logConsumer +spring.cloud.stream.function.bindings.logConsumer-in-0: input + +spring.cloud.stream.bindings.input.consumer.useNativeDecoding: true + +spring.cloud.stream.kafka.bindings.input.consumer.configuration: + key.deserializer: org.apache.kafka.common.serialization.StringDeserializer + value.deserializer: org.apache.kafka.common.serialization.LongDeserializer + +management.endpoints.web.exposure.include: health,info,bindings \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/mvnw b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/mvnw new file mode 100755 index 0000000..41c0f0c --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/mvnw @@ -0,0 +1,310 @@ +#!/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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# 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 + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + 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 $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + 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" + +# 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 + +# 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$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/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/mvnw.cmd b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/mvnw.cmd new file mode 100644 index 0000000..8611571 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/mvnw.cmd @@ -0,0 +1,182 @@ +@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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/pom.xml new file mode 100644 index 0000000..4308c97 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + org.springframework.cloud.dataflow.samples + user-clicks-per-region + 2.0.0-SNAPSHOT + pom + + http-click-ingest + http-region-ingest + http-clicks-and-region-ingest + user-clicks-per-region-processor + log-user-clicks-per-region + + + VMware, Inc. + https://www.spring.io + + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.gitignore b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.gitignore new file mode 100644 index 0000000..2af7cef --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.gitignore @@ -0,0 +1,24 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..9cc84ea Binary files /dev/null and b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/README.adoc b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/README.adoc new file mode 100644 index 0000000..9ce5229 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/README.adoc @@ -0,0 +1,15 @@ +# Kafka Streams application that joins user click counts and regions + +This application has two inputs (user clicks and user regions) and one output (user clicks per region). +Since the Kafka Streams processor has multiple inputs (one for user click events and another one for user regions events), this application needs to be deployed as `app` type and you need to explicitly configure the bindings to the appropriate Kafka topics and other related configurations. + + +To build this application: + +./mvnw clean package + +Register this KStream application as `app` type: + +``` +dataflow:> app register --name join-user-clicks-and-regions --type app --uri file:///spring-cloud-dataflow-samples/kafka-samples/kstreams-join-user-clicks-and-region/target/kstreams-join-user-clicks-and-region-2.0.0-SNAPSHOT.jar +``` diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/mvnw b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/mvnw new file mode 100755 index 0000000..5bf251c --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/mvnw @@ -0,0 +1,225 @@ +#!/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 + +exec "$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/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/mvnw.cmd b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/mvnw.cmd new file mode 100644 index 0000000..019bd74 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/mvnw.cmd @@ -0,0 +1,143 @@ +@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 + +@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 + +%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/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/pom.xml new file mode 100644 index 0000000..d6d1bb2 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/pom.xml @@ -0,0 +1,228 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + org.springframework.cloud.dataflow.samples + user-clicks-per-region-processor + 2.0.0-SNAPSHOT + jar + + user-clicks-per-region-processor + Demo project for Kafka Streams Table Join + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + Horsham.SR6 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 3.0.8.RELEASE + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR1 + pom + import + + + + + + + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka-streams + + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 3.0.0-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 3.0.0-SNAPSHOT + + + io.micrometer + micrometer-registry-wavefront + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + com.google.cloud.tools + jib-maven-plugin + 2.0.0 + + + springcloud/openjdk + + + springcloudstream/multi-io-sample-${project.artifactId} + + 1.0.0-SNAPSHOT + + + + USE_CURRENT_TIMESTAMP + Docker + + ${configuration-properties.inbound-ports} + ${configuration-properties.outbound-ports} + + + + + + org.springframework.cloud + spring-cloud-app-starter-metadata-maven-plugin + 2.0.2.BUILD-SNAPSHOT + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + process-classes + + read-project-properties + + + + + ${project.build.outputDirectory}/META-INF/dataflow-configuration-port-mapping.properties + + + + + + + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java new file mode 100644 index 0000000..e09bfa8 --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java @@ -0,0 +1,79 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://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. + */ + +package org.springframework.cloud.dataflow.samples.processor; + +import java.util.function.BiFunction; + +import org.apache.kafka.common.serialization.Serdes; +import org.apache.kafka.streams.KeyValue; +import org.apache.kafka.streams.kstream.Grouped; +import org.apache.kafka.streams.kstream.Joined; +import org.apache.kafka.streams.kstream.KStream; +import org.apache.kafka.streams.kstream.KTable; +import org.apache.kafka.streams.kstream.Serialized; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class UserClicksAndUserRegionsProcessor { + + public static void main(String[] args) { + SpringApplication.run(UserClicksAndUserRegionsProcessor.class, args); + } + + @Bean + public BiFunction, KTable, KStream> processUserClickStream() { + + return (userClicksStream, userRegionsTable) -> 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(Grouped.with(Serdes.String(), Serdes.Long())) + .reduce((firstClicks, secondClicks) -> firstClicks + secondClicks) + .toStream(); + } + + + private static final class RegionWithClicks { + + private final String region; + private final long clicks; + + public RegionWithClicks(String region, long clicks) { + if (region == null || region.isEmpty()) { + throw new IllegalArgumentException("region must be set"); + } + if (clicks < 0) { + throw new IllegalArgumentException("clicks must not be negative"); + } + this.region = region; + this.clicks = clicks; + } + + public String getRegion() { + return region; + } + + public long getClicks() { + return clicks; + } + + } +} diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/resources/application.yml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/resources/application.yml new file mode 100644 index 0000000..73ca9aa --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/resources/application.yml @@ -0,0 +1,35 @@ +#spring.cloud.function.definition: processUserClickStream +#spring.cloud.stream.function.bindings.processUserClickStream-in-0: userClicks +#spring.cloud.stream.function.bindings.processUserClickStream-in-1: userRegions +#spring.cloud.stream.function.bindings.processUserClickStream-out-0: clicksPerRegion + +spring: + cloud: + function: + definition: processUserClickStream + stream: + function: + bindings: + processUserClickStream-in-0: userClicks + processUserClickStream-in-1: userRegions + processUserClickStream-out-0: clicksPerRegion + +spring.cloud.stream.bindings.userClicks.consumer.useNativeDecoding: true +spring.cloud.stream.bindings.userRegions.consumer.useNativeDecoding: true +spring.cloud.stream.bindings.clicksPerRegion.producer.useNativeEncoding: true + +spring.cloud.stream.kafka.streams.bindings.userClicks.consumer: + keySerde: org.apache.kafka.common.serialization.Serdes$StringSerde + valueSerde: org.apache.kafka.common.serialization.Serdes$LongSerde +spring.cloud.stream.kafka.streams.bindings.userRegions.consumer: + keySerde: org.apache.kafka.common.serialization.Serdes$StringSerde + valueSerde: org.apache.kafka.common.serialization.Serdes$StringSerde +spring.cloud.stream.kafka.streams.bindings.clicksPerRegion.producer: + keySerde: org.apache.kafka.common.serialization.Serdes$StringSerde + valueSerde: org.apache.kafka.common.serialization.Serdes$LongSerde + +spring.cloud.stream.kafka.streams.binder: + configuration: + commit.interval.ms: 1000 + +management.endpoints.web.exposure.include: health,info,bindings \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/resources/logback.xml b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/resources/logback.xml new file mode 100644 index 0000000..870ac9e --- /dev/null +++ b/multi-io-samples/kafka-streams/user-clicks-per-region-2.x/user-clicks-per-region-processor/src/main/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + %d{ISO8601} %5p %t %c{2}:%L - %m%n + + + + + + + \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/pom.xml index c3d0dd0..b935694 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/pom.xml +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/http-click-ingest/pom.xml @@ -5,12 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 2.3.1.RELEASE + 3.2.3 + org.springframework.cloud.dataflow.samples http-click-ingest - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT http-click-ingest Http click ingest application @@ -20,28 +21,28 @@ org.springframework.cloud.fn function-dependencies - 1.0.0-SNAPSHOT + 4.0.1-SNAPSHOT pom import org.springframework.cloud spring-cloud-stream-dependencies - Horsham.SR6 + 4.0.5 pom import org.springframework.cloud spring-cloud-function-dependencies - 3.0.8.RELEASE + 4.0.5 pom import org.springframework.cloud spring-cloud-dependencies - Hoxton.SR6 + 2022.0.5 pom import @@ -54,28 +55,28 @@ org.springframework.cloud.fn payload-converter-function - 1.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.fn http-supplier - 1.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-composite-function-support - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-security-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-micrometer-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT io.micrometer @@ -92,7 +93,7 @@ io.micrometer.prometheus prometheus-rsocket-spring - 0.9.0 + 1.6.0-SNAPSHOT io.micrometer @@ -101,7 +102,7 @@ io.pivotal.cfenv java-cfenv-boot - 2.1.2.RELEASE + 2.4.1 org.springframework.boot @@ -140,31 +141,8 @@ org.springframework.boot spring-boot-maven-plugin - - - com.google.cloud.tools - jib-maven-plugin - 2.0.0 - - springcloud/openjdk - - - springcloudstream/multi-io-sample-${project.artifactId} - - 1.0.0-SNAPSHOT - - - - USE_CURRENT_TIMESTAMP - Docker - - - ${org.springframework.cloud.dataflow.spring.configuration.metadata.json} - - ${configuration-properties.outbound-ports} - - + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} @@ -192,8 +170,8 @@ org.springframework.cloud - spring-cloud-app-starter-metadata-maven-plugin - 2.0.2.BUILD-SNAPSHOT + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT true diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/pom.xml index fae74da..cbc12f2 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/pom.xml +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/http-clicks-and-region-ingest/pom.xml @@ -5,12 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 2.3.1.RELEASE + 3.2.3 + org.springframework.cloud.dataflow.samples http-clicks-and-region-ingest - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT http-clicks-and-region-ingest Http clicks and region ingest application @@ -20,28 +21,28 @@ org.springframework.cloud.fn function-dependencies - 1.0.0-SNAPSHOT + 4.0.1-SNAPSHOT pom import org.springframework.cloud spring-cloud-stream-dependencies - Horsham.SR6 + 4.0.5 pom import org.springframework.cloud spring-cloud-function-dependencies - 3.0.8.RELEASE + 4.0.6 pom import org.springframework.cloud spring-cloud-dependencies - Hoxton.SR6 + 2022.0.5 pom import @@ -55,22 +56,22 @@ org.springframework.cloud.fn http-supplier - 1.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-composite-function-support - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-security-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-micrometer-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT io.micrometer @@ -113,28 +114,8 @@ org.springframework.boot spring-boot-maven-plugin - - - com.google.cloud.tools - jib-maven-plugin - 2.0.0 - - springcloud/openjdk - - - springcloudstream/multi-io-sample-${project.artifactId} - - 1.0.0-SNAPSHOT - - - - USE_CURRENT_TIMESTAMP - Docker - - ${configuration-properties.outbound-ports} - - + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} @@ -159,8 +140,8 @@ org.springframework.cloud - spring-cloud-app-starter-metadata-maven-plugin - 2.0.2.BUILD-SNAPSHOT + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT aggregate-metadata diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/pom.xml index e506da8..3f7cdfb 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/pom.xml +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/http-region-ingest/pom.xml @@ -5,12 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 2.3.1.RELEASE + 3.2.3 + org.springframework.cloud.dataflow.samples http-region-ingest - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT http-region-ingest Http region ingest application @@ -20,21 +21,21 @@ org.springframework.cloud spring-cloud-stream-dependencies - Horsham.SR6 + 4.0.5 pom import org.springframework.cloud spring-cloud-function-dependencies - 3.0.8.RELEASE + 4.0.5 pom import org.springframework.cloud spring-cloud-dependencies - Hoxton.SR1 + 2022.0.5 pom import @@ -53,27 +54,27 @@ org.springframework.cloud.fn http-supplier - 1.0.0-M2 + 4.0.1-SNAPSHOT org.springframework.cloud.fn payload-converter-function - 1.0.0-M2 + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-composite-function-support - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-security-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-micrometer-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT io.micrometer @@ -90,7 +91,7 @@ io.micrometer.prometheus prometheus-rsocket-spring - 0.9.0 + 1.6.0-SNAPSHOT io.micrometer @@ -99,7 +100,7 @@ io.pivotal.cfenv java-cfenv-boot - 2.1.2.RELEASE + 2.4.1 org.springframework.boot @@ -138,31 +139,8 @@ org.springframework.boot spring-boot-maven-plugin - - - com.google.cloud.tools - jib-maven-plugin - 2.0.0 - - springcloud/openjdk - - - springcloudstream/multi-io-sample-${project.artifactId} - - 1.0.0-SNAPSHOT - - - - USE_CURRENT_TIMESTAMP - Docker - - - ${org.springframework.cloud.dataflow.spring.configuration.metadata.json} - - ${configuration-properties.outbound-ports} - - + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} @@ -190,8 +168,8 @@ org.springframework.cloud - spring-cloud-app-starter-metadata-maven-plugin - 2.0.2.BUILD-SNAPSHOT + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT true diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties index eb91947..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/.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://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/pom.xml index 24665c4..558772d 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/pom.xml +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/pom.xml @@ -5,12 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 2.3.1.RELEASE + 3.2.3 + org.springframework.cloud.dataflow.samples log-user-clicks-per-region - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT log-user-clicks-per-region @@ -19,21 +20,21 @@ org.springframework.cloud spring-cloud-stream-dependencies - Horsham.SR6 + 4.0.5 pom import org.springframework.cloud spring-cloud-function-dependencies - 3.0.8.RELEASE + 4.0.5 pom import org.springframework.cloud spring-cloud-dependencies - Hoxton.SR1 + 2022.0.5 pom import @@ -51,17 +52,17 @@ org.springframework.cloud.stream.app stream-applications-composite-function-support - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-security-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-micrometer-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT io.micrometer @@ -104,6 +105,9 @@ org.springframework.boot spring-boot-maven-plugin + + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} + com.google.cloud.tools diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java b/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java index 9a6e573..f09f78b 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/log-user-clicks-per-region/src/main/java/org/springframework/cloud/dataflow/samples/sink/UserClicksPerRegionLogger.java @@ -21,11 +21,8 @@ import java.util.function.Consumer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; -import org.springframework.expression.common.LiteralExpression; import org.springframework.integration.dsl.IntegrationFlow; -import org.springframework.integration.dsl.IntegrationFlows; import org.springframework.integration.handler.LoggingHandler; -import org.springframework.integration.support.MutableMessage; import org.springframework.messaging.Message; @SpringBootApplication @@ -33,7 +30,7 @@ public class UserClicksPerRegionLogger { @Bean IntegrationFlow logConsumerFlow() { - return IntegrationFlows.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer")) + return IntegrationFlow.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer")) .handle((payload, headers) -> { String userRegion = (String) headers.get("kafka_receivedMessageKey"); return (userRegion + ": " + payload); diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region/pom.xml index 4308c97..7aaba9a 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/pom.xml +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.springframework.cloud.dataflow.samples user-clicks-per-region - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT pom http-click-ingest diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties index c315043..f77b5d1 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/pom.xml b/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/pom.xml index d6d1bb2..abfabb7 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/pom.xml +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/pom.xml @@ -6,12 +6,13 @@ org.springframework.boot spring-boot-starter-parent - 2.3.1.RELEASE + 3.2.3 + org.springframework.cloud.dataflow.samples user-clicks-per-region-processor - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT jar user-clicks-per-region-processor @@ -23,21 +24,21 @@ org.springframework.cloud spring-cloud-stream-dependencies - Horsham.SR6 + 4.0.5 pom import org.springframework.cloud spring-cloud-function-dependencies - 3.0.8.RELEASE + 4.0.5 pom import org.springframework.cloud spring-cloud-dependencies - Hoxton.SR1 + 2022.0.5 pom import @@ -56,17 +57,17 @@ org.springframework.cloud.stream.app stream-applications-composite-function-support - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-security-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.springframework.cloud.stream.app stream-applications-micrometer-common - 3.0.0-SNAPSHOT + 4.0.1-SNAPSHOT io.micrometer @@ -109,35 +110,14 @@ org.springframework.boot spring-boot-maven-plugin - - - com.google.cloud.tools - jib-maven-plugin - 2.0.0 - - springcloud/openjdk - - - springcloudstream/multi-io-sample-${project.artifactId} - - 1.0.0-SNAPSHOT - - - - USE_CURRENT_TIMESTAMP - Docker - - ${configuration-properties.inbound-ports} - ${configuration-properties.outbound-ports} - - + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} org.springframework.cloud - spring-cloud-app-starter-metadata-maven-plugin - 2.0.2.BUILD-SNAPSHOT + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT aggregate-metadata diff --git a/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java b/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java index e09bfa8..659cfa0 100644 --- a/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java +++ b/multi-io-samples/kafka-streams/user-clicks-per-region/user-clicks-per-region-processor/src/main/java/org/springframework/cloud/dataflow/samples/processor/UserClicksAndUserRegionsProcessor.java @@ -24,7 +24,6 @@ import org.apache.kafka.streams.kstream.Grouped; import org.apache.kafka.streams.kstream.Joined; import org.apache.kafka.streams.kstream.KStream; import org.apache.kafka.streams.kstream.KTable; -import org.apache.kafka.streams.kstream.Serialized; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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. + * 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 { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * 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/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + 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/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/multi-io-samples/purchase-orders/http-purchase-orders-3/README.adoc b/multi-io-samples/purchase-orders/http-purchase-orders-3/README.adoc new file mode 100644 index 0000000..ebd2cd7 --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/README.adoc @@ -0,0 +1,5 @@ +# HTTP Clicks And Region Ingest Source + +To build this application: + +./mvnw clean package diff --git a/multi-io-samples/purchase-orders/http-purchase-orders-3/mvnw b/multi-io-samples/purchase-orders/http-purchase-orders-3/mvnw new file mode 100755 index 0000000..41c0f0c --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/mvnw @@ -0,0 +1,310 @@ +#!/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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# 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 + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + 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 $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + 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" + +# 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 + +# 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$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/multi-io-samples/purchase-orders/http-purchase-orders-3/mvnw.cmd b/multi-io-samples/purchase-orders/http-purchase-orders-3/mvnw.cmd new file mode 100644 index 0000000..8611571 --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/mvnw.cmd @@ -0,0 +1,182 @@ +@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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/multi-io-samples/purchase-orders/http-purchase-orders-3/pom.xml b/multi-io-samples/purchase-orders/http-purchase-orders-3/pom.xml new file mode 100644 index 0000000..c7f0191 --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/pom.xml @@ -0,0 +1,219 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + + org.springframework.cloud.dataflow.samples + http-purchase-orders + 3.0.0-SNAPSHOT + http-purchase-orders + Http purchase order application + + + + + + org.springframework.cloud.fn + function-dependencies + 4.0.1-SNAPSHOT + pom + import + + + org.springframework.cloud + spring-cloud-stream-dependencies + 4.0.5 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 4.0.6 + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + 2022.0.5 + pom + import + + + + + + + + + + org.springframework.cloud.fn + http-supplier + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 4.0.1-SNAPSHOT + + + + + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} + + + configuration-properties.outbound-ports="${configuration-properties.outbound-ports}" + + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + process-classes + + read-project-properties + + + + + ${project.build.outputDirectory}/META-INF/dataflow-configuration-port-mapping.properties + + + + + + + + org.springframework.cloud + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/multi-io-samples/purchase-orders/http-purchase-orders-3/src/main/java/org/springframework/cloud/dataflow/samples/source/PurchaseOrderIngest.java b/multi-io-samples/purchase-orders/http-purchase-orders-3/src/main/java/org/springframework/cloud/dataflow/samples/source/PurchaseOrderIngest.java new file mode 100644 index 0000000..64b5f8d --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/src/main/java/org/springframework/cloud/dataflow/samples/source/PurchaseOrderIngest.java @@ -0,0 +1,114 @@ +/* + * Copyright 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. + * You may obtain a copy of the License at + * + * https://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. + */ + +package org.springframework.cloud.dataflow.samples.source; + +import java.io.IOException; +import java.util.Map; +import java.util.function.Supplier; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.MessageChannels; +import org.springframework.integration.expression.ValueExpression; +import org.springframework.integration.http.support.DefaultHttpHeaderMapper; +import org.springframework.integration.mapping.HeaderMapper; +import org.springframework.integration.webflux.dsl.WebFlux; +import org.springframework.integration.webflux.inbound.WebFluxInboundEndpoint; +import org.springframework.messaging.Message; + +/** + * @author Ilayaperumal Gopinathan + */ +@SpringBootApplication +public class PurchaseOrderIngest { + + private static final Logger logger = LoggerFactory.getLogger(PurchaseOrderIngest.class); + + @Bean + public Publisher> purchaseOrders() { + Publisher> publisher = IntegrationFlows.from( + WebFlux.inboundChannelAdapter("/") + .requestPayloadType(byte[].class) + .statusCodeExpression(new ValueExpression<>(HttpStatus.ACCEPTED)) + .autoStartup(false)) + .channel(MessageChannels.flux()) + .toReactivePublisher(); + return publisher; + } + + @Bean + public HeaderMapper httpHeaderMapper() { + return DefaultHttpHeaderMapper.inboundMapper(); + } + + @Bean + public Supplier>> debitTransactions(Publisher> purchaseOrders, + WebFluxInboundEndpoint webFluxInboundEndpoint) { + + return () -> Flux.from(purchaseOrders) + .filter(message -> filterTransactions(message, "debit")) + .doOnSubscribe((subscription) -> webFluxInboundEndpoint.start()) + .doOnTerminate(webFluxInboundEndpoint::stop); + } + + @Bean + public Supplier>> creditTransactions(Publisher> purchaseOrders, + WebFluxInboundEndpoint webFluxInboundEndpoint) { + + return () -> Flux.from(purchaseOrders) + .filter(message -> filterTransactions(message, "credit")) + .doOnSubscribe((subscription) -> webFluxInboundEndpoint.start()) + .doOnTerminate(webFluxInboundEndpoint::stop); + } + + @Bean + public Supplier>> cashTransactions(Publisher> purchaseOrders, + WebFluxInboundEndpoint webFluxInboundEndpoint) { + + + return () -> Flux.from(purchaseOrders) + .filter(message -> filterTransactions(message, "cash")) + .doOnSubscribe((subscription) -> webFluxInboundEndpoint.start()) + .doOnTerminate(webFluxInboundEndpoint::stop); + } + + public boolean filterTransactions(Message message, String mode) { + try { + ObjectMapper objectMapper = new ObjectMapper(); + Map paylodMap = objectMapper.readValue(message.getPayload(), Map.class); + return paylodMap.get("mode").equals(mode); + } + catch (IOException e) { + logger.error("Error parsing the payload: " + e.getStackTrace()); + } + return false; + } + + public static void main(String[] args) { + SpringApplication.run(PurchaseOrderIngest.class, args); + } +} diff --git a/multi-io-samples/purchase-orders/http-purchase-orders-3/src/main/resources/application.yml b/multi-io-samples/purchase-orders/http-purchase-orders-3/src/main/resources/application.yml new file mode 100644 index 0000000..f7eca60 --- /dev/null +++ b/multi-io-samples/purchase-orders/http-purchase-orders-3/src/main/resources/application.yml @@ -0,0 +1,29 @@ +#spring.cloud.stream.bindings.debit.producer: +# useNativeEncoding: true +# +#spring.cloud.stream.kafka.bindings.user-clicks.producer: +# messageKeyExpression: headers['username'] +# configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer +# configuration.value.serializer: org.apache.kafka.common.serialization.LongSerializer +# +#spring.cloud.stream.bindings.user-regions.producer: +# useNativeEncoding: true +#spring.cloud.stream.kafka.bindings.user-regions.producer: +# messageKeyExpression: headers['username'] +# configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer +# configuration.value.serializer: org.apache.kafka.common.serialization.StringSerializer + +spring.cloud.stream.function.definition: debitTransactions;creditTransactions;cashTransactions +spring.cloud.stream.function.bindings.debitTransactions-out-0: debit +spring.cloud.stream.function.bindings.creditTransactions-out-0: credit +spring.cloud.stream.function.bindings.cashTransactions-out-0: cash + +spring.cloud.stream.bindings.debit.destination: debit1 +spring.cloud.stream.bindings.credit.destination: credit1 +spring.cloud.stream.bindings.cash.destination: cash1 + +spring.main.web-application-type: reactive +spring.cloud.streamapp.security.enabled: false +spring.cloud.streamapp.security.csrf-enabled: false + +management.endpoints.web.exposure.include: health,info,bindings diff --git a/multi-io-samples/purchase-orders/http-purchase-orders/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/purchase-orders/http-purchase-orders/.mvn/wrapper/maven-wrapper.properties index 642d572..5c73b68 100644 --- a/multi-io-samples/purchase-orders/http-purchase-orders/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/purchase-orders/http-purchase-orders/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,3 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + + diff --git a/multi-io-samples/ticktock-3/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/ticktock-3/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/multi-io-samples/ticktock-3/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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. + * 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 { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * 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/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + 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/multi-io-samples/ticktock-3/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/ticktock-3/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/multi-io-samples/ticktock-3/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/ticktock-3/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock-3/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/multi-io-samples/ticktock-3/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/multi-io-samples/ticktock-3/README.adoc b/multi-io-samples/ticktock-3/README.adoc new file mode 100644 index 0000000..c38d36f --- /dev/null +++ b/multi-io-samples/ticktock-3/README.adoc @@ -0,0 +1 @@ += Sample application that showcases multi IO stream diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/jvm.config b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/jvm.config new file mode 100644 index 0000000..0e7dabe --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/maven.config b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/maven.config new file mode 100644 index 0000000..3b8cf46 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/maven.config @@ -0,0 +1 @@ +-DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..2e394d5 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/.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 + + https://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/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..9a9978a --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/README.adoc b/multi-io-samples/ticktock-3/multi-input-log-kafka/README.adoc new file mode 100644 index 0000000..80efbb8 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/README.adoc @@ -0,0 +1 @@ += Spring Cloud Stream Multi Input Log Sink Kafka Binder Application diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/mvnw b/multi-io-samples/ticktock-3/multi-input-log-kafka/mvnw new file mode 100755 index 0000000..a08b219 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/mvnw @@ -0,0 +1,253 @@ +#!/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 +# +# https://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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +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 + +if echo $VERSION | egrep -q 'RELEASE'; then + echo Activating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral" +else + echo Deactivating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//') +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} "$@" diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/mvnw.cmd b/multi-io-samples/ticktock-3/multi-input-log-kafka/mvnw.cmd new file mode 100644 index 0000000..7ecd01d --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/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 https://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/multi-io-samples/ticktock-3/multi-input-log-kafka/pom.xml b/multi-io-samples/ticktock-3/multi-input-log-kafka/pom.xml new file mode 100644 index 0000000..be458b0 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/pom.xml @@ -0,0 +1,307 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + org.springframework.cloud.stream.app + multi-input-log-kafka + 3.0.0-SNAPSHOT + multi-input-log-kafka + Spring Cloud Stream Multi Input Log Sink Kafka Binder Application + + + + + repo.spring.io + Spring Release Repository + https://repo.spring.io/libs-release-local + + + repo.spring.io + Spring Snapshot Repository + https://repo.spring.io/snapshot + + + + + true + UTF-8 + + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + 4.0.5 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 4.0.6 + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + 2022.0.5 + pom + import + + + + + + + + + org.springframework.cloud.fn + log-consumer + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 4.0.1-SNAPSHOT + + + io.micrometer + micrometer-registry-influx + + + io.micrometer + micrometer-registry-prometheus + + + io.micrometer + micrometer-registry-wavefront + + + io.micrometer.prometheus + prometheus-rsocket-spring + 1.6.0-SNAPSHOT + + + io.micrometer + micrometer-registry-datadog + + + io.pivotal.cfenv + java-cfenv-boot + 2.4.1 + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} + + + configuration-properties.inbound-ports="input1,input2,input3" + + + + + + + org.springframework.cloud + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT + + true + + + + + org.springframework.cloud.fn.consumer.log.LogConsumerProperties + + + + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + maven-surefire-plugin + 2.21.0 + + ${skipTests} + + + + maven-javadoc-plugin + + + javadoc + package + + jar + + + + + true + + + + maven-source-plugin + + + attach-sources + package + + jar + + + + + + + + + milestone + + + repo.spring.io + Spring Milestone Repository + https://repo.spring.io/libs-milestone-local + + + + + central + + + + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + + + diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/java/org/springframework/cloud/stream/app/log/sink/kafka/MultiInputLogSinkKafkaApplication.java b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/java/org/springframework/cloud/stream/app/log/sink/kafka/MultiInputLogSinkKafkaApplication.java new file mode 100644 index 0000000..3abeeab --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/java/org/springframework/cloud/stream/app/log/sink/kafka/MultiInputLogSinkKafkaApplication.java @@ -0,0 +1,56 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.log.sink.kafka; + +import java.util.function.Consumer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.fn.consumer.log.LogConsumerProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.integration.dsl.IntegrationFlow; +import org.springframework.messaging.Message; + +@SpringBootApplication +@Import({ org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class }) +public class MultiInputLogSinkKafkaApplication { + + @Bean + IntegrationFlow logConsumerFlow2(LogConsumerProperties logSinkProperties) { + return IntegrationFlow.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer2")) + .handle((payload, headers) -> payload) + .log(logSinkProperties.getLevel(), logSinkProperties.getName(), logSinkProperties.getExpression()) + .get(); + } + + @Bean + IntegrationFlow logConsumerFlow3(LogConsumerProperties logSinkProperties) { + return IntegrationFlow.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer3")) + .handle((payload, headers) -> payload) + .log(logSinkProperties.getLevel(), logSinkProperties.getName(), logSinkProperties.getExpression()) + .get(); + } + + private interface MessageConsumer extends Consumer> { + + } + + public static void main(String[] args) { + SpringApplication.run(MultiInputLogSinkKafkaApplication.class, args); + } +} diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/resources/META-INF/dataflow-configuration-metadata.properties b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/resources/META-INF/dataflow-configuration-metadata.properties new file mode 100644 index 0000000..ab4592d --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/resources/META-INF/dataflow-configuration-metadata.properties @@ -0,0 +1 @@ +configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/resources/application.properties b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/resources/application.properties new file mode 100644 index 0000000..015701a --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/main/resources/application.properties @@ -0,0 +1,16 @@ +spring.application.name=${vcap.application.name:log-sink} +info.app.name=@project.artifactId@ +info.app.description=@project.description@ +info.app.version=@project.version@ +management.endpoints.web.exposure.include=health,info,bindings + +spring.cloud.stream.function.definition=byteArrayTextToString|logConsumer + +spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer-in-0=input1 +spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer2-in-0=input2 +spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer3-in-0=input3 + + + + + diff --git a/multi-io-samples/ticktock-3/multi-input-log-kafka/src/test/java/org/springframework/cloud/stream/app/log/sink/rabbit/LogSinkRabbitApplicationTests.java b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/test/java/org/springframework/cloud/stream/app/log/sink/rabbit/LogSinkRabbitApplicationTests.java new file mode 100644 index 0000000..05a0f12 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-kafka/src/test/java/org/springframework/cloud/stream/app/log/sink/rabbit/LogSinkRabbitApplicationTests.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.log.sink.rabbit; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest +public class LogSinkRabbitApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/jvm.config b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/jvm.config new file mode 100644 index 0000000..0e7dabe --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/maven.config b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/maven.config new file mode 100644 index 0000000..3b8cf46 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/maven.config @@ -0,0 +1 @@ +-DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..2e394d5 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.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 + + https://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/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..9a9978a --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/README.adoc b/multi-io-samples/ticktock-3/multi-input-log-rabbit/README.adoc new file mode 100644 index 0000000..46fa748 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/README.adoc @@ -0,0 +1 @@ += Spring Cloud Stream Multi Input Log Sink Rabbit Binder Application diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/mvnw b/multi-io-samples/ticktock-3/multi-input-log-rabbit/mvnw new file mode 100755 index 0000000..a08b219 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/mvnw @@ -0,0 +1,253 @@ +#!/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 +# +# https://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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +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 + +if echo $VERSION | egrep -q 'RELEASE'; then + echo Activating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral" +else + echo Deactivating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//') +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} "$@" diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/mvnw.cmd b/multi-io-samples/ticktock-3/multi-input-log-rabbit/mvnw.cmd new file mode 100644 index 0000000..7ecd01d --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/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 https://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/multi-io-samples/ticktock-3/multi-input-log-rabbit/pom.xml b/multi-io-samples/ticktock-3/multi-input-log-rabbit/pom.xml new file mode 100644 index 0000000..52861db --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/pom.xml @@ -0,0 +1,307 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + org.springframework.cloud.stream.app + multi-input-log-rabbit + 3.0.0-SNAPSHOT + multi-input-log-rabbit + Spring Cloud Stream Multi Input Log Sink Rabbit Binder Application + + + + + repo.spring.io + Spring Release Repository + https://repo.spring.io/libs-release-local + + + repo.spring.io + Spring Snapshot Repository + https://repo.spring.io/snapshot + + + + + true + UTF-8 + + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + 4.0.5 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 4.0.6 + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + 2022.0.5 + pom + import + + + + + + + + + org.springframework.cloud.fn + log-consumer + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 4.0.1-SNAPSHOT + + + io.micrometer + micrometer-registry-influx + + + io.micrometer + micrometer-registry-prometheus + + + io.micrometer + micrometer-registry-wavefront + + + io.micrometer.prometheus + prometheus-rsocket-spring + 1.6.0-SNAPSHOT + + + io.micrometer + micrometer-registry-datadog + + + io.pivotal.cfenv + java-cfenv-boot + 2.4.1 + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-rabbit + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} + + + configuration-properties.inbound-ports="input1,input2,input3" + + + + + + + org.springframework.cloud + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT + + true + + + + + org.springframework.cloud.fn.consumer.log.LogConsumerProperties + + + + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + maven-surefire-plugin + 2.21.0 + + ${skipTests} + + + + maven-javadoc-plugin + + + javadoc + package + + jar + + + + + true + + + + maven-source-plugin + + + attach-sources + package + + jar + + + + + + + + + milestone + + + repo.spring.io + Spring Milestone Repository + https://repo.spring.io/libs-milestone-local + + + + + central + + + + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + + + diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/java/org/springframework/cloud/stream/app/log/sink/rabbit/MultiInputLogSinkRabbitApplication.java b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/java/org/springframework/cloud/stream/app/log/sink/rabbit/MultiInputLogSinkRabbitApplication.java new file mode 100644 index 0000000..a0aaccd --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/java/org/springframework/cloud/stream/app/log/sink/rabbit/MultiInputLogSinkRabbitApplication.java @@ -0,0 +1,56 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.log.sink.rabbit; + +import java.util.function.Consumer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.fn.consumer.log.LogConsumerProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.integration.dsl.IntegrationFlow; +import org.springframework.messaging.Message; + +@SpringBootApplication +@Import({ org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class }) +public class MultiInputLogSinkRabbitApplication { + + @Bean + IntegrationFlow logConsumerFlow2(LogConsumerProperties logSinkProperties) { + return IntegrationFlow.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer2")) + .handle((payload, headers) -> payload) + .log(logSinkProperties.getLevel(), logSinkProperties.getName(), logSinkProperties.getExpression()) + .get(); + } + + @Bean + IntegrationFlow logConsumerFlow3(LogConsumerProperties logSinkProperties) { + return IntegrationFlow.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer3")) + .handle((payload, headers) -> payload) + .log(logSinkProperties.getLevel(), logSinkProperties.getName(), logSinkProperties.getExpression()) + .get(); + } + + private interface MessageConsumer extends Consumer> { + + } + + public static void main(String[] args) { + SpringApplication.run(MultiInputLogSinkRabbitApplication.class, args); + } +} diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/resources/META-INF/dataflow-configuration-metadata.properties b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/resources/META-INF/dataflow-configuration-metadata.properties new file mode 100644 index 0000000..ab4592d --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/resources/META-INF/dataflow-configuration-metadata.properties @@ -0,0 +1 @@ +configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/resources/application.properties b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/resources/application.properties new file mode 100644 index 0000000..dad608a --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/main/resources/application.properties @@ -0,0 +1,16 @@ +spring.application.name=${vcap.application.name:log-sink} +info.app.name=@project.artifactId@ +info.app.description=@project.description@ +info.app.version=@project.version@ +management.endpoints.web.exposure.include=health,info,bindings + +spring.cloud.stream.function.definition=byteArrayTextToString|logConsumer;byteArrayTextToString|logConsumer2;byteArrayTextToString|logConsumer3 + +spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer-in-0=input1 +spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer2-in-0=input2 +spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer3-in-0=input3 + + + + + diff --git a/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/test/java/org/springframework/cloud/stream/app/log/sink/rabbit/LogSinkRabbitApplicationTests.java b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/test/java/org/springframework/cloud/stream/app/log/sink/rabbit/LogSinkRabbitApplicationTests.java new file mode 100644 index 0000000..05a0f12 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-input-log-rabbit/src/test/java/org/springframework/cloud/stream/app/log/sink/rabbit/LogSinkRabbitApplicationTests.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.log.sink.rabbit; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest +public class LogSinkRabbitApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/jvm.config b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/jvm.config new file mode 100644 index 0000000..0e7dabe --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/maven.config b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/maven.config new file mode 100644 index 0000000..3b8cf46 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/maven.config @@ -0,0 +1 @@ +-DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..2e394d5 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/.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 + + https://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/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f77b5d1 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/README.adoc b/multi-io-samples/ticktock-3/multi-output-time-kafka/README.adoc new file mode 100644 index 0000000..6add226 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/README.adoc @@ -0,0 +1 @@ += Spring Cloud Stream Multi Output Time Source Kafka Binder Application diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/mvnw b/multi-io-samples/ticktock-3/multi-output-time-kafka/mvnw new file mode 100755 index 0000000..a08b219 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/mvnw @@ -0,0 +1,253 @@ +#!/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 +# +# https://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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +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 + +if echo $VERSION | egrep -q 'RELEASE'; then + echo Activating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral" +else + echo Deactivating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//') +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} "$@" diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/mvnw.cmd b/multi-io-samples/ticktock-3/multi-output-time-kafka/mvnw.cmd new file mode 100644 index 0000000..7ecd01d --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/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 https://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/multi-io-samples/ticktock-3/multi-output-time-kafka/pom.xml b/multi-io-samples/ticktock-3/multi-output-time-kafka/pom.xml new file mode 100644 index 0000000..ae48115 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/pom.xml @@ -0,0 +1,313 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + org.springframework.cloud.stream.app + multi-output-time-kafka + 3.0.0-SNAPSHOT + multi-output-time-kafka + Spring Cloud Stream Multi Output Time Source Kafka Binder Application + + + + + repo.spring.io + Spring Release Repository + https://repo.spring.io/libs-release-local + + + repo.spring.io + Spring Snapshot Repository + https://repo.spring.io/snapshot + + + + + true + UTF-8 + + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + 4.0.5 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 4.0.6 + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + 2022.0.5 + pom + import + + + + + + + + + org.springframework.cloud.fn + time-supplier + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 4.0.1-SNAPSHOT + + + io.micrometer + micrometer-registry-influx + + + io.micrometer + micrometer-registry-prometheus + + + io.micrometer + micrometer-registry-wavefront + + + io.micrometer.prometheus + prometheus-rsocket-spring + 1.6.0-SNAPSHOT + + + io.micrometer + micrometer-registry-datadog + + + io.pivotal.cfenv + java-cfenv-boot + 2.4.1 + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-kafka + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} + + + configuration-properties.outbound-ports="output1,output2,output3" + + + + + + + org.springframework.cloud + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT + + true + + + + + org.springframework.cloud.fn.supplier.time.TimeSupplierProperties + org.springframework.cloud.stream.config.DefaultPollerProperties + + + + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + maven-surefire-plugin + 2.21.0 + + ${skipTests} + + + + maven-javadoc-plugin + + + javadoc + package + + jar + + + + + true + + + + maven-source-plugin + + + attach-sources + package + + jar + + + + + + + + + milestone + + + repo.spring.io + Spring Milestone Repository + https://repo.spring.io/libs-milestone-local + + + + + central + + + + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + + + diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/java/org/springframework/cloud/stream/app/time/source/kafka/MultiOutputTimeSourceKafkaApplication.java b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/java/org/springframework/cloud/stream/app/time/source/kafka/MultiOutputTimeSourceKafkaApplication.java new file mode 100644 index 0000000..12844e7 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/java/org/springframework/cloud/stream/app/time/source/kafka/MultiOutputTimeSourceKafkaApplication.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.time.source.kafka; + +import java.util.Date; +import java.util.function.Supplier; + +import org.apache.commons.lang3.time.FastDateFormat; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.fn.supplier.time.TimeSupplierProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; + + +@SpringBootApplication +@Import({ org.springframework.cloud.fn.supplier.time.TimeSupplierConfiguration.class }) +public class MultiOutputTimeSourceKafkaApplication { + + @Bean + public Supplier timeSupplier2(TimeSupplierProperties timeSupplierProperties) { + FastDateFormat fastDateFormat = FastDateFormat.getInstance(timeSupplierProperties.getDateFormat()); + return () -> fastDateFormat.format(new Date()); + } + + @Bean + public Supplier timeSupplier3(TimeSupplierProperties timeSupplierProperties) { + FastDateFormat fastDateFormat = FastDateFormat.getInstance(timeSupplierProperties.getDateFormat()); + return () -> fastDateFormat.format(new Date()); + } + + public static void main(String[] args) { + SpringApplication.run(MultiOutputTimeSourceKafkaApplication.class, args); + } +} diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/resources/META-INF/dataflow-configuration-metadata.properties b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/resources/META-INF/dataflow-configuration-metadata.properties new file mode 100644 index 0000000..f500b08 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/resources/META-INF/dataflow-configuration-metadata.properties @@ -0,0 +1,3 @@ +configuration-properties.classes=org.springframework.cloud.fn.supplier.time.TimeSupplierProperties,\ + org.springframework.cloud.stream.config.DefaultPollerProperties +configuration-properties.outbound-ports=output1,output2,output3 diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/resources/application.properties b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/resources/application.properties new file mode 100644 index 0000000..90e6b15 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/main/resources/application.properties @@ -0,0 +1,15 @@ +spring.application.name=${vcap.application.name:time-source} +info.app.name=@project.artifactId@ +info.app.description=@project.description@ +info.app.version=@project.version@ +management.endpoints.web.exposure.include=health,info,bindings + +spring.cloud.stream.function.definition=timeSupplier;timeSupplier2;timeSupplier3 + + +spring.cloud.stream.function.bindings.timeSupplier-out-0=output1 +spring.cloud.stream.function.bindings.timeSupplier2-out-0=output2 +spring.cloud.stream.function.bindings.timeSupplier3-out-0=output3 + + + diff --git a/multi-io-samples/ticktock-3/multi-output-time-kafka/src/test/java/org/springframework/cloud/stream/app/time/source/rabbit/TimeSourceRabbitApplicationTests.java b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/test/java/org/springframework/cloud/stream/app/time/source/rabbit/TimeSourceRabbitApplicationTests.java new file mode 100644 index 0000000..da1bd71 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-kafka/src/test/java/org/springframework/cloud/stream/app/time/source/rabbit/TimeSourceRabbitApplicationTests.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.time.source.rabbit; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest +public class TimeSourceRabbitApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/jvm.config b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/jvm.config new file mode 100644 index 0000000..0e7dabe --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/maven.config b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/maven.config new file mode 100644 index 0000000..3b8cf46 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/maven.config @@ -0,0 +1 @@ +-DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/MavenWrapperDownloader.java b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..2e394d5 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.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 + + https://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/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.jar b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.jar differ diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f77b5d1 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/README.adoc b/multi-io-samples/ticktock-3/multi-output-time-rabbit/README.adoc new file mode 100644 index 0000000..6de7eee --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/README.adoc @@ -0,0 +1 @@ += Spring Cloud Stream Time Source Rabbit Binder Application diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/mvnw b/multi-io-samples/ticktock-3/multi-output-time-rabbit/mvnw new file mode 100755 index 0000000..a08b219 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/mvnw @@ -0,0 +1,253 @@ +#!/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 +# +# https://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 + # + # 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 + ;; +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 + +# 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) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +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 + +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 + +if echo $VERSION | egrep -q 'RELEASE'; then + echo Activating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral" +else + echo Deactivating \"central\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//') +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} "$@" diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/mvnw.cmd b/multi-io-samples/ticktock-3/multi-output-time-rabbit/mvnw.cmd new file mode 100644 index 0000000..7ecd01d --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/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 https://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/multi-io-samples/ticktock-3/multi-output-time-rabbit/pom.xml b/multi-io-samples/ticktock-3/multi-output-time-rabbit/pom.xml new file mode 100644 index 0000000..818e9d4 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/pom.xml @@ -0,0 +1,313 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + org.springframework.cloud.stream.app + multi-output-time-rabbit + 3.0.0-SNAPSHOT + multi-output-time-rabbit + Spring Cloud Stream Multi Output Time Source Rabbit Binder Application + + + + + repo.spring.io + Spring Release Repository + https://repo.spring.io/libs-release-local + + + repo.spring.io + Spring Snapshot Repository + https://repo.spring.io/libs-snapshot-local + + + + + true + UTF-8 + + + + + + + org.springframework.cloud + spring-cloud-stream-dependencies + 4.0.5 + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 4.0.6 + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + 2022.0.5 + pom + import + + + + + + + + + org.springframework.cloud.fn + time-supplier + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-composite-function-support + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-security-common + 4.0.1-SNAPSHOT + + + org.springframework.cloud.stream.app + stream-applications-micrometer-common + 4.0.1-SNAPSHOT + + + io.micrometer + micrometer-registry-influx + + + io.micrometer + micrometer-registry-prometheus + + + io.micrometer + micrometer-registry-wavefront + + + io.micrometer.prometheus + prometheus-rsocket-spring + 1.6.0-SNAPSHOT + + + io.micrometer + micrometer-registry-datadog + + + io.pivotal.cfenv + java-cfenv-boot + 2.4.1 + + + org.springframework.boot + spring-boot-configuration-processor + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.cloud + spring-cloud-stream-binder-rabbit + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/multi-io-sample-${project.artifactId}:${project.version} + + + configuration-properties.outbound-ports="output1,output2,output3" + + + + + + + org.springframework.cloud + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT + + true + + + + + org.springframework.cloud.fn.supplier.time.TimeSupplierProperties + org.springframework.cloud.stream.config.DefaultPollerProperties + + + + + + aggregate-metadata + compile + + aggregate-metadata + + + + + + maven-surefire-plugin + 2.21.0 + + ${skipTests} + + + + maven-javadoc-plugin + + + javadoc + package + + jar + + + + + true + + + + maven-source-plugin + + + attach-sources + package + + jar + + + + + + + + + milestone + + + repo.spring.io + Spring Milestone Repository + https://repo.spring.io/libs-milestone-local + + + + + central + + + + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + + + diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/java/org/springframework/cloud/stream/app/time/source/rabbit/MultiOutputTimeSourceRabbitApplication.java b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/java/org/springframework/cloud/stream/app/time/source/rabbit/MultiOutputTimeSourceRabbitApplication.java new file mode 100644 index 0000000..804e672 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/java/org/springframework/cloud/stream/app/time/source/rabbit/MultiOutputTimeSourceRabbitApplication.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019-2020 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. + * 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 dMuistributed 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. + */ + +package org.springframework.cloud.stream.app.time.source.rabbit; + +import java.util.Date; +import java.util.function.Supplier; + +import org.apache.commons.lang3.time.FastDateFormat; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.fn.supplier.time.TimeSupplierProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; + + +@SpringBootApplication +@Import({ org.springframework.cloud.fn.supplier.time.TimeSupplierConfiguration.class }) +public class MultiOutputTimeSourceRabbitApplication { + + @Bean + public Supplier timeSupplier2(TimeSupplierProperties timeSupplierProperties) { + FastDateFormat fastDateFormat = FastDateFormat.getInstance(timeSupplierProperties.getDateFormat()); + return () -> fastDateFormat.format(new Date()); + } + + @Bean + public Supplier timeSupplier3(TimeSupplierProperties timeSupplierProperties) { + FastDateFormat fastDateFormat = FastDateFormat.getInstance(timeSupplierProperties.getDateFormat()); + return () -> fastDateFormat.format(new Date()); + } + + public static void main(String[] args) { + SpringApplication.run(MultiOutputTimeSourceRabbitApplication.class, args); + } +} diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/resources/META-INF/dataflow-configuration-metadata.properties b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/resources/META-INF/dataflow-configuration-metadata.properties new file mode 100644 index 0000000..f500b08 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/resources/META-INF/dataflow-configuration-metadata.properties @@ -0,0 +1,3 @@ +configuration-properties.classes=org.springframework.cloud.fn.supplier.time.TimeSupplierProperties,\ + org.springframework.cloud.stream.config.DefaultPollerProperties +configuration-properties.outbound-ports=output1,output2,output3 diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/resources/application.properties b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/resources/application.properties new file mode 100644 index 0000000..90e6b15 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/main/resources/application.properties @@ -0,0 +1,15 @@ +spring.application.name=${vcap.application.name:time-source} +info.app.name=@project.artifactId@ +info.app.description=@project.description@ +info.app.version=@project.version@ +management.endpoints.web.exposure.include=health,info,bindings + +spring.cloud.stream.function.definition=timeSupplier;timeSupplier2;timeSupplier3 + + +spring.cloud.stream.function.bindings.timeSupplier-out-0=output1 +spring.cloud.stream.function.bindings.timeSupplier2-out-0=output2 +spring.cloud.stream.function.bindings.timeSupplier3-out-0=output3 + + + diff --git a/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/test/java/org/springframework/cloud/stream/app/time/source/rabbit/TimeSourceRabbitApplicationTests.java b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/test/java/org/springframework/cloud/stream/app/time/source/rabbit/TimeSourceRabbitApplicationTests.java new file mode 100644 index 0000000..da1bd71 --- /dev/null +++ b/multi-io-samples/ticktock-3/multi-output-time-rabbit/src/test/java/org/springframework/cloud/stream/app/time/source/rabbit/TimeSourceRabbitApplicationTests.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 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. + * 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. + */ + +package org.springframework.cloud.stream.app.time.source.rabbit; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest +public class TimeSourceRabbitApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/multi-io-samples/ticktock-3/mvnw b/multi-io-samples/ticktock-3/mvnw new file mode 100755 index 0000000..41c0f0c --- /dev/null +++ b/multi-io-samples/ticktock-3/mvnw @@ -0,0 +1,310 @@ +#!/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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# 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 + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + 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 $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + 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" + +# 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 + +# 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$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/multi-io-samples/ticktock-3/mvnw.cmd b/multi-io-samples/ticktock-3/mvnw.cmd new file mode 100644 index 0000000..8611571 --- /dev/null +++ b/multi-io-samples/ticktock-3/mvnw.cmd @@ -0,0 +1,182 @@ +@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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/multi-io-samples/ticktock-3/pom.xml b/multi-io-samples/ticktock-3/pom.xml new file mode 100644 index 0000000..33d2a7b --- /dev/null +++ b/multi-io-samples/ticktock-3/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + org.springframework.cloud.dataflow.samples + ticktock-3 + 3.0.0-SNAPSHOT + pom + + multi-output-time-rabbit + multi-input-log-rabbit + multi-output-time-kafka + multi-input-log-kafka + + + VMware, Inc. + https://www.spring.io + + diff --git a/multi-io-samples/ticktock/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/multi-io-samples/ticktock/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/ticktock/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/ticktock/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties index 00d32aa..f77b5d1 100644 --- a/multi-io-samples/ticktock/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/ticktock/multi-input-log-kafka/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -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 +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/ticktock/multi-input-log-kafka/pom.xml b/multi-io-samples/ticktock/multi-input-log-kafka/pom.xml index 35717c9..feb1273 100644 --- a/multi-io-samples/ticktock/multi-input-log-kafka/pom.xml +++ b/multi-io-samples/ticktock/multi-input-log-kafka/pom.xml @@ -203,8 +203,8 @@ org.springframework.cloud - spring-cloud-app-starter-metadata-maven-plugin - 2.0.2.BUILD-SNAPSHOT + spring-cloud-dataflow-apps-metadata-plugin + 1.0.12-SNAPSHOT true diff --git a/multi-io-samples/ticktock/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties index 00d32aa..f77b5d1 100644 --- a/multi-io-samples/ticktock/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/ticktock/multi-input-log-rabbit/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -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 +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/ticktock/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties index 00d32aa..f77b5d1 100644 --- a/multi-io-samples/ticktock/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/ticktock/multi-output-time-kafka/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -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 +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/multi-io-samples/ticktock/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties b/multi-io-samples/ticktock/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties index 00d32aa..f77b5d1 100644 --- a/multi-io-samples/ticktock/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties +++ b/multi-io-samples/ticktock/multi-output-time-rabbit/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -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 +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/restaurant-stream-apps-3/README.adoc b/restaurant-stream-apps-3/README.adoc new file mode 100644 index 0000000..81f7e9b --- /dev/null +++ b/restaurant-stream-apps-3/README.adoc @@ -0,0 +1,47 @@ += Demonstration of Multi binding Stream apps + +In the case where stream apps need to consume or produce multiple streams the following scenario may provide an example. + +== Scenario +This artificial scenario consists of 3 apps representing a kitchen, waitron and customer of a restaurant. + +* Once the kitchen app is live it will send an open message. +* When customer receive the open message it places 3 random orders of food, hot drinks and cold drinks. +* The waitron receives order from customers and passes those to the Kitchen. +* The Kitchen prepares and sends out the food or hot drinks or cold drinks. +* The waitron receives the food or drinks and delivers to the Customer. +* The customer pays for the items. +* The Waitron acknowledges receipt. + +The set of properties below are required to connect the various endpoints. +The DSL to create and deploy this scenario is: `kitchen || waitron || customer` +Assuming the apps are registered with those names. + +[source,properties] +.... +app.customer.spring.cloud.stream.bindings.open.destination=openDest +app.customer.spring.cloud.stream.bindings.order.destination=orderDest +app.customer.spring.cloud.stream.bindings.payment.destination=paymentDest +app.customer.spring.cloud.stream.bindings.receive.destination=receiveDest + +app.kitchen.spring.cloud.stream.bindings.coldDrinks.destination=coldDrinksDest +app.kitchen.spring.cloud.stream.bindings.food.destination=foodDest +app.kitchen.spring.cloud.stream.bindings.hotDrinks.destination=hotDrinksDest +app.kitchen.spring.cloud.stream.bindings.open.destination=openDest +app.kitchen.spring.cloud.stream.bindings.orders.destination=ordersDate +app.kitchen.spring.cloud.stream.bindings.staff.destination=staffDest + +app.waitron.spring.cloud.stream.bindings.atWork.destination=staffDest +app.waitron.spring.cloud.stream.bindings.coldDrinks.destination=coldDrinksDest +app.waitron.spring.cloud.stream.bindings.delivery.destination=receiveDest +app.waitron.spring.cloud.stream.bindings.food.destination=foodDest +app.waitron.spring.cloud.stream.bindings.hotDrinks.destination=hotDrinksDest +app.waitron.spring.cloud.stream.bindings.order.destination=orderDest +app.waitron.spring.cloud.stream.bindings.orders.destination=ordersDest +app.waitron.spring.cloud.stream.bindings.payment.destination=paymentDest +.... + +[NOTE] +==== +These projects are configured with RabbitMQ binders only. +==== diff --git a/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/MavenWrapperDownloader.java b/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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. + * You may obtain a copy of the License at + * + * https://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 { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * 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/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + 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/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/maven-wrapper.jar b/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/maven-wrapper.jar differ diff --git a/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties b/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/restaurant-stream-apps-3/scdf-app-customer/mvnw b/restaurant-stream-apps-3/scdf-app-customer/mvnw new file mode 100755 index 0000000..a16b543 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/mvnw @@ -0,0 +1,310 @@ +#!/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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# 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 + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + 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 $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + 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" + +# 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 + +# 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$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/restaurant-stream-apps-3/scdf-app-customer/mvnw.cmd b/restaurant-stream-apps-3/scdf-app-customer/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/mvnw.cmd @@ -0,0 +1,182 @@ +@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 https://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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/restaurant-stream-apps-3/scdf-app-customer/pom.xml b/restaurant-stream-apps-3/scdf-app-customer/pom.xml new file mode 100644 index 0000000..5c3a023 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + io.spring + scdf-app-customer + 3.0.0-SNAPSHOT + SCDF Stream App Customer + scdf-app-customer + + 17 + 2022.0.5 + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + org.springframework.cloud + spring-cloud-function-dependencies + 4.0.5 + pom + import + + + org.springframework.cloud + spring-cloud-stream-dependencies + 4.0.5 + pom + import + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-stream + + + org.springframework.cloud + spring-cloud-stream-binder-rabbit + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.amqp + spring-rabbit-test + test + + + org.springframework.cloud + spring-cloud-stream-test-binder + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/${project.artifactId}:${project.version} + + IF_NOT_PRESENT + + + + + diff --git a/restaurant-stream-apps-3/scdf-app-customer/src/main/java/io/spring/scdf/customer/Customer.java b/restaurant-stream-apps-3/scdf-app-customer/src/main/java/io/spring/scdf/customer/Customer.java new file mode 100644 index 0000000..0867187 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/src/main/java/io/spring/scdf/customer/Customer.java @@ -0,0 +1,91 @@ +/* + * Copyright 2022 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. + * You may obtain a copy of the License at + * + * https://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. + */ +package io.spring.scdf.customer; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.function.Consumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.cloud.stream.function.StreamBridge; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.support.MessageBuilder; + +/** + * @author Corneil du Plessis + */ +@Configuration +public class Customer { + private static final Logger logger = LoggerFactory.getLogger(Customer.class); + private final Random random = new Random(System.currentTimeMillis()); + private final List cold = Arrays.asList("water", "coke", "sprite"); + private final List hot = Arrays.asList("coffee", "tea"); + private final List food = Arrays.asList("burger", "pizza", "steak", "pasta"); + private final StreamBridge bridge; + private boolean placedOrder = false; + + public Customer(StreamBridge bridge) { + this.bridge = bridge; + } + + public void placeOrders() { + if (!placedOrder) { + logger.info("placeOrder:start"); + placeOrder(cold); + placeOrder(food); + placeOrder(hot); + placedOrder = true; + logger.info("placeOrder:end"); + } else { + logger.info("placeOrder:done"); + } + } + + public void placeOrder(List items) { + String item = items.get(random.nextInt(items.size())); + logger.info("placeOrder:send:order:{}", item); + bridge.send(Events.ORDER, MessageBuilder.withPayload(item).build()); + } + + + @Bean(name = Events.RECEIVE) + public Consumer receive() { + return (String order) -> { + String message = "money for " + order; + logger.info("receive:{}:send:payment:{}", order, message); + bridge.send(Events.PAYMENT, MessageBuilder.withPayload(message).build()); + }; + } + + @Bean(name = Events.OPEN) + public Consumer isOpen() { + return (String message) -> { + logger.info("isOpen:{}", message); + placeOrders(); + }; + } + + public interface Events { + String OPEN = "open"; + String ORDER = "order"; + String RECEIVE = "receive"; + String PAYMENT = "payment"; + } +} diff --git a/restaurant-stream-apps-3/scdf-app-customer/src/main/java/io/spring/scdf/customer/ScdfAppCustomerApplication.java b/restaurant-stream-apps-3/scdf-app-customer/src/main/java/io/spring/scdf/customer/ScdfAppCustomerApplication.java new file mode 100644 index 0000000..47fb41d --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/src/main/java/io/spring/scdf/customer/ScdfAppCustomerApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright 2022 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. + * You may obtain a copy of the License at + * + * https://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. + */ +package io.spring.scdf.customer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableScheduling +public class ScdfAppCustomerApplication { + + public static void main(String[] args) { + SpringApplication.run(ScdfAppCustomerApplication.class, args); + } + +} diff --git a/restaurant-stream-apps-3/scdf-app-customer/src/main/resources/application.properties b/restaurant-stream-apps-3/scdf-app-customer/src/main/resources/application.properties new file mode 100644 index 0000000..0ca4a29 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/src/main/resources/application.properties @@ -0,0 +1,13 @@ +spring.application.name=customer +logging.level.root=info +logging.level.io.spring=debug +logging.level.org.springframework.cloud=debug +logging.level.com.rabbitmq.client=debug +logging.level.io.fabric8=debug + +spring.cloud.deployer.kubernetes.startupProbeScheme=TCP +spring.cloud.deployer.kubernetes.startupTcpProbeDelay=30 +spring.cloud.deployer.kubernetes.startupTcpProbePeriod=5 +spring.cloud.deployer.kubernetes.startupTcpProbePort=${server.port} +spring.cloud.deployer.kubernetes.livenessHttpProbeDelay=1 +spring.cloud.deployer.kubernetes.readinessHttpProbeDelay=1 \ No newline at end of file diff --git a/restaurant-stream-apps-3/scdf-app-customer/src/test/java/io/spring/scdf/customer/ScdfAppCustomerApplicationTests.java b/restaurant-stream-apps-3/scdf-app-customer/src/test/java/io/spring/scdf/customer/ScdfAppCustomerApplicationTests.java new file mode 100644 index 0000000..1b60e8f --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-customer/src/test/java/io/spring/scdf/customer/ScdfAppCustomerApplicationTests.java @@ -0,0 +1,15 @@ +package io.spring.scdf.customer; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +@SpringBootTest +@ActiveProfiles(profiles = "test") +class ScdfAppCustomerApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/MavenWrapperDownloader.java b/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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. + * You may obtain a copy of the License at + * + * https://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 { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * 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/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + 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/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.jar b/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.jar differ diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties b/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/mvnw b/restaurant-stream-apps-3/scdf-app-kitchen/mvnw new file mode 100755 index 0000000..a16b543 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/mvnw @@ -0,0 +1,310 @@ +#!/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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# 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 + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + 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 $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + 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" + +# 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 + +# 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$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/restaurant-stream-apps-3/scdf-app-kitchen/mvnw.cmd b/restaurant-stream-apps-3/scdf-app-kitchen/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/mvnw.cmd @@ -0,0 +1,182 @@ +@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 https://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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/restaurant-stream-apps-3/scdf-app-kitchen/pom.xml b/restaurant-stream-apps-3/scdf-app-kitchen/pom.xml new file mode 100644 index 0000000..185af97 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + io.spring + scdf-app-kitchen + 3.0.0-SNAPSHOT + SCDF Stream App Kitchen + scdf-app-kitchen + + 17 + 2022.0.5 + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.cloud + spring-cloud-stream + + + org.springframework.cloud + spring-cloud-stream-binder-rabbit + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.amqp + spring-rabbit-test + test + + + org.springframework.cloud + spring-cloud-stream-test-binder + test + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/${project.artifactId}:${project.version} + + IF_NOT_PRESENT + + + + + + diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/src/main/java/io/spring/scdf/restaurant/Kitchen.java b/restaurant-stream-apps-3/scdf-app-kitchen/src/main/java/io/spring/scdf/restaurant/Kitchen.java new file mode 100644 index 0000000..3435958 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/src/main/java/io/spring/scdf/restaurant/Kitchen.java @@ -0,0 +1,87 @@ +/* + * Copyright 2022 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. + * You may obtain a copy of the License at + * + * https://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. + */ +package io.spring.scdf.restaurant; + +import java.util.function.Consumer; +import java.util.function.Supplier; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.cloud.stream.function.StreamBridge; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.support.MessageBuilder; + +/** + * @author Corneil du Plessis + */ + +@Configuration +public class Kitchen { + private static final Logger logger = LoggerFactory.getLogger(Kitchen.class); + private final StreamBridge bridge; + + public Kitchen(StreamBridge bridge) { + + this.bridge = bridge; + } + + @Bean(name = Events.ORDERS) + public Consumer acceptOrders() { + return (String order) -> { + logger.info("acceptOrder:{}", order); + switch (order.toUpperCase()) { + case "COFFEE": + case "TEA": + logger.info("dispense:send:hotDrinks:{}", order); + bridge.send(Events.HOT_DRINKS, MessageBuilder.withPayload(order).build()); + break; + case "COKE": + case "SPRITE": + case "WATER": + logger.info("dispense:send:coldDrinks:{}", order); + bridge.send(Events.COLD_DRINKS, MessageBuilder.withPayload(order).build()); + break; + default: + logger.info("dispense:send:food:{}", order); + bridge.send(Events.FOOD, MessageBuilder.withPayload(order).build()); + break; + } + }; + } + + @Bean(name = Events.STAFF) + public Consumer staffArrivals() { + return (String staff) -> { + logger.info("staffArrivals:{}", staff); + if (staff.equals("waitron")) { + logger.info("staffArrivals:send:open:welcome"); + bridge.send(Events.OPEN, MessageBuilder.withPayload("welcome").build()); + } + }; + } + + public interface Events { + String STAFF = "staff"; + String ORDERS = "orders"; + String FOOD = "food"; + String COLD_DRINKS = "coldDrinks"; + String HOT_DRINKS = "hotDrinks"; + String OPEN = "open"; + + } +} diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/src/main/java/io/spring/scdf/restaurant/ScdfAppKitchenApplication.java b/restaurant-stream-apps-3/scdf-app-kitchen/src/main/java/io/spring/scdf/restaurant/ScdfAppKitchenApplication.java new file mode 100644 index 0000000..2b53a0c --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/src/main/java/io/spring/scdf/restaurant/ScdfAppKitchenApplication.java @@ -0,0 +1,28 @@ +/* + * Copyright 2022 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. + * You may obtain a copy of the License at + * + * https://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. + */ +package io.spring.scdf.restaurant; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ScdfAppKitchenApplication { + + public static void main(String[] args) { + SpringApplication.run(ScdfAppKitchenApplication.class, args); + } + +} diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/src/main/resources/application.properties b/restaurant-stream-apps-3/scdf-app-kitchen/src/main/resources/application.properties new file mode 100644 index 0000000..8287fe2 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/src/main/resources/application.properties @@ -0,0 +1,14 @@ +spring.application.name=restaurant + +logging.level.root=info +logging.level.io.spring=debug +logging.level.org.springframework.cloud=debug +logging.level.com.rabbitmq.client=debug +logging.level.io.fabric8=debug + +spring.cloud.deployer.kubernetes.startupProbeScheme=TCP +spring.cloud.deployer.kubernetes.startupTcpProbeDelay=30 +spring.cloud.deployer.kubernetes.startupTcpProbePeriod=5 +spring.cloud.deployer.kubernetes.startupTcpProbePort=${server.port} +spring.cloud.deployer.kubernetes.livenessHttpProbeDelay=1 +spring.cloud.deployer.kubernetes.readinessHttpProbeDelay=1 \ No newline at end of file diff --git a/restaurant-stream-apps-3/scdf-app-kitchen/src/test/java/io/spring/scdf/restaurant/ScdfAppRestaurantApplicationTests.java b/restaurant-stream-apps-3/scdf-app-kitchen/src/test/java/io/spring/scdf/restaurant/ScdfAppRestaurantApplicationTests.java new file mode 100644 index 0000000..e36ffc9 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-kitchen/src/test/java/io/spring/scdf/restaurant/ScdfAppRestaurantApplicationTests.java @@ -0,0 +1,13 @@ +package io.spring.scdf.restaurant; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ScdfAppRestaurantApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/MavenWrapperDownloader.java b/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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. + * You may obtain a copy of the License at + * + * https://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 { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * 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/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + 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/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/maven-wrapper.jar b/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/maven-wrapper.jar differ diff --git a/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties b/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..f74cae6 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip + diff --git a/restaurant-stream-apps-3/scdf-app-waitron/mvnw b/restaurant-stream-apps-3/scdf-app-waitron/mvnw new file mode 100755 index 0000000..a16b543 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/mvnw @@ -0,0 +1,310 @@ +#!/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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# 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 + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + 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 $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + 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" + +# 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 + +# 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 + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$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/restaurant-stream-apps-3/scdf-app-waitron/mvnw.cmd b/restaurant-stream-apps-3/scdf-app-waitron/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/mvnw.cmd @@ -0,0 +1,182 @@ +@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 https://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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/restaurant-stream-apps-3/scdf-app-waitron/pom.xml b/restaurant-stream-apps-3/scdf-app-waitron/pom.xml new file mode 100644 index 0000000..bd7e3b5 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + io.spring + scdf-app-waitron + 3.0.0-SNAPSHOT + SCDF Stream App Waitron + SCDF Stream App Waitron + + 17 + 2022.0.5 + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.cloud + spring-cloud-stream + + + org.springframework.cloud + spring-cloud-stream-binder-rabbit + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.amqp + spring-rabbit-test + test + + + org.springframework.cloud + spring-cloud-stream-test-binder + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + springcloudstream/${project.artifactId}:${project.version} + + IF_NOT_PRESENT + + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/restaurant-stream-apps-3/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java b/restaurant-stream-apps-3/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java new file mode 100644 index 0000000..e7b6130 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright 2022 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. + * You may obtain a copy of the License at + * + * https://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. + */ +package io.spring.scdf.waitron; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableScheduling +public class ScdfAppWaitronApplication { + + public static void main(String[] args) { + SpringApplication.run(ScdfAppWaitronApplication.class, args); + } + +} diff --git a/restaurant-stream-apps-3/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java b/restaurant-stream-apps-3/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java new file mode 100644 index 0000000..239d8a7 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java @@ -0,0 +1,123 @@ +/* + * Copyright 2022 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. + * You may obtain a copy of the License at + * + * https://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. + */ +package io.spring.scdf.waitron; + +import java.util.concurrent.Callable; +import java.util.function.Consumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.boot.availability.ApplicationAvailability; +import org.springframework.boot.availability.AvailabilityChangeEvent; +import org.springframework.boot.availability.LivenessState; +import org.springframework.boot.availability.ReadinessState; +import org.springframework.cloud.stream.function.StreamBridge; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.event.EventListener; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import org.springframework.core.task.AsyncTaskExecutor; +import org.springframework.messaging.support.MessageBuilder; + +/** + * @author Corneil du Plessis + */ +@Configuration +public class Waitron { + private static final Logger logger = LoggerFactory.getLogger(Waitron.class); + private final StreamBridge bridge; + private final ApplicationAvailability applicationAvailability; + private final Environment environment; + private final AsyncTaskExecutor taskExecutor; + + public Waitron(StreamBridge bridge, ApplicationAvailability applicationAvailability, Environment environment, AsyncTaskExecutor taskExecutor) { + this.bridge = bridge; + this.applicationAvailability = applicationAvailability; + this.environment = environment; + this.taskExecutor = taskExecutor; + } + + @Bean(name = Events.PAYMENT) + public Consumer acceptPayment() { + return (String payment) -> { + logger.info("acceptPayment:{}", payment); + }; + } + + @EventListener + public void onEvent(AvailabilityChangeEvent event) { + logger.info("onEvent:{}", event.getState()); + logger.info("availability:{}:{}", applicationAvailability.getLivenessState(), applicationAvailability.getReadinessState()); + if (!environment.acceptsProfiles(Profiles.of("test"))) { + if (LivenessState.CORRECT.equals(applicationAvailability.getLivenessState())) { + taskExecutor.submit((Callable) () -> { + logger.info("onEvent:wait"); + Thread.sleep(30000L); + logger.info("onEvent:send:atWork:waitron"); + return bridge.send(Events.AT_WORK, MessageBuilder.withPayload("waitron").build()); + }); + } + } else { + logger.info("onEvent:skip:test"); + } + } + + @Bean(name = Events.FOOD) + public Consumer collectFood() { + return (String food) -> { + logger.info("collectFood:send:delivery:{}", food); + bridge.send(Events.DELIVERY, MessageBuilder.withPayload(food).build()); + }; + } + + @Bean(name = Events.HOT_DRINKS) + public Consumer collectHotDrinks() { + return (String hotDrinks) -> { + logger.info("collectHotDrinks:send:delivery:{}", hotDrinks); + bridge.send(Events.DELIVERY, MessageBuilder.withPayload(hotDrinks).build()); + }; + } + + @Bean(name = Events.COLD_DRINKS) + public Consumer collectColdDrinks() { + return (String coldDrinks) -> { + logger.info("collectColdDrinks:send:delivery:{}", coldDrinks); + bridge.send(Events.DELIVERY, MessageBuilder.withPayload(coldDrinks).build()); + }; + } + + @Bean(name = Events.ORDER) + public Consumer acceptOrders() { + return (String order) -> { + logger.info("acceptOrder:send:orders:{}", order); + bridge.send(Events.ORDERS, MessageBuilder.withPayload(order).build()); + }; + } + + public interface Events { + String ORDERS = "orders"; + String ORDER = "order"; + String FOOD = "food"; + String COLD_DRINKS = "coldDrinks"; + String HOT_DRINKS = "hotDrinks"; + String PAYMENT = "payment"; + + String AT_WORK = "at_work"; + String DELIVERY = "delivery"; + } +} diff --git a/restaurant-stream-apps-3/scdf-app-waitron/src/main/resources/application.properties b/restaurant-stream-apps-3/scdf-app-waitron/src/main/resources/application.properties new file mode 100644 index 0000000..de44d09 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/src/main/resources/application.properties @@ -0,0 +1,14 @@ +spring.application.name=waitron + +logging.level.root=info +logging.level.io.spring=debug +logging.level.org.springframework.cloud=debug +logging.level.com.rabbitmq.client=debug +logging.level.io.fabric8=debug + +spring.cloud.deployer.kubernetes.startupProbeScheme=TCP +spring.cloud.deployer.kubernetes.startupTcpProbeDelay=30 +spring.cloud.deployer.kubernetes.startupTcpProbePeriod=5 +spring.cloud.deployer.kubernetes.startupTcpProbePort=${server.port} +spring.cloud.deployer.kubernetes.livenessHttpProbeDelay=1 +spring.cloud.deployer.kubernetes.readinessHttpProbeDelay=1 \ No newline at end of file diff --git a/restaurant-stream-apps-3/scdf-app-waitron/src/test/java/io/spring/scdf/waitron/ScdfAppWaitronApplicationTests.java b/restaurant-stream-apps-3/scdf-app-waitron/src/test/java/io/spring/scdf/waitron/ScdfAppWaitronApplicationTests.java new file mode 100644 index 0000000..be45188 --- /dev/null +++ b/restaurant-stream-apps-3/scdf-app-waitron/src/test/java/io/spring/scdf/waitron/ScdfAppWaitronApplicationTests.java @@ -0,0 +1,15 @@ +package io.spring.scdf.waitron; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +@SpringBootTest +@ActiveProfiles(profiles = "test") +class ScdfAppWaitronApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/restaurant-stream-apps/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties b/restaurant-stream-apps/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/restaurant-stream-apps/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties +++ b/restaurant-stream-apps/scdf-app-customer/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/restaurant-stream-apps/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties b/restaurant-stream-apps/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/restaurant-stream-apps/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties +++ b/restaurant-stream-apps/scdf-app-kitchen/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/restaurant-stream-apps/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties b/restaurant-stream-apps/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/restaurant-stream-apps/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties +++ b/restaurant-stream-apps/scdf-app-waitron/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/scenario-task/.mvn/wrapper/maven-wrapper.properties b/scenario-task/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/scenario-task/.mvn/wrapper/maven-wrapper.properties +++ b/scenario-task/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/security-ldap-uaa-example/.mvn/wrapper/maven-wrapper.properties b/security-ldap-uaa-example/.mvn/wrapper/maven-wrapper.properties index 6c8c0e0..f77b5d1 100644 --- a/security-ldap-uaa-example/.mvn/wrapper/maven-wrapper.properties +++ b/security-ldap-uaa-example/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/spring-cloud-stream-function-bindings/log-sink/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-stream-function-bindings/log-sink/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/spring-cloud-stream-function-bindings/log-sink/.mvn/wrapper/maven-wrapper.properties +++ b/spring-cloud-stream-function-bindings/log-sink/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/spring-cloud-stream-function-bindings/time-source/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-stream-function-bindings/time-source/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/spring-cloud-stream-function-bindings/time-source/.mvn/wrapper/maven-wrapper.properties +++ b/spring-cloud-stream-function-bindings/time-source/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/timestamp-batch-2.0.x/.mvn/wrapper/maven-wrapper.properties b/timestamp-batch-2.0.x/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/timestamp-batch-2.0.x/.mvn/wrapper/maven-wrapper.properties +++ b/timestamp-batch-2.0.x/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/timestamp-batch-3.0.x/.mvn/wrapper/maven-wrapper.properties b/timestamp-batch-3.0.x/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/timestamp-batch-3.0.x/.mvn/wrapper/maven-wrapper.properties +++ b/timestamp-batch-3.0.x/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/timestamp-batch-3.0.x/pom.xml b/timestamp-batch-3.0.x/pom.xml index 9e7612c..9ad9786 100644 --- a/timestamp-batch-3.0.x/pom.xml +++ b/timestamp-batch-3.0.x/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.6 + 3.2.3 io.spring @@ -16,7 +16,7 @@ 17 - 2022.0.4 + 2022.0.5 diff --git a/timestamp-task-2.0.x/.mvn/wrapper/maven-wrapper.properties b/timestamp-task-2.0.x/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/timestamp-task-2.0.x/.mvn/wrapper/maven-wrapper.properties +++ b/timestamp-task-2.0.x/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/timestamp-task-3.0.x/.mvn/wrapper/maven-wrapper.properties b/timestamp-task-3.0.x/.mvn/wrapper/maven-wrapper.properties index 642d572..f77b5d1 100644 --- a/timestamp-task-3.0.x/.mvn/wrapper/maven-wrapper.properties +++ b/timestamp-task-3.0.x/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file diff --git a/transition-sample/.mvn/wrapper/maven-wrapper.properties b/transition-sample/.mvn/wrapper/maven-wrapper.properties index cd0d451..f77b5d1 100644 --- a/transition-sample/.mvn/wrapper/maven-wrapper.properties +++ b/transition-sample/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.zip \ No newline at end of file