GithubHelp home page GithubHelp logo

archiej / coconspirators Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swimlane/coconspirators

0.0 1.0 0.0 213 KB

๐Ÿ“ž Microservice framework for RabbitMQ written in TypeScript

License: MIT License

TypeScript 100.00%

coconspirators's Introduction

coconspirators

Codacy Badge Codacy Badge Build Status npm version

coconspirators is a microservice framework for RabbitMQ written in TypeScript. Under the hood it uses amqp.node, the battle-tested AMQP client, to communicate with RabbitMQ and has best-practices baked in. Features include:

  • Simple API for subscribing, publish and replying
  • DI Friendly
  • TypeScript First

Install

npm i coconspirators --S

Building

npm run build

Usage

import { Queue, AmqpQueue, AmqpClient  } from 'coconspirators';

export class AmqpServer {
  connection: Promise<any>;
  constructor(public client: AmqpClient, logger: Logger) {
    this.connection = this.client.connect();

    client.on('connected', () => console.log('connected!'));
    client.on('disconnected', () => console.log('disconnected!'));
  }
}

interface ZooMessage {
  animal: string;
}

@Queue({
  name: 'health'
  contentType: 'application/json'
})
export class HealthQueue extends AmqpQueue<ZooMessage> {
  constructor(client: AmqpClient) { super(client); }
}

export class HealthChecker {
  constructor(queue: HealthQueue) {
    this.queue.publish({ hi: true });
    this.queue.subscribe((message: ZooMessage) => {
      console.log('message', message);
    })
  }
}

Credits

coconspirators is a Swimlane open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.

coconspirators's People

Contributors

amcdnl avatar beeman avatar nick-allen avatar shaunburdick avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.