https://github.com/grmvoid/node-dispatcher
https://github.com/grmvoid/node-dispatcher
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/grmvoid/node-dispatcher
- Owner: grmvoid
- License: mit
- Created: 2020-07-17T11:26:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-01T08:51:06.000Z (5 months ago)
- Last Synced: 2025-02-01T14:35:22.176Z (4 months ago)
- Language: JavaScript
- Size: 490 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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
Emit new requestregister (event: string, callback: (...args: any[]) => any) => void
Register new callbackasync start() => Promise
Start listen for new requests. Use this after register events.## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/macotsuu/dispatcher/tags).## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details