GSoC 2016 | Work Period | Week 3
Jun 12, 2016
Objectives
In this week, I’m planning to do the following stuff:
- Core component of Vert.x Kue implementation complete
- Event system in Kue
KueWorker
Job
- Basic implementation of Vert.x Kue HTTP component
- REST API implementation
- A simple UI (Vert.x Kue UI)
- Refine the code of Vert.x Kue
- The
Job
class is messy and need refinement - More concise
- The
- Learn more about microservice (as well as Vert.x Microservice Toolbox)
- Write a brief introduction to new features of Vert.x 3.3.0 (in Chinese, will publish in Vert.x China Group)
PS: The Dragon Boat Festival holiday will be coming from Thursday to Saturday this week so I may not spend very much time on work during the holiday~ Have a great week :-)
Issues
Solved: Regex match in route path
In original Kue’s API, there is a route with path /jobs/:from..:to/:order?
. I tried this in Vert.x Web(/jobs/:from..:to
) but Vert.x Web cannot match it. So I used regex match \/jobs\/([0-9]*)\.\.([0-9]*)(\/[^\/]+)?
:
1 | public static final String KUE_API_JOB_RANGE = "\\/jobs\\/([0-9]*)\\.\\.([0-9]*)(\\/[^\\/]+)?"; |
But nothing matched, which made me confused. And path like /jobs/:from/to/:to
can be matched.
Solution: First use a supported pattern to catch string like 1..10
then use regex parse.
Achievement
Implementation of Vert.x Kue core
- Job processing interface
KueService
now provides two methods:process
method do asynchronous procedure(use common verticles), whileprocessBlocking
method could do blocking procedure(use worker verticles) - Add attempt support (could attempt when fails)
- TODO: need enhancement and test
- Add worker and job cardinality metrics support
- Add support for getting jobs with range(rank)
- Basic refinement of
Job
class - Refactored most of async methods to
Future
based style (in order to support monadic transform and say goodbye to callback hell) - Fix issue: Sometimes throw
java.lang.ClassCastException
caused by wrong time flow when processing a job - Fix issue: Generated json converter sometimes could not distinguish some properties(e.g.
id
andjobMetrics
) correctly
See here: sczyh30/vertx-blueprint-job-queue
Basic implementation of Vert.x Kue HTTP component
- Basic implementation of Vert.x Kue REST API(get job, create job, delete job, get job by range(or state), etc)
- Basic adaption between Vert.x Web and original Kue UI (rendered with
vertx-web-templ-jade
; still have some problems to solve)