This is the summary of Google Summer Of Code 2016, Week One.

Objectives

In this week, I’m planning to do the following stuff:

  • Refine the code and document of Vert.x Blueprint - Todo Backend
  • Work on the Vert.x Blueprint - Kue (Basic Design)

Issues

How to use Vert.x Codegen with Gradle

We need to understand the essence of Vert.x Codegen - an APT(annotation processing tool), so we could write a task to do processing:

1
2
3
4
5
6
7
8
9
10
task annotationProcessing(type: JavaCompile, group: 'build') {
source = sourceSets.main.java
classpath = configurations.compile
destinationDir = project.file('src/main/generated')
options.compilerArgs = [
"-proc:only",
"-processor", "io.vertx.codegen.CodeGenProcessor",
"-AoutputDirectory=${project.projectDir}/src/main"
]
}

And in compileJava we reference the annotationProcessing task:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
compileJava {
targetCompatibility = 1.8
sourceCompatibility = 1.8

dependsOn annotationProcessing
}

sourceSets {
main {
java {
srcDirs += 'src/main/generated'
}
}
}

Then we could process the annotations with Gradle~

The Chinese version is here: 在 Gradle 中使用Annotation Processing Tool | Vert.x Codegen 示例

Achievement

Because there were many temporary experiments last week, I didn’t work during Friday to Sunday. Here are achievements of this week:

Finished the Vert.x Blueprint - Todo Backend project

Basic design of Vert.x Kue

In Kue(Node.js), we use kue.createQueue() to create a Kue instance and then use create(type, data) to create a job and then save the job to Redis. After that, we invoke job.process(type, callback) to process the job.

And in my design of Vert.x Kue, I designed a KueService that provide basic functions and wrapped a class Kue like Queue in Node.js version. I use Vert.x Service Proxy and register it to a KueVerticle. Our user could create a custom verticle(e.g. ExampleVerticle) and create and process jon via Kue class.

As for processing jobs, I’m planning to use Worker Verticles or just use executeBlocking method.

Learned something about Microservice

  • Microservice patterns(Quorum, Circuit Breaker Pattern, Compensating Transaction Pattern, etc.)
  • Usage and reactive thoughts of Netflix Hystrix