Skip to content

LianjiaTech/kbms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ke-bear-microservice(kbms)

Introduction 中文说明

KBMS is a C++11 high performance network framework based on libevent. It is light and easy to deploy. At present, it mainly supports HTTP protocol.

Features

  1. Non-blocking pure asynchronous multithreaded HTTP server
  2. Light and concise
  3. Simple function, focus on Network
  4. Simple and easy to deploy

Origin

In the process of practice, the service enabling group of our AI center mainly provides external functions in the form of micro services, so we need a convenient and concise network framework. In the process of investigating open source projects, we did not find a suitable library to meet our requirements. According to our own business situation, the ideal C + + network framework should meet the following characteristics:

  1. Due to the historical tradition of the group, the best is C++
  2. Multi thread, high performance network server
  3. Handy and easy to deploy
  4. Can access to spring-cloud-netflix

Getting Started

Please see Quick Start

Examples

An echo HTTP server

#include "http_server.h"

int main(int argc, char* argv[]) {

    uint32_t port = 12138;
    uint32_t thread_num = 5;

    if(!kbms::HttpServer::Instance()->Init(port,thread_num)){
        std::cerr<<"initalize global resource failed."<<std::endl;
        return 0;
    }
    kbms::HttpServer::Instance()->RegisterDefaultFun(&DefaultHandler);
    kbms::HttpServer::Instance()->RegisterFun("/echo",[](const kbms::HttpContextPtr& ctx,const kbms::HTTPSendResponseCallback& cb)
                                                                { cb(ctx->BodyByString()); });
    kbms::HttpServer::Instance()->StartServer();
    while (true) {
        usleep(1);
    }

    return 0;
}

More examples

Please see the source code in examples.

Thanks

  1. Thanks for libevent, glog, gtest, jsoncppcurlwrk projects
  2. [kbms] is highly inspired by thrift and evpp,Thanks evpp and thrift

About

一个轻量级c++网络框架

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •