Skip to content

Getting started with QBit Microservices Lib Batteries Included

Richard Hightower edited this page Aug 28, 2015 · 22 revisions

If you are new to QBit. It might make more sense to skim the overview. We suggest reading the landing page of the QBit Microservices Lib's wiki for a background on QBit. This will let you see the forrest while the tutorials are inspecting the trees. There is also a lot of documents linked to off of the wiki landing page as well as in the footer section of the tutorials.

In progress...

Getting started with QBit Microservices Lib Batteries Included Part 2

Home <<Part 1, Part 2, Part 3 > -- -example code- -qbit docs-

Mammatus Tech

This is part two in this tutorial series. Part 1

QBit is small and wicked fast, but it comes batteries included.

QBit comes with Service Discovery, Health, Monitoring, Realtime service stats, Async, Reactive Async call management, Job Control, Event Bus, built-in. QBit is very similar to the Typed Actor model but streamlined for Microservices and using idiomatic Java constructs.

Already, even the simple Hello World example has runtime stats support, health monitoring that can be integrated with service discovery, and more.

To expose end points to some of these services, we merely have to create an admin end point as follows:

Turning on the admin end point

    public static void main(final String... args) {
        final ManagedServiceBuilder managedServiceBuilder =
                ManagedServiceBuilder.managedServiceBuilder().setRootURI("/root");

        /* Start the service. */
        managedServiceBuilder.addEndpointService(new HelloWorldService())
                .getEndpointServerBuilder()
                .build().startServer();

        /* Start the admin builder which exposes health end-points and meta data. */
        managedServiceBuilder.getAdminBuilder().build().startServer();

        System.out.println("Servers started");


    }

We just turn on the admin.

Turning on Admin Support

        /* Start the admin builder which exposes health end-points and meta data. */
        managedServiceBuilder.getAdminBuilder().build().startServer();

Show service stats and metrics

$ curl http://localhost:8080/__stats/instance 

To see health for this service:

$ curl http://localhost:8080/__health

Returns "ok" if all registered health systems are healthy.

Or if same port endpoint health is disabled then:

See health over admin back-end port.

$ curl http://localhost:7777/__admin/ok

Returns "true" if all registered health systems are healthy.

A node is a service, service bundle, queue, or server endpoint that is being monitored. List all service nodes or endpoints.

Access the service:

$ curl http://localhost:8080/root/hello/hello

To see swagger file for this service:

$ curl http://localhost:7777/__admin/meta/

Show all nodes

$ curl http://localhost:7777/__admin/all-nodes/

List healthy nodes by name:

$ curl http://localhost:7777/__admin/healthy-nodes/

List complete node information:

$ curl http://localhost:7777/__admin/load-nodes/