Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
Martín Rubio edited this page Jun 28, 2017 · 2 revisions

Iris Service

The Iris service is called after the Greek personification of the rainbow, as a representation a bridge between mortals and gods and a way of communication between them.

Purpose

Iris will provides operations to ask and receive information without the need of knowing who is providing it. For that Iris would be using an exchange queue in RabitMQ full of requests identified by a pattern. Iris then will check witch of the services could response to that request to do it and send back an answer to the origin.

Abstraction of Iris

Iris arq

Usage

Steps:

  • Setup Iris: Provide to iris the basic information for it to work by using the setup(options: LibOptions).

export interface LibOptions {url:string; exchange: string;}
url: Path to RabbitMQ.
exchange: Name of the exchange queue.

It would return the functions {act, add}

  • Add a service as provider using add(pattern: string, implementation: (msg: Buffer) => Promise<Buffer>, opts: AddOptions = {}):
    pattern: Pattern to which this service will response.
    implementation: Logic to manage the message to return a proper response.
    opts: {queue_namespace?: string;}

It will return Promise<void>.

  • Get responses from services using act(pattern: string, opts: ActOptions = {}):
    pattern: Pattern to which this service will response.
    opts: {sync?:boolean, timeout?: number, multi?: boolean}

It will return the proper implementation to get the response needed((payload: Buffer) => Promise<Buffer>)

Installation

Internals and Architecture

Clone this wiki locally