-
Notifications
You must be signed in to change notification settings - Fork 11
Getting started with QBit Microservice Lib
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.
Home < Part 1 Part 2 > Part 3 >> -- -example code- -qbit docs-
QBit is a reactive programming lib for building microservices - JSON, HTTP, WebSocket, and REST. QBit uses reactive programming to build elastic REST, and WebSockets based cloud friendly, web services. QBit is SOA evolved for mobile and cloud computing. QBit is a small lightweight lib that provides support for ServiceDiscovery, Health, reactive StatService, typed events, and Java idiomatic reactive programming for Microservices.
QBit is small and wicked fast.
If you are new to QBit, we suggest reading the landing page of the QBit Microservices Lib's wiki for a background on QBit.
Learn gradle.
group 'qbit-ex'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "com.mammatustech.HelloWorldService"
compileJava {
sourceCompatibility = 1.8
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile group: 'io.advantageous.qbit', name: 'qbit-admin',
version: '0.9.0-M1'
compile group: 'io.advantageous.qbit', name: 'qbit-vertx',
version: '0.9.0-M1'
}
Look for the latest official release here of the QBit Microservice lib.
package com.mammatustech;
import io.advantageous.qbit.admin.ManagedServiceBuilder;
import io.advantageous.qbit.annotation.RequestMapping;
@RequestMapping("/hello")
public class HelloWorldService {
@RequestMapping("/hello")
public String hello() {
return "hello " + System.currentTimeMillis();
}
public static void main(final String... args) {
final ManagedServiceBuilder managedServiceBuilder =
ManagedServiceBuilder.managedServiceBuilder()
.setRootURI("/root");
/* Start the service. */
managedServiceBuilder.addEndpointService(new HelloWorldService())
.getEndpointServerBuilder()
.build().startServer();
}
}
Run the app.
$ gradle run
$ curl http://localhost:8080/root/hello/hello
"hello 1440742489358"
$ wrk -d 5s -t 2 -c 1000 http://localhost:8080/root/hello/hello
Running 5s test @ http://localhost:8080/root/hello/hello
2 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 17.65ms 22.96ms 427.36ms 97.57%
Req/Sec 33.33k 7.75k 43.10k 75.00%
319154 requests in 5.06s, 28.00MB read
Requests/sec: 63083.97
Transfer/sec: 5.53MB
Read more:
- QBit Microservice Hello World tutorial
- QBit Microservice Hello World Part 2
- QBit Microservice Hello World Health Checks
- QBit Microservice Hello World Stats, Metrics, and Monitoring
- QBit Microservice Reactive programming tutorial
QBit is the Java microservice lib. QBit is a reactive programming lib for building microservices and focuses on JSON, HTTP, WebSocket, and REST. QBit uses reactive programming to build elastic REST, and WebSockets based cloud friendly, web services. SOA evolved for mobile and cloud. ServiceDiscovery, Health, reactive StatService, events, Java idiomatic reactive programming for Microservices.
Reactive Programming, Java Microservices, Rick Hightower
Java Microservices Architecture
[Microservice Service Discovery with Consul] (http://www.mammatustech.com/Microservice-Service-Discovery-with-Consul)
Microservices Service Discovery Tutorial with Consul
[Reactive Microservices] (http://www.mammatustech.com/reactive-microservices)
[High Speed Microservices] (http://www.mammatustech.com/high-speed-microservices)