coconspirators
TypeScript icon, indicating that this package has built-in type declarations

6.0.3 • Public • Published

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.

Package Sidebar

Install

npm i coconspirators

Weekly Downloads

13

Version

6.0.3

License

MIT

Unpacked Size

78.9 kB

Total Files

17

Last publish

Collaborators

  • ajaypalswimlane
  • adityagonnade
  • ashraygupta
  • prasanthsaiboyina
  • abhiswimlane0410
  • varsha_swimlane
  • kodalipraveen
  • mohanalakshmi.s
  • nikshithkolan
  • steveblue
  • kasiviswanathan.mangudi
  • koushik.kumar
  • dmytro_skorokhodov
  • sasha.polishchuk
  • dabbott-sl
  • daniel.selig
  • jogaj_26
  • markcoleman1
  • caleb.bass
  • hansstoetzer
  • sarath.pantula
  • nikkuman
  • agustin.firpo
  • tmcclure
  • ischultz-swimlane
  • bensteele7
  • brantw
  • marjan-georgiev
  • danstory
  • seangrimes
  • adamfrank
  • bageldawg
  • it.admin.swim
  • smartinski
  • lisa-reynolds
  • royar95
  • mr_charlie
  • swimlane.dev