Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Use YAML in jobs descriptor #8

Closed
fmbenhassine opened this issue Jun 28, 2017 · 2 comments
Closed

Use YAML in jobs descriptor #8

fmbenhassine opened this issue Jun 28, 2017 · 2 comments

Comments

@fmbenhassine
Copy link
Member

YAML is easier for humans to write and less error prone than JSON.

The goal is to write job descriptors in YAML instead of JSON. For example:

---
id: 1
name: my first job
class: org.mycompany.jobs.MyFirstJob
method: doWork
---
id: 2
name: my second job
class: org.mycompany.jobs.MySecondJob
method: doWork
@fmbenhassine fmbenhassine added this to the 0.2 milestone Jun 28, 2017
fmbenhassine added a commit that referenced this issue Jun 28, 2017
Looks like jackson does not support deserializing multiple yaml documents: https://stackoverflow.com/questions/25222327/deserialize-pojos-from-multiple-yaml-documents-in-a-single-file-in-jackson

So we use snakeyaml directly (which is used behind the scene by jackson).

This commit uses default snakeyaml configuration. We may use a custom contructor "new Yaml(new Constructor(JobDefinition.class))" but due to 'clazz' attribute in JobDefinition, snakeyaml is unable to deserialize objects (class is reserved word and can't have java bean convention with getter/setter with string type..)

 We want to have 'class' attribute in the yaml file instead of 'clazz'. Another option is to use 'type' attribute in the yaml file (and in JobDefinition class) but 'class' is better
@fmbenhassine fmbenhassine changed the title Use YAML in job descriptor Use YAML in jobs descriptor Jun 28, 2017
@nabilov
Copy link

nabilov commented Jun 28, 2017

good job easy-jobs !

@fmbenhassine
Copy link
Member Author

@nabilov Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants