bellboy-live-reporter
v0.1.0
Published
Send bellboy events as requests to the specified server endpoint.
Downloads
5
Readme
bellboy-live-reporter
Send bellboy events as requests to the specified server endpoint.
- Requests never fail because of timeout.
- If server can't be reached, request retries to send an event until success.
These features and the fact that bellboy job always waits code inside event listener to complete allow job to be executed gradually:
- Reporter sends information about event to the server.
- Server accepts it, but doesn't response to a request - job is paused.
- After some time or because of user interaction server decides to send a response.
- Reporter receives response, continues job till the next event and repeats all the steps again.
Installation
npm install bellboy-live-reporter
Usage
const bellboy = require('bellboy');
const LiveReporter = require('bellboy-live-reporter');
(async () => {
const processor = new bellboy.DynamicProcessor({
generator: async function* () {
for (let i = 0; i < 100; i++) {
yield { hello: `world_${i}` }
}
},
});
const destination = new bellboy.StdoutDestination();
const job = new bellboy.Job(processor, [destination], {
reporters: [
new LiveReporter(),
],
});
await job.run();
})();
Options
| option | type | description |
|--------|--------|------------------------------------------------------------------------------------------------------|
| url | string | Endpoint URL where requests will be sent. If not specified, http://localhost:3041
address is used. |
Building
You can build js
source by using npm run build
command.
Testing
Tests can be run by using npm test
command.