cneftali / simple-batch-factory

This is a quick tech demo how write a simple batch factory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Batch Factory

Build Status Coverage Status License

This is a quick tech demo how write a simple batch factory:

Diagram

Requirements

  1. Maven 3.3.9
  2. JDK 1.8
  3. Lombok
  4. Docker Compose

Building from Source

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

Usage

  1. Maven compile the Spring Boot Docker Project

    $ mvn clean install
  2. Build Images

    $ docker-compose build
  3. Start all the containers

    $ docker-compose up -d
  4. Logs

    $ docker-compose logs
  5. Stopping All Services

    $ docker-compose stop

Try it !!

  1. 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
     
    }
  2. 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"
       }
     }
    }
  3. 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
  4. 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

About

This is a quick tech demo how write a simple batch factory


Languages

Language:Java 99.1%Language:Shell 0.9%