Hexagon is a microservices framework that doesn't follow the flock. It is written in Kotlin and uses RabbitMQ and MongoDB. It takes care of:
- HTTP routing and HTML templates.
- Serialization and storage of domain classes.
- Asynchronous communication through events.
- Task scheduling using Cron expressions.
The purpose of the project is to provide a microservices framework with the following priorities (in order):
- Simple to use
- Easily hackable
- Be small
Performance is not the primary goal, but it is taken seriously. You can check performance numbers in the TechEmpower Web Framework Benchmarks
DISCLAIMER: The project status is beta. Use it at your own risk. This is the coverage grid:
For detailed information about how to create a service, please refer to the Service Life Cycle documentation.
You can create a service from a Lazybones template. To do so type:
lazybones create hexagon-service service
Or you can write a Gradle project from scratch (Gradle 3 is required):
build.gradle
:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.1.2-2'
}
apply plugin: "kotlin"
apply plugin: "application"
mainClassName = 'HelloKt'
repositories {
jcenter ()
}
dependencies {
compile ("co.there4.hexagon:server_jetty:0.14.0")
}
src/main/kotlin/Hello.kt
:
import co.there4.hexagon.server.*
import co.there4.hexagon.server.jetty.*
fun main(vararg args: String) {
serve(JettyServletEngine()) {
get("/hello/{name}") { "Hello ${request["name"]}!" }
}
}
Now you can run the service with gradle run
and view the results at:
http://localhost:2010/hello/world
- Service Life Cycle: provide helpers to create, build and package your services.
- HTTP: Web routing and filters. It is handled like the Sinatra Ruby framework.
- Serialization: helper methods to serialize/deserialize
data classes
using different formats. - Storage: utilities to persist Kotlin objects into MongoDB collections.
- Events: support asynchronous communication with events through the RabbitMQ message broker.
- Configuration: allow the configuration of the engine by using YAML files.
- Scheduling: supports the execution of tasks periodically using Cron expressions.
- Templates: allow the service to render results using Pebble or kotlinx.html.
- Testing: Hexagon adds utilities to ease the testing of its services.
Refer to the contributing.md file for detailed information about Hexagon's development.
The project is licensed under the MIT License.