This is a quick tech demo how write a simple batch factory:
- Spring Boot,
- Spring Data Rest,
- Spring Data JPA,
- Spring Batch,
- Spring Integration,
- Undertow,
- Docker,
- Microservices.
Clone the git repository using the URL on the github home page:
$ git clone https://github.com/cneftali/simple-batch-factory.git
$ cd simple-batch-factory
$ mvn clean install
-
Maven compile the Spring Boot Docker Project
$ mvn clean install
-
Build Images
$ docker-compose build
-
Start all the containers
$ docker-compose up -d
-
Logs
$ docker-compose logs
-
Stopping All Services
$ docker-compose stop
-
Get list of Jobs
$ curl http://localhost/jobs { "_links" : { "self" : { "href" : "http://localhost/jobs{?page,size,sort}", "templated" : true } }, "page" : { "size" : 20, "totalElements" : 0, "totalPages" : 0, "number" : 0 }
-
launch job 'jobName' in future :
$ curl -i -X POST -H "Content-Type:application/json" -d '{ "jobName":"jobName", "jobParameter": {"id":1, "param1": "value"}, "dateStart":"2050-07-10T14:49:04.206Z"}' http://localhost/jobs HTTP/1.1 201 Created Server: Apache-Coyote/1.1 Location: http://localhost/jobs/1 Content-Length: 0 Date: Thu, 20 Aug 2015 13:08:45 GMT $ curl -i http://localhost/jobs/1 { "jobName" : "jobName", "jobParameter" : { "id" : 1, "param1" : "value" }, "dateStart" : :2541077344206, "jobStatus" : "WAITING", "_links" : { "self" : { "href" : "http://localhost/jobs/1" } } }
-
launch job 'jobName' now :
$ curl -i -X POST -H "Content-Type:application/json" -d '{ "jobName":"jobName", "jobParameter": {"id":1, "param1": "value"}, "dateStart":"2015-07-10T14:49:04.206Z"}' http://localhost/jobs HTTP/1.1 201 Created Server: Apache-Coyote/1.1 Location: http://localhost/jobs/1 Content-Length: 0 Date: Thu, 20 Aug 2015 13:08:45 GMT $ curl -i http://localhost/jobs/1 HTTP/1.1 404 Not Found Connection: keep-alive Content-Length: 0 Date: Wed, 26 Aug 2015 14:51:27 GMT
-
send directly in engine (docker host engine-servicex1.cne):
$ curl -i -X POST -H "Content-Type:application/json" -d '{"jobName":"jobName","jobParameters":{"parameters":{"id":{"identifying":true,"value":"1","type":"STRING"},"param1":{"identifying":true,"value":"value","type":"STRING"}}},"scheduleId":1,"createTime":1440599326140}' http://localhost:8080/process HTTP/1.1 201 Created Connection: keep-alive Transfer-Encoding: chunked Content-Type: application/json;charset=UTF-8 Date: Wed, 26 Aug 2015 14:55:46 GMT