1- = Single Step Batch JOb
1+ = Single Step Batch Job
22
33This is a Spring Cloud Task application that autoconfigures a single step Spring Batch job based on the profiles that are active.
44
@@ -8,6 +8,10 @@ The profiles that are available are:
88* `ffwriter` - Activates a FlatFileItemWriter that writes to the `result.txt` file.
99* `jdbcreader` - Activates a JdbcCursorItemReader that reads from the `item_sample` table.
1010* `jdbcwriter` - Activates a JdbcItemReader that writes to the `item` table.
11+ * `amqpreader` - Activates a AmqpItemReader that reads from the `samplequeue` queue.
12+ * `amqpwriter` - Activates a AmqpItemWriter that writes to the `sampleexchange` exchange.
13+ * `kafkareader` - Activates a KafkaItemReader that reads from the `sampletopic` topic.
14+ * `kafkawriter` - Activates a KafkaItemWriter that writes to the `sampletopic` topic.
1115
1216== Requirements:
1317
@@ -98,3 +102,41 @@ INSERT INTO item_sample (item_name) VALUES ('boo');
98102INSERT INTO item_sample (item_name) VALUES ('qux');
99103INSERT INTO item_sample (item_name) VALUES ('Job');
100104```
105+
106+ === FlatfileItemReader with AmqpItemWriter batch job
107+ In this example the batch job will read from the `test.txt` file and write the result to the `sampleexchange` exchange.
108+ ```
109+ java -Dspring.profiles.active=ffreader,amqpwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
110+ ```
111+
112+ NOTE: Before running create an exchange named `sampleexchange`.
113+
114+ === AmqpItemReader with FlatfileItemWriter batch job
115+ In this example the batch job will read from the `samplequeue` queue and write the result to the `result.txt` in the current directory.
116+ ```
117+ java -Dspring.profiles.active=amqpreader,ffwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
118+ ```
119+
120+ NOTE: Before running create and populate a queue named `samplequeue`.
121+
122+ === FlatfileItemReader with KafkaItemWriter batch job
123+ In this example the batch job will read from the `test.txt` file and write the result to the `sampletopic` topic.
124+ ```
125+ java -Dspring.profiles.active=ffreader,kafkawriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
126+ ```
127+
128+ Before running create a topic named `sampletopic`. For example:
129+ ```
130+ kafka-topics.sh --create --topic sampletopic --bootstrap-server localhost:9092
131+ ```
132+
133+ === KafkaItemReader with FlatfileItemWriter batch job
134+ In this example the batch job will read from the `sampletopic` topic and write the result to the `result.txt` in the current directory.
135+ ```
136+ java -Dspring.profiles.active=kafkareader,ffwriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
137+ ```
138+
139+ Before running populate the topic named `sampletopic`. For example populate it using the FlatfileItemReader and KafkaItemWriter from above:
140+ ```
141+ java -Dspring.profiles.active=ffreader,kafkawriter -jar target/single-step-batch-job-2.3.0-SNAPSHOT.jar
142+ ```
0 commit comments