bellboy-live-reporter
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Build Status codecov npm

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:

  1. Reporter sends information about event to the server.
  2. Server accepts it, but doesn't response to a request - job is paused.
  3. After some time or because of user interaction server decides to send a response.
  4. 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.

Readme

Keywords

none

Package Sidebar

Install

npm i bellboy-live-reporter

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

8.3 kB

Total Files

9

Last publish

Collaborators

  • jansivans