8000 GitHub - justajavaboy/jobs: Neutron, CWDS Elasticsearch batch jobs
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

justajavaboy/jobs

 
 

Repository files navigation

CWDS Jobs

The CWDS Jobs project provides java based stand alone applications which are meant to be scheduled periodically.

Installation

Prerequisites

Prerequisites are job dependent but typically you can expect the following to be needed :

  1. DB2 10.x
  2. Postgres 9.x
  3. Elasticsearch 5.3.2 or newer (newer would require testing)

Development Environment

Prerequisites

  1. Source code, available at GitHub
  2. Java SE 8 development kit
  3. DB2 Database
  4. Postgres Database
  5. Elasticsearch

Building

% ./gradlew build

Facility Indexer Job

Main Class: gov.ca.cwds.jobs.FacilityIndexerJob run job using following command:

$java -cp jobs.jar gov.ca.cwds.jobs.FacilityIndexerJob path/to/config/file.yaml

Code overview

In order to create new job you have to implement 2 interfaces: JobReader, JobWriter and optional JobProcessor JobReader has a single method I read() which is responsible for reading items from input source. It must return null when everything is read. JobWriter has a single method write(List<I> items) which is responsible for writing chunk of data to output target. JobProcessor has a single method O process(I item), you can implement it if some mapping logic is required Then you should provide those components to a job. Google guice example config:

@Provides
@Named("job")
@Inject
public Job job(@Named("reader") JobReader reader,
               @Named("writer") JobWriter writer) {
        return new AsyncReadWriteJob(reader, writer);
}

//or with processor

@Provides
@Named("job")
@Inject
public Job job(@Named("reader") JobReader reader,
               @Named("processor") JobProcessor processor,
               @Named("writer") JobWriter writer) {
        return new AsyncReadWriteJob(reader, processor, writer);
}

Read and write operation runs in separate threads.

About

Neutron, CWDS Elasticsearch batch jobs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 87.7%
  • SQLPL 7.5%
  • HTML 4.8%
0