1.2.0 • Published 10 months ago

@stackbytes/dispatcher v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Dispatcher

A package for creating communication between microservices based on RabbitMQ.

Usage

(async () => {
    const rpc = await require('./src')('amqp://localhost')

    rpc.register('hello', user => `Hello ${user}`);
    rpc.start();

    rpc.call('hello', 'john).then(response => {
        console.log(response);
    });
})().catch(e => console.log(e))

Api reference

async call(handler: string, ...args: any[]) => Promise<any>

Emit new request

register (event: string, callback: (...args: any[]) => any) => void

Register new callback

async start() => Promise<void>

Start listen for new requests. Use this after register events.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Dominik Szamburski - Initial work - macotsuu

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

1.2.0

10 months ago

1.1.1

11 months ago

1.1.0

11 months ago