Add sample app to show MongoDB support

This commit is contained in:
Mahmoud Ben Hassine
2020-01-08 16:15:55 +01:00
parent fef02a6e30
commit 20061007c0
7 changed files with 273 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ jpa | | | |
multiRecordtype | | x | | | | | | | x | | | x
multiResource | x | | | | | | | x | | | | x
[XML Input Output](#xml-input-output) | | | x | | | | | | | x | |
[MongoDB sample](#mongodb-sample) | | | | | x | | | | x | | |
### Common Sample Source Structures
@@ -986,3 +987,19 @@ and import the ready-to-use dashboard in `spring-batch-samples/src/grafana/sprin
Finally, run the `org.springframework.batch.sample.metrics.BatchMetricsApplication`
class without any argument to start the sample.
# MongoDB sample
This sample is a showcase of MongoDB support in Spring Batch. It copies data from
an input collection to an output collection using `MongoItemReader` and `MongoItemWriter`.
To run the sample, you need to have a MongoDB server up and running on `localhost:27017`
(you can change these defaults in `mongodb-sample.properties`). If you use docker,
you can run the following command to start a MongoDB server:
```
$>docker run --name mongodb --rm -d -p 27017:27017 mongo
```
Once MongoDB is up and running, run the `org.springframework.batch.sample.mongodb.MongoDBSampleApp`
class without any argument to start the sample.