- Notifications
You must be signed in to change notification settings - Fork0
ai-republic/tobi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Tobi is a modular server framework which is Microprofile 3.0 compliant. You only plugin what you really need. Thus it is highly flexible and pluggability needs no extensive configuration.With Tobi you are not restricted to HTTP. It can serve any proprietary protocol.Currently modules exist for HTTP/S with plugins for REST, SSE and WebSocket and many features from the Microprofile orbit.
This modular server framework consists of the core server, modules, plugins and features.Modules, plugins and features can be enabled just by adding their dependency.Each module can have multiple plugins, e.g. the HTTP/S module can have one, multiple or all of JAX-RS plugin, SSE plugin and/or WebSocket plugin.Features can be used globally by all modules and plugins.
Currently only HTTP module is provided. Any other protocol can be implemented and integrated very easily (see IServerModule).There are 3 plugins that can be used with the HTTP module:
- JAX-RS plugin
- SSE plugin
- WebSocket plugin
Below is an overview of the features:
- CDI Open-Web-Beans integration 2.0.11
- CDI Weld integration 3.6.3
- Microprofile Config 1.3
- Microprofile Fault-tolerance 2.0
- Microprofile Health 2.0.1
- Microprofile JWT-Auth 1.1.1
- Microprofile Metrics 2.0.1
- Microprofile Open-API 1.1
- Microprofile Open Tracing 1.3.1
- Microprofile Restclient 1.2.0
To start using Tobi as a server you need to add the following dependency:
<dependency><groupId>com.ai-republic.tobi</groupId><artifactId>server-core</artifactId><version>1.0.0</version></dependency>
Then you can decide whether you like to use OpenWebBean (OWB) or WELD as your CDI container and add the appropriate dependency.
To use OpenWebBeans add the following dependency:
<dependency><groupId>com.ai-republic.tobi</groupId><artifactId>feature-cdi-owb</artifactId><version>1.0.0</version></dependency>
To use WELD add the following dependency:
<dependency><groupId>com.ai-republic.tobi</groupId><artifactId>feature-cdi-weld</artifactId><version>1.0.0</version></dependency>
To add a module like HTTP/S to you project you either just add the plugin(s) as which have the dependency of the module or add the module explicitly like:
<dependency><groupId>com.ai-republic.tobi</groupId><artifactId>module-http</artifactId><version>1.0.0</version></dependency>
To add JAX-RS (REST) support simply add the following dependency (this will also add the dependency tomodule-http
):
<dependency><groupId>com.ai-republic.tobi</groupId><artifactId>plugin-http-jaxrs</artifactId><version>1.0.0</version></dependency>
Now you just need to add yourjavax.ws.rs
annotated resources to your project.Similar you can use/combine other plugins such asplugin-http-sse
orplugin-http-websocket
.
Thefeature-logging-java
andfeature-mp-config
features are automatically added with thecore-server
.To add other features to use in your project just add the appropriate dependency like:
<dependency><groupId>com.ai-republic.tobi</groupId><artifactId>feature-mp-faulttolerance</artifactId><version>1.0.0</version></dependency>
Configuration can be done in 2 ways.Either you place amicroprofile-config.properties
file in your projects META-INF folder and configure the port parameters like this (recommended):
workerCount=5host=localhosthttp.port=8080http.ssl.port=8443http.keystore.file=~/keystore.jkshttp.keystore.password=changeithttp.truststore.file=~/cacerts.jkshttp.truststore.password=changeit
NOTE: All properties starting withhttp.
belong to the HTTP/S module .http.port
andhttp.ssl.port
are the ports under which the HTTP/S module will be servicing. In fact if you would like Tobi only to accept HTTPS you simply don't add thehttp.port
property. See also the documentation on the HttpModule.
Another way to configure these properties is to pass them as system properties on startup.
Then just call:
Tobi.start();
to start your Tobi server. It will automatically discover all your resources.
An example can be found under theexample project.