cocona-net
A basic microservices module based on Cherry and cote.
Features:
- Scopes
- IDs
- Groups
- Versions
- Update triggers
- Encrypted data transfer
Installation:
To install the module:
yarn add node-cocona-net
Cherry is required to use cocona-net. You can get started with a new Cherry project by using Cherry-CLI.
Configuration:
await cherryawait cherryawait cherry
Documentation:
- async createResponder
let module = await cherrylet result = await module
Creates a new cote responder with given name, id and group. Only responder/requester with the same id and group can communicate with each other (Defaults to service id). Can ignore versions in the network (Only scope and group used). Returns true if successful.
- async onResponder
let module = await cherrylet result = await module Example:let result = await module
Creates a new cote responder event handler with given name and event type. Func gets called on every event with data and callback to send result back. Returns true if successful.
- async createRequester
let module = await cherrylet result = await module
Creates a new cote requester with given name, id and group. Only responder/requester with the same id and group can communicate with each other (Defaults to service id). Can ignore versions in the network (Only scope and group used). Returns true if successful.
- async sendRequest
let module = await cherrylet result = await module Example:let result = await module
Sends a new cote request with given name, event type, timeout in milliseconds and data. Callback gets called with result. Returns true if successful.
- async createPublisher
let module = await cherrylet result = await module
Creates a new cote publisher with given name, id and group. Only publisher/subscriber with the same id and group can communicate with each other (Defaults to service id). Can ignore versions in the network (Only scope and group used). Returns true if successful.
- async sendBroadcast
let module = await cherrylet result = await module Example:let result = await module
Sends a new broadcast via cote publisher with given name, event type and data. Returns true if successful.
- async createSubscriber
let module = await cherrylet result = await module
Creates a new cote subscriber with given name, id and group. Only publisher/subscriber with the same id and group can communicate with each other (Defaults to service id). Can ignore versions in the network (Only scope and group used). Returns true if successful.
- async onBroadcast
let module = await cherrylet result = await module Example:let result = await module
Creates a broadcast event handler via cote subsriver with given name and event type. Func gets called on every event with data. Returns true if successful.
- async onUpdateEvent
let module = await cherrylet result = await module Example:let result = await module
Creates an update event handler (Using service id; cocona-net updates are global). Func gets called on every update event. Returns true if successful.
- async onIdle
let module = await cherrylet result = await module Example:let result = await module
Creates an idle event handler. Func gets called anytime the application is idle (No requests being processed). Returns true if successful.
Contribution:
To run tests (incomplete):
yarn test
To start a test environment:
yarn start