Quick Start QBIt programming - the microservice lib for Java
QBit is a micro service framework. Let's create a simple QBit example. We will create a TODO example with QBit and gradle. Later examples will show how to do this with maven and QBit.
QBit is very fast. The programming model seems easy, there is some powerful things going on underneath the covers. QBit enables development of async services and in-memory services. We will cover more details in future tutorials. This tutorial is to break the ice.
The example we create will be available via REST/JSON. We will make it a standalone application using Gradle. The example will be CURLable. You can access it from the command line utility called curl.
Notice the use of RequestMapping, it works in much the same way as the Spring MVC REST annotations. It provides a subset of what Spring MVC provides.
The add method gets called when someone POSTs to the URI /todo.
To run this service, you need to start it up. You do this with a ServiceServer. Starting up a ServiceServer is easier than you might think. A service bundle can specify different threading models so that all services in the bundle run in the same thread or run in different threads.
QBit uses apartment model threading for Services. It uses a very efficient queuing mechanism to limit the amount of handoff between the IO threads and the service threads.
ServiceServerBuilder allows you to setup properties like PORT and NIC interface that you are binding your service to. It also has tweak-able settings for performance, which will make more sense to cover in and advanced tutorial.
Services are available over REST and WebSocket.
To run this service, you need gradle.
Gradle commands you might care about:
The above generates an idea project. There is also a gradle plugin for Eclipse.
Since we are using gradle we can easily distribute a zip file (or tar file) with all of the jar files we need to execute our service.
This concludes our first getting started tutorial. QBit is very fast. But although the programming model seems easy, there is some powerful things going on underneath the covers. QBit enables development of async services and in-memory services. We will cover more in future tutorials. Stay tuned.
Learn more about the goals of QBit and what we are trying to enable with this: