committed by
Michael Minella
parent
b71b46c333
commit
414cfc3e96
100
spring-cloud-task-samples/single-step-batch-job/README.adoc
Normal file
100
spring-cloud-task-samples/single-step-batch-job/README.adoc
Normal file
@@ -0,0 +1,100 @@
|
||||
= Timestamp Task
|
||||
|
||||
This is a Spring Cloud Task application that autoconfigures a single step Spring Batch job based on the profiles that are active.
|
||||
|
||||
The profiles that are available are:
|
||||
|
||||
* `ffreader` - Activates a FlatFileItemReader that reads from the `test.txt` file provided.
|
||||
* `ffwriter` - Activates a FlatFileItemWriter that writes to the `result.txt` file.
|
||||
* `jdbcreader` - Activates a JdbcCursorItemReader that reads from the `item_sample` table.
|
||||
* `jdbcwriter` - Activates a JdbcItemReader that writes to the `item` table.
|
||||
|
||||
== Requirements:
|
||||
|
||||
* Java 8 or Above
|
||||
|
||||
== Classes:
|
||||
|
||||
* SingleStepBatchJobApplication - the Spring Boot Main Application
|
||||
|
||||
== Build:
|
||||
|
||||
[source,shell,indent=2]
|
||||
----
|
||||
$ mvn clean package
|
||||
----
|
||||
|
||||
== Run:
|
||||
|
||||
[source,shell,indent=2]
|
||||
----
|
||||
$ java -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar --spring.config.name=<property file containing batch, reader, and writer properties>
|
||||
----
|
||||
|
||||
== Examples
|
||||
|
||||
=== FlatFileItemReader with a FlatFileItemWriter batch job
|
||||
In this example the batch job will read from the test.txt file from the resources directory and write a `result.txt` file to the root directory of the project.
|
||||
```
|
||||
java -Dspring.profiles.active=ffreader,ffwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
=== FlatFileItemReader with a JdbcItemWriter batch job
|
||||
In this example the batch job will read from the test.txt file from the resources directory and write the result to the `item` table in your data store.
|
||||
```
|
||||
java -Dspring.profiles.active=ffreader,jdbcwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
Before running create the following table:
|
||||
```
|
||||
CREATE TABLE IF NOT EXISTS item
|
||||
(
|
||||
item_name varchar(55)
|
||||
);
|
||||
```
|
||||
|
||||
=== JdbcCursorItemReader with a JdbcItemWriter batch job
|
||||
In this example the batch job will read from the `item_sample` table in your data store and write the result to the `item` table in your data store.
|
||||
```
|
||||
java -Dspring.profiles.active=jdbcreader,jdbcwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
Before running create the following tables:
|
||||
```
|
||||
CREATE TABLE IF NOT EXISTS item
|
||||
(
|
||||
item_name varchar(55)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS item_sample
|
||||
(
|
||||
ITEM_NAME varchar(55)
|
||||
);
|
||||
|
||||
INSERT INTO item_sample (item_name) VALUES ('foo');
|
||||
INSERT INTO item_sample (item_name) VALUES ('bar');
|
||||
INSERT INTO item_sample (item_name) VALUES ('baz');
|
||||
INSERT INTO item_sample (item_name) VALUES ('boo');
|
||||
INSERT INTO item_sample (item_name) VALUES ('qux');
|
||||
INSERT INTO item_sample (item_name) VALUES ('Job');
|
||||
```
|
||||
|
||||
=== JdbcCursorItemReader with FlatfileItemWriter batch job
|
||||
In this example the batch job will read from the `item_sample` table in your data store and write the result to the `result.txt` file to the root directory of the project.
|
||||
```
|
||||
java -Dspring.profiles.active=jdbcreader,ffwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
Before running create the following table:
|
||||
```
|
||||
CREATE TABLE IF NOT EXISTS item_sample
|
||||
(
|
||||
ITEM_NAME varchar(55)
|
||||
);
|
||||
|
||||
INSERT INTO item_sample (item_name) VALUES ('foo');
|
||||
INSERT INTO item_sample (item_name) VALUES ('bar');
|
||||
INSERT INTO item_sample (item_name) VALUES ('baz');
|
||||
INSERT INTO item_sample (item_name) VALUES ('boo');
|
||||
INSERT INTO item_sample (item_name) VALUES ('qux');
|
||||
INSERT INTO item_sample (item_name) VALUES ('Job');
|
||||
```
|
||||
Reference in New Issue
Block a user