diff --git a/docs/src/main/asciidoc/batch-starter.adoc b/docs/src/main/asciidoc/batch-starter.adoc index b4d5bf54..11bacd20 100644 --- a/docs/src/main/asciidoc/batch-starter.adoc +++ b/docs/src/main/asciidoc/batch-starter.adoc @@ -365,6 +365,32 @@ itself by setting the following properties: See the https://docs.spring.io/spring-batch/docs/4.3.x/api/org/springframework/batch/item/kafka/KafkaItemReader.html[`KafkaItemReader` documentation]. +[[nativeCompilation]] +=== Native Compilation +The advantage of Single Step Batch Processing is that it lets you dynamically select which reader and writer beans to use at runtime when you use the JVM. +However, when you use native compilation, you must determine the reader and writer at build time instead of runtime. +The following example does so: + +[source,xml] + + org.springframework.boot + spring-boot-maven-plugin + + + process-aot + + process-aot + + + + -Dspring.batch.job.flatfileitemreader.name=fooReader + -Dspring.batch.job.flatfileitemwriter.name=fooWriter + + + + + + [[item-processors]] == ItemProcessor Configuration diff --git a/docs/src/main/asciidoc/features.adoc b/docs/src/main/asciidoc/features.adoc index 0c298cda..ce058aef 100644 --- a/docs/src/main/asciidoc/features.adoc +++ b/docs/src/main/asciidoc/features.adoc @@ -373,9 +373,8 @@ NOTE: The exit code for the application will be 1 if the task fails because this is enabled and another task is running with the same task name. ==== Single Instance Usage for Spring AOT And Native Compilation -To utilize Spring Cloud Task's single instance feature when creating a natively compiled app, the feature needs to enabled at build time. -This is done by adding the `process-aot` execution and setting the `spring.cloud.task.single-step-instance-enabled=true` as a JVM argument as shown below: - +To use Spring Cloud Task's single-instance feature when creating a natively compiled app, you need to enable the feature at build time. +To do so, add the process-aot execution and set `spring.cloud.task.single-step-instance-enabled=true` as a JVM argument, as follows: [source,xml] org.springframework.boot diff --git a/spring-cloud-task-samples/batch-events/README.adoc b/spring-cloud-task-samples/batch-events/README.adoc index 12f5e351..e6510f79 100644 --- a/spring-cloud-task-samples/batch-events/README.adoc +++ b/spring-cloud-task-samples/batch-events/README.adoc @@ -18,22 +18,22 @@ Note: More information on this topic is available https://docs.spring.io/spring- == Build: -[source,shell,indent=2] +[source,shell] ---- -$ ./mvnw clean install +./mvnw clean install ---- == Execution: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/batch-events-3.0.0.jar +java -jar target/batch-events-3.0.0.jar ---- -For example you can listen for specific job execution events on a specified channel with a Spring Cloud Stream Sink +For example, you can listen for specific job-execution events on a specified channel with a Spring Cloud Stream Sink like the https://github.com/spring-cloud/stream-applications/tree/main/applications/sink/log-sink[log sink] using the following: -[source,shell,indent=2] +[source,shell] ---- $ java -jar /log-sink-rabbit-3.1.1.jar --server.port=9090 --spring.cloud.stream.bindings.input.destination=job-execution-events diff --git a/spring-cloud-task-samples/batch-job/README.adoc b/spring-cloud-task-samples/batch-job/README.adoc index 0a0f9350..8ba2182e 100644 --- a/spring-cloud-task-samples/batch-job/README.adoc +++ b/spring-cloud-task-samples/batch-job/README.adoc @@ -13,14 +13,28 @@ This is a Spring Cloud Task application that executes two simple Spring Batch Jo == Build: -[source,shell,indent=2] +[source,shell] ---- -$ mvn clean package +mvn clean package ---- == Run: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/batch-job-3.0.0.jar +java -jar target/batch-job-3.0.0.jar +---- + +== Native Build: + +[source,shell] +---- +mvn -Pnative clean package +---- + +== Native Run: + +[source,shell] +---- +./target/batch-job ---- diff --git a/spring-cloud-task-samples/jpa-sample/README.adoc b/spring-cloud-task-samples/jpa-sample/README.adoc index 493496dd..91d39cc2 100644 --- a/spring-cloud-task-samples/jpa-sample/README.adoc +++ b/spring-cloud-task-samples/jpa-sample/README.adoc @@ -15,14 +15,28 @@ a data store. == Build: -[source,shell,indent=2] +[source,shell] ---- -$ mvn clean package +mvn clean package ---- == Run: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/jpa-sample-3.0.0.jar +java -jar target/jpa-sample-3.0.0.jar +---- + +== Native Build: + +[source,shell] +---- +mvn -Pnative clean package +---- + +== Native Run: + +[source,shell] +---- +./target/jpa-sample ---- diff --git a/spring-cloud-task-samples/multiple-datasources/README.adoc b/spring-cloud-task-samples/multiple-datasources/README.adoc index 986735ef..5174ade5 100644 --- a/spring-cloud-task-samples/multiple-datasources/README.adoc +++ b/spring-cloud-task-samples/multiple-datasources/README.adoc @@ -18,16 +18,30 @@ which one to be used for the Spring Cloud Task repository. == Build: -[source,shell,indent=2] +[source,shell] ---- -$ mvn clean package +mvn clean package ---- == Execute sample using 2 embedded databases (default): -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/multiple-datasources-3.0.0.jar +java -jar target/multiple-datasources-3.0.0.jar +---- + +== Native Build: + +[source,shell] +---- +mvn -Pnative clean package +---- + +== RUn sample using 2 embedded databases (default) with native app: + +[source,shell] +---- +./target/multiple-datasources ---- == Execute sample using 2 external databases: diff --git a/spring-cloud-task-samples/partitioned-batch-job/README.adoc b/spring-cloud-task-samples/partitioned-batch-job/README.adoc index 1bd47fdf..09660bd0 100644 --- a/spring-cloud-task-samples/partitioned-batch-job/README.adoc +++ b/spring-cloud-task-samples/partitioned-batch-job/README.adoc @@ -9,14 +9,14 @@ An example of the usage of the `DeployerPartitionHandler` and == Build: -[source,shell,indent=2] +[source,shell] ---- -$ ./mvnw clean install +./mvnw clean install ---- == Execute: -[source,shell,indent=2] +[source,shell] ---- export SPRING_APPLICATION_JSON='{"spring.datasource.url":"jdbc:mariadb://localhost:3306/","spring.datasource.password":"","spring.datasource.username":"","spring.datasource.driverClassName":"org.mariadb.jdbc.Driver"}' java -jar target/partitioned-batch-job-3.0.0.jar diff --git a/spring-cloud-task-samples/single-step-batch-job/README.adoc b/spring-cloud-task-samples/single-step-batch-job/README.adoc index 5286024d..077a711b 100644 --- a/spring-cloud-task-samples/single-step-batch-job/README.adoc +++ b/spring-cloud-task-samples/single-step-batch-job/README.adoc @@ -23,16 +23,16 @@ The profiles that are available are: == Build: -[source,shell,indent=2] +[source,shell] ---- -$ mvn clean package +mvn clean package ---- == Run: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/single-step-batch-job-3.0.0-SNAPSHOT.jar --spring.config.name= +java -jar target/single-step-batch-job-3.0.0-SNAPSHOT.jar --spring.config.name= ---- == Examples diff --git a/spring-cloud-task-samples/task-events/README.adoc b/spring-cloud-task-samples/task-events/README.adoc index 8c31c879..9d95b539 100644 --- a/spring-cloud-task-samples/task-events/README.adoc +++ b/spring-cloud-task-samples/task-events/README.adoc @@ -8,24 +8,24 @@ This is a task application that emits events on a channel named `task-events` == Build: -[source,shell,indent=2] +[source,shell] ---- -$ ./mvnw clean install +./mvnw clean install ---- == Execution: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/task-events-3.0.0.RELEASE.jar +java -jar target/task-events-3.0.0.RELEASE.jar ---- You can listen for the events on the task-events channel with a Spring Cloud Stream Sink like the https://github.com/spring-cloud/stream-applications/tree/main/applications/sink/log-sink[log sink] using the following: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar /log-sink-rabbit-3.1.1.jar --server.port=9090 --spring.cloud.stream.bindings.input.destination=task-events +java -jar /log-sink-rabbit-3.1.1.jar --server.port=9090 --spring.cloud.stream.bindings.input.destination=task-events ---- == Dependencies: diff --git a/spring-cloud-task-samples/task-observations/README.adoc b/spring-cloud-task-samples/task-observations/README.adoc index 99d6cddb..2420a45f 100644 --- a/spring-cloud-task-samples/task-observations/README.adoc +++ b/spring-cloud-task-samples/task-observations/README.adoc @@ -9,18 +9,32 @@ metrics at the end of the application using the SimpleMeterRegistry. == Classes: -* TaskMetricsApplication - the Spring Boot Main Application +* TaskObservationsApplication - the Spring Boot Main Application == Build: -[source,shell,indent=2] +[source,shell] ---- -$ mvn clean package +mvn clean package ---- == Run: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/task-metrics-3.0.0-SNAPSHOT.jar +java -jar target/task-observations-3.0.0.jar +---- + +== Native Build: + +[source,shell] +---- +mvn -Pnative clean package +---- + +== Native Run: + +[source,shell] +---- +./target/task-observations ---- diff --git a/spring-cloud-task-samples/taskprocessor/README.adoc b/spring-cloud-task-samples/taskprocessor/README.adoc index f2941fea..13bbfba9 100644 --- a/spring-cloud-task-samples/taskprocessor/README.adoc +++ b/spring-cloud-task-samples/taskprocessor/README.adoc @@ -11,9 +11,9 @@ specified. NOTE: if using defaults make sure to install the timestamp-task into your local maven repo by executing the following build in the timestamp-task module: -[source,shell,indent=2] +[source,shell] ---- -$ ./mvnw clean install +./mvnw clean install ---- == The arguments offered by the TaskProcessor are as follows: @@ -32,9 +32,9 @@ $ ./mvnw clean install == Build: -[source,shell,indent=2] +[source,shell] ---- -$ ./mvnw clean install +./mvnw clean install ---- == Dependencies: diff --git a/spring-cloud-task-samples/tasksink/README.adoc b/spring-cloud-task-samples/tasksink/README.adoc index 298dd77b..e73b2739 100644 --- a/spring-cloud-task-samples/tasksink/README.adoc +++ b/spring-cloud-task-samples/tasksink/README.adoc @@ -9,9 +9,9 @@ launch the task that was specified in the request. == Build: -[source,shell,indent=2] +[source,shell] ---- -$ ./mvnw clean install +./mvnw clean install ---- == Dependencies: diff --git a/spring-cloud-task-samples/timestamp/README.adoc b/spring-cloud-task-samples/timestamp/README.adoc index 200d396d..3338728a 100644 --- a/spring-cloud-task-samples/timestamp/README.adoc +++ b/spring-cloud-task-samples/timestamp/README.adoc @@ -13,14 +13,28 @@ This is a Spring Cloud Task application that logs a timestamp. == Build: -[source,shell,indent=2] +[source,shell] ---- -$ mvn clean package +mvn clean package ---- == Run: -[source,shell,indent=2] +[source,shell] ---- -$ java -jar target/timestamp-task-3.0.0.jar +java -jar target/timestamp-task-3.0.0.jar +---- + +== Native Build: + +[source,shell] +---- +mvn -Pnative clean package +---- + +== Native Run: + +[source,shell] +---- +./target/timestamp-task ----