npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

goodly

v0.4.1

Published

Microservice framework

Downloads

17

Readme

goodly

Build Status Coverage Status

Goodly is an unopininated microservice communication framework. It manages the low-level queing so you can focus on the important stuff: handling events.

Goodly has several design goals:

  1. Create a simple programming interface for event-based microservices.
  2. Support scale-out of individual services -> add more instances of the service and work will automatically be distributed between the instances.
  3. Support addition of new services -> add as many services as you need.
  4. Supports large-event transmission between services -> send data through the broker, http, tcp, udp, protocol buffers, etc.

Goodly doesn't tell you the best way to structure you app, it gives you a set of tools and lets you build on-top of RabbitMQ. Goodly manages the AMQP exchange creation, queue creation, and messaging routing creation. It does all this to provide a simple interface for building your application that will automatically scale.

Made for coding

How easy it is to use? Create a service in a few lines of code...

import goodly from 'goodly';

const service = goodly({ name: 'documents' });

// start the service
service.start({ brokerPath: 'ampq://192.168.99.100' });

// listen for an event and do something
service.on('document.uploaded', async ({ data, emit }) => {
  // do something with the data
  let document = await saveDocumentAsync(data);
  // emit another event
  emit('document.available', document);
});

With the above code, you could start a single instance or 1000 instances. The work will be distributed between your instances automatically.

API

Service Methods

  • Promise start({ brokerPath, concurrent)

    Starts the service and if necessary creates all exchange and queues owned by the service. Once start is complete, the service will immeidately begin pulling work from the service queue.

    Parameters:

    • string brokerPath - host of RabbitMQ
    • int concurrent - the number of open messages that will be concurrent consumed
  • Promise stop()

    stops the service and disconnects from RabbitMQ

  • Promise emit(path, data, options)

    Emits a message with the specified path and data. Emit does not expect a response and is equivalent to pub/sub actions.

    Paramters:

    • string path - name of the event to send
    • any data - the data that will be send that could be a buffer, string, int, float, bool, array, object, or error
  • Promise request(path, data)

    Makes a request with the specified path and data. Request will block until a response is received.

    Paramters:

    • string path - name of the event to send
    • any data - the data that will be send that could be a buffer, string, int, float, bool, array, object, or error
  • Promise on(path, fn1, fn2, ...)

    Adds a handler to the service for supplied path. The supplied functions will be executed in order of attachment.

    Parameters:

    • string path - name of the event to listen for
    • fn handler - a handler for the event

Handler

Handlers are called with an Event object. The Event object contains several methods and pieces of data:

Properties:

  • any data - the data that will be send that could be a buffer, string, int, float, bool, array, object, or error
  • correlationId - the UUID mapping to a unique origin event
  • msg - the raw RabbitMQ message

Methods:

  • emit - calls the emit method on the service but uses the supplied correlationId for the incoming event
  • reply - replys to a message that is a Request/Response message