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

alchemy-ether

v1.0.4

Published

Alchemy-Ether is a Node.js implementation of the Alchemy Micro-service framework

Downloads

2

Readme

Alchemy Ether

npm version Build Status License

Alchemy Micro-services Framework

The Alchemy Micro-services Framework is a framework for creating many small interconnected services that communicate over the RabbitMQ message brokering service. Building services with Alchemy has many benefits, like:

  • High Availability: being able to run multiple services across many different machines, communicating to a High Availability RabbitMQ Cluster.
  • Smart Load Balancing: running multiple instances of the same service, will distribute messages to services based on the service capacity and not via a simple round robin approach.
  • Service Discovery Using RabbitMQ's routing of messages means services can communicate without knowing where they are located.
  • Deployment you can stop a service, then start a new service without missing any messages because they are buffered on RabbitMQ. Alternatively, you can run multiple versions of the same service concurrently to do rolling deploys.
  • Error Recovery If a service unexpectedly dies while processing a message, the message can be reprocessed by another service.
  • Polyglot Architecture: Each service can be implemented in the language that best suites its domain.

How Alchemy Services Work

An Alchemy service communicates by registering two queues, a service queue (shared amongst all instances of a service) and a response queue (unique to that service instance). For the purpose of clarity I will note a service with letters e.g. A, B and service instances with numbers, e.g. A1 is service A instance 1.

A service sends a message to another service by putting a message on its service queue (this message includes the response queue of the sender). An instance of that service will consume and process the message then respond to the received response queue. For example, if service A1 wanted to message service B:


|----------|                                                  |------------|
| RabbitMQ | <-- 1. Send message on queue B   --------------- | Service A1 |
|          |                                                  |            |
|          | --- 2. Consume Message from B  -> |------------| |            |
|          |                                   | Service B1 | |            |
|          | <-- 3. Respond on queue A1     -- |------------| |            |
|          |                                                  |            |
|----------| --- 4. Receive response on A1  ----------------> |------------|

Alchemy tries to reuse another common communication protocol, HTTP, for status codes, message formatting, headers and more. This way the basis of the messaging protocol is much simpler to explain and implement.

Passing messages between services this way means that service A1 can send messages to B without knowing which instance of B will process the message. If service B1 becomes overloaded we can see the queue build up messages, and then start a new instance of service B, which, with zero configuration changes, immediately start processing messages.

If the instance of B dies while processing a message, RabbitMQ will put the message back on the queue which can then be processed by another instance. This happens without the calling service knowing and so this makes the system much more resilient to errors. However, this also means that messages may be processed more than once, so implementing idempotent micro-services is very important.

Alchemy-Ether

Alchemy-Ether is the Node.js implementation of the Alchemy Framework. Node.js is a great environment for Alchemy as its event driven architecture reflects the Alchemy style of communication.

Ether is implemented using the Promises A+ specification from the bluebird package and implemented in CoffeeScript.

Getting Started

To install Alchemy-Ether:

npm install alchemy-ether

To create instances of two services, A and B, and have instance A1 call service B:

Service = require('alchemy-ether')

serviceA1 = new Service("A") # Create service instance A1

serviceB1 = new Service("B", {
  service_fn: (message) ->
    # How service B will process the message
    { body: "Hello #{message.body}" }
})

serviceA1.start().then( -> serviceB1.start()) # Start the Services
.then( ->
  # Service A1 sending message to B
  serviceA1.send_request_to_service('B', {body: 'Alice'})
)
.then( (response) ->
  console.log(response.body) # "Hello Alice"
)
.finally( ->
  serviceA1.stop().then( -> serviceB1.stop())
)

Documentation

This Alchemy-Ether documentation is generated with docco from its annotated source code.

The Alchemy-Ether package exports Service:

module.exports = require('./service')

Examples

Contributors

  • Graham Jenson
  • Tom Cully
  • Wayne Hoover
  • Rory Stephenson