Hybrid server is a special project that is designed as a host server for services built on top
of light-hybrid-4j framework. Every service is built as a small jar file with only the business
logic handlers inside and multiple jar files can be put into a docker volume to be loaded by a
hybrid server instance running in docker container. In this way, the developers has nothing to
do with the server at all they just need to focus on their domain business logic. Also as all
these services are deployed in the same JVM, the communication between them are faster although
it is still through HTTPS channel. This is our serverless solution.
This generator only generate the server platform that can host many other serivices. It doesn’t
have any model for input.
Here is an example of config.json for light-hybrid-4j server generator.
name is used in generated pom.xml for project name
version is used in generated pom.xml for project vesion
groupId is used in generated pom.xml for project groupId
artifactId is used in generated pom.xml for project artifactId
rootPackage is the root package name for your project and it will normally be your domain plug project name.
handlerPackage is the Java package for all generated handlers.
modelPackage is the Java package for all generated models or POJOs.
httpPort is the http port number the server is listening to if it is enabled.
enableHttp is the flag to control if http is enabled or not.
httpsPort is the https port number the server is listening to if it is enabled.
enableHttps is the flag to control if https is enabled or not.
supportDb to control if db connection pool will be setup in service.yml and db dependencies are included in pom.xml
dbInfo section is the database connection pool configuration info.
supportH2ForTest is a flag to control if H2 code is included in the test server and H2 jar is included in pom.mxl
supportClient is a flag to control if client module is included in the generated project to call other services.
Java Command line
Before using the command line to generate the code, you need to check out the repo and build it.
I am using ~/networknt as workspace but it can be anywhere in your home directory.
git clone https://github.com/networknt/light-codegen.git
mvn clean install
The generator scaffolds a server platform which can host a number of light-hybrid-4j services.
The generated project is just a skeleton without any service. You have to generate one or more
services (by using the light-hybrid-4j service generator) and put these jar file(s) into the
classpath and start this server.