All Projects → imqueue → rpc

imqueue / rpc

Licence: ISC license
RPC-like client-service implementation over messaging queue

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to rpc

cli
Command Line Interface for @imqueue
Stars: ✭ 20 (-23.08%)
Mutual labels:  rpc, message-queue, rpc-client, rpc-service, redis-queue, rpc-over-message-queue
Hprose Php
Hprose is a cross-language RPC. This project is Hprose 3.0 for PHP
Stars: ✭ 1,952 (+7407.69%)
Mutual labels:  rpc, rpc-client, rpc-service
Autocser
AutoCSer is a high-performance RPC framework. AutoCSer 是一个以高效率为目标向导的整体开发框架。主要包括 TCP 接口服务框架、TCP 函数服务框架、远程表达式链组件、前后端一体 WEB 视图框架、ORM 内存索引缓存框架、日志流内存数据库缓存组件、消息队列组件、二进制 / JSON / XML 数据序列化 等一系列无缝集成的高性能组件。
Stars: ✭ 140 (+438.46%)
Mutual labels:  rpc, message-queue
Hprose Html5
Hprose is a cross-language RPC. This project is Hprose 2.0 Client for HTML5
Stars: ✭ 237 (+811.54%)
Mutual labels:  rpc, rpc-client
impress-cli
Impress Application Server Command line interface
Stars: ✭ 25 (-3.85%)
Mutual labels:  service, rpc
Hprose Objc
Hprose is a cross-language RPC. This project is Hprose 2.0 Client for Objective-C
Stars: ✭ 130 (+400%)
Mutual labels:  rpc, rpc-client
Hprose Js
Hprose is a cross-language RPC. This project is Hprose 2.0 RPC for JavaScript
Stars: ✭ 133 (+411.54%)
Mutual labels:  rpc, rpc-client
server-framework
纯C的分布式服务器框架通用模板,跨平台,模块动态加载,tcp/可靠UDP,协程RPC,日志,集群建立
Stars: ✭ 24 (-7.69%)
Mutual labels:  service, rpc
Hprose Golang
Hprose is a cross-language RPC. This project is Hprose for Golang.
Stars: ✭ 1,143 (+4296.15%)
Mutual labels:  rpc, rpc-client
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-7.69%)
Mutual labels:  service, rpc
Redeo
High-performance framework for building redis-protocol compatible TCP servers/services
Stars: ✭ 392 (+1407.69%)
Mutual labels:  service, rpc
X
新生命X组件,数据中间件XCode、日志、网络、RPC、序列化、缓存、Windows服务
Stars: ✭ 1,322 (+4984.62%)
Mutual labels:  service, rpc
Hprose Delphi
Hprose is a cross-language RPC. This project is Hprose 2.0 for Delphi and FreePascal
Stars: ✭ 100 (+284.62%)
Mutual labels:  rpc, rpc-client
Multirpc
A Discord rich presence manager app with a cool GUI and support for custom status and multiple profiles
Stars: ✭ 94 (+261.54%)
Mutual labels:  rpc, rpc-client
Rpcx Java
rpcx implementation in Java for server side and client side
Stars: ✭ 71 (+173.08%)
Mutual labels:  rpc, rpc-client
Advanced Java
😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识
Stars: ✭ 59,142 (+227369.23%)
Mutual labels:  rpc, message-queue
Joynr
A transport protocol agnostic (MQTT, HTTP, WebSockets etc.) Franca IDL based communication framework supporting multiple communication paradigms (RPC, Pub-Sub, broadcast etc.)
Stars: ✭ 124 (+376.92%)
Mutual labels:  communication, rpc
Hprose Java
Hprose is a cross-language RPC. This project is Hprose 2.0 for Java
Stars: ✭ 542 (+1984.62%)
Mutual labels:  rpc, rpc-client
Kubemq
KubeMQ is Enterprise-grade message broker native for Docker and Kubernetes
Stars: ✭ 58 (+123.08%)
Mutual labels:  rpc, message-queue
yurpc
high-performance RPC framework.
Stars: ✭ 59 (+126.92%)
Mutual labels:  service, rpc

I Message Queue RPC (@imqueue/rpc)

Build Status codebeat badge Coverage Status Known Vulnerabilities License

RPC-like client-service implementation over messaging queue. This module provides base set of abstract classes and decorators to build services and clients for them.

Why?

To provide fast and reliable way of communication between backend services.

IMQ-RPC provides a simple and reliable solution, using which developer can focus exactly on business logic implementation and be assured the services inter-communication is handled properly, performs fast and is scalable enough to handle any load.

Installation

npm i --save @imqueue/rpc

Usage

For next examples it is expected redis server is running on localhost:6379.

1. Building Service

When building service doc-blocks for exposed service methods are mandatory. First of all it guarantees good level of documentation. From other hand it provides better types information for building service clients and complex types usages.

File service.ts:

import { IMQService, expose } from '@imqueue/rpc';

class Hello extends IMQService {

    /**
     * Says hello using given name
     *
     * @param {string} [name] - name to use withing hello message
     * @returns {string} - hello string
     */
    @expose()
    public hello(name?: string): string {
        return `Hello, ${name}!`;
    }

}

(async () => {
    const service = new Hello();
    await service.start();
})();

2. Building Client

There are 3 ways of building service clients:

  1. Writing/updating clients manually. In this case you will be fully responsible for maintaining clients code but will have an ability to extend client code as you wish.
  2. Generating/updating clients automatically using IMQClient.create() at runtime. This will give an ability do not care about the need to keep client code up-to-date with the service changes. Each time client started it will re-generate its interface and will reflect all changes made on service side. BTW, this method has disadvantages in code development and maintenance (especially from TypeScript usage perspective) which are directly related to dynamic module creation, compilation and loading. There will be problems using service complex types interfaces in TypeScript. From perspective of JavaScript usage it is OK.
  3. Generating/updating pre-compiled clients automatically using IMQClient.create() This will require additional actions on client side to update its codebase each time the service changed its interfaces. BTW it gives an advantage of full support of all typing features on TypeScript side and provides automated way to manage clients up-to-date state.

File: client.ts (manually written client example):

import { IMQClient, IMQDelay, remote } from '@imqueue/rpc';

class HelloClient extends IMQClient {

    /**
     * Says hello using given name
     *
     * @param {string} name
     * @returns {Promise<string>}
     */
    @remote()
    public async hello(name?: string, delay?: IMQDelay): Promise<string> {
        return await this.remoteCall<string>(...arguments);
    }

}

(async () => {
    try {
        const client = new HelloClient();
        await client.start();

        // client is now ready for use

        console.log(await client.hello('IMQ'));
    }

    catch (err) {
        console.error(err);
    }
})();

Using dynamically built clients (for the same service described above):

import { IMQClient } from '@imqueue/rpc';

(async () => {
    try {
        const hello: any = await IMQClient.create('Hello');
        const client = new hello.HelloClient();

        await client.start();

        console.log(await client.hello('IMQ'));

        await client.destroy();
    }

    catch (err) {
        console.error(err);
    }
})();

In this case above, IMQClient.create() will automatically generate client code, compiles it to JS, loads and returns compiled module. As far as it happens at runtime there is no possibility to refer type information properly, but there is no need to take care if the client up-to-date with the service code base. Each time client created it will be re-generated.

BTW, IMQClient.create() supports a source code generation without a module loading as well:

import { IMQClient } from '@imqueue/rpc';

(async () => {
    await IMQClient.create('Hello', {
        path: './clients',
        compile: false
    });
})();

In this case client code will be generated and written to a corresponding file ./clients/Hello.ts under specified path. Then it can be compiled and imported within your project build process, and referred in your code as expected:

import { hello } from './clients/Hello';

(async () => {
    const client = new hello.HelloClient();
    await client.start();
    console.log(client.hello('IMQ'));
})();

In this case all complex types defined within service implementation will be available under imported namespace of the client.

Notes

For image containers builds assign machine UUID in /etc/machine-id and /var/lib/dbus/machine-id respectively. UUID should be assigned once on a first build then re-used each new build to make it work consistently.

License

ISC

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].