All Projects → umuplus → beems

umuplus / beems

Licence: MIT license
a bee-queue based minimalist toolkit for building fast, decentralized, scalable and fault tolerant microservices

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to beems

Cloudi
A Cloud at the lowest level!
Stars: ✭ 352 (+966.67%)
Mutual labels:  scalability, concurrency, soa
queueable
Convert streams to async ⌛ iterables ➰
Stars: ✭ 43 (+30.3%)
Mutual labels:  queue, concurrency
public
util toolkit for go.golang 通用函数包
Stars: ✭ 135 (+309.09%)
Mutual labels:  queue, toolkit
Saea
SAEA.Socket is a high-performance IOCP framework TCP based on dotnet standard 2.0; Src contains its application test scenarios, such as websocket,rpc, redis driver, MVC WebAPI, lightweight message server, ultra large file transmission, etc. SAEA.Socket是一个高性能IOCP框架的 TCP,基于dotnet standard 2.0;Src中含有其应用测试场景,例如websocket、rpc、redis驱动、MVC WebAPI、轻量级消息服务器、超大文件传输等
Stars: ✭ 318 (+863.64%)
Mutual labels:  queue, rpc
Thespian
Python Actor concurrency library
Stars: ✭ 220 (+566.67%)
Mutual labels:  scalability, concurrency
think-async
🌿 Exploring cooperative concurrency primitives in Python
Stars: ✭ 178 (+439.39%)
Mutual labels:  queue, concurrency
Spscqueue
A bounded single-producer single-consumer wait-free and lock-free queue written in C++11
Stars: ✭ 307 (+830.3%)
Mutual labels:  queue, concurrency
Unagi Chan
A haskell library implementing fast and scalable concurrent queues for x86, with a Chan-like API
Stars: ✭ 115 (+248.48%)
Mutual labels:  queue, concurrency
Kubemq
KubeMQ is Enterprise-grade message broker native for Docker and Kubernetes
Stars: ✭ 58 (+75.76%)
Mutual labels:  queue, rpc
Arq
Fast job queuing and RPC in python with asyncio and redis.
Stars: ✭ 695 (+2006.06%)
Mutual labels:  queue, concurrency
Orleans
Orleans is a cross-platform framework for building distributed applications with .NET
Stars: ✭ 8,131 (+24539.39%)
Mutual labels:  scalability, concurrency
concurrent-ll
concurrent linked list implementation
Stars: ✭ 66 (+100%)
Mutual labels:  scalability, concurrency
Zato
ESB, SOA, REST, APIs and Cloud Integrations in Python
Stars: ✭ 889 (+2593.94%)
Mutual labels:  scalability, soa
easy-promise-queue
An easy JavaScript Promise queue which is automatically executed, concurrency controlled and suspendable.
Stars: ✭ 31 (-6.06%)
Mutual labels:  queue, concurrency
System design
Preparation links and resources for system design questions
Stars: ✭ 7,170 (+21627.27%)
Mutual labels:  scalability, concurrency
psched
Priority-based Task Scheduling for Modern C++
Stars: ✭ 59 (+78.79%)
Mutual labels:  queue, concurrency
Rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 532 (+1512.12%)
Mutual labels:  concurrency, rpc
ring-election
A node js library with a distributed leader/follower algorithm ready to be used
Stars: ✭ 92 (+178.79%)
Mutual labels:  scalability, concurrency
Mpmcqueue
A bounded multi-producer multi-consumer concurrent queue written in C++11
Stars: ✭ 468 (+1318.18%)
Mutual labels:  queue, concurrency
Goconcurrentqueue
Go concurrent-safe, goroutine-safe, thread-safe queue
Stars: ✭ 127 (+284.85%)
Mutual labels:  queue, concurrency

beems (formerly dot-bee)

a bee-queue based minimalist toolkit for building fast, decentralized, scalable and fault tolerant microservices

Install

npm i --save beems

You can also clone this repository and make use of it yourself.

git clone https://github.com/umuplus/beems.git
cd beems
npm i
npm test

Before running tests, please make sure that you have Redis available on localhost. If you don't know how to do that temporarily, please use following command to run it via docker.

docker run -p 6379:6379 --name beems_redis redis:4-alpine

Configuration

  • bee: options for initializing a bee queue instance. please see more details at Bee Queue Settings.
  • job: options for creating a bee queue job. only setId, retries, backoff, delayUntil and timeout methods allowed. please see more details at Bee Queue Job Settings.
  • on: event handlers for server. please see more details at Queue Local Events
  • pino: options for pino logger. it's { "level": "error" } by default.

Server Methods

  • .addServices(services, concurrency = cpus().length, options): adds list of services and automatically creates their queues and consumers
  • .addService(service, concurrency = cpus().length, options): adds a new service and automatically creates related queue and its consumer
  • .close(): stops all existing queues for a clean shutdown
  • .destroy(): removes everything about existing queues from redis

Client Methods

  • .acceptServices(services, options): accepts existing services to send jobs
  • .acceptService(service, options): accepts an existing service to send jobs
  • .forward(service, method, data, options): sends a new job to an existing service and returns a Job instance
  • .health(service): returns number of jobs for each state
  • .job(service, id): returns an existing Job by id
  • .send(service, method, data, options): sends a new job to an existing service and retrieves its response
  • .close(): stops all existing queues for a clean shutdown

Examples

const { Client, Service, Server } = require('beems');
const { cpus } = require('os');

class TestService extends Service {
    async echo(job) {
        return job.data;
    }
}

const client = new Client();
const server = new Server({
    on: { failed: (j, e) => server.logger.error(j.id, e.message) }
});
server.addServices([ new TestService('test') ], cpus().length);
client.acceptServices([ 'test' ]);

try {
    const data = { t: Date.now() };
    const { job, response } = await client.send('test', 'echo', data);
    console.log(job.id, response);
} catch({ job, error: e }) {
    console(job.id, e.message);
}

await client.close();
await server.destroy();
await server.close();

Optional Job Configuration

please see more details at Bee Queue Job Settings.

await client.send('test', 'echo', { t: Date.now() }, {
    setId: 'my-custom-job-id',
    retries: 2,
    backoff: [ 'fixed', 1000 ],
    delayUntil: Date.parse('2082-08-23T00:00:01.000Z'),
    timeout: 10000
});

TODO

  • Add some useful logs
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].