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

0.2.0 • Public • Published

burrow-builder

A tool to enable code driven rabbitmq configuration generation.

Example

const c = new Cluster();

const cx = c.addExchange("my.cx", "x-consistent-hash");
for (let i = 1; i < 4; i++) {
    const q = c.addQueue(`my.q${i}`);
    cx.bindTo(q, {routing_key: "10"});
}

console.log(JSON.stringify(c.generateConfig(), undefined, 2));
Generated Data
{
  "queues": [
    {
      "name": "my.q0",
      "durable": true,
      "auto_delete": false,
      "vhost": "/",
      "arguments": {}
    },
    {
      "name": "my.q1",
      "durable": true,
      "auto_delete": false,
      "vhost": "/",
      "arguments": {}
    },
    {
      "name": "my.q2",
      "durable": true,
      "auto_delete": false,
      "vhost": "/",
      "arguments": {}
    }
  ],
  "exchanges": [
    {
      "name": "my.cx",
      "durable": true,
      "auto_delete": false,
      "vhost": "/",
      "arguments": {},
      "type": "x-consistent-hash",
      "internal": false
    }
  ],
  "bindings": [
    {
      "vhost": "/",
      "source": "my.cx",
      "destination": "my.q0",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "vhost": "/",
      "source": "my.cx",
      "destination": "my.q1",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "vhost": "/",
      "source": "my.cx",
      "destination": "my.q2",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    }
  ]
}

Package Sidebar

Install

npm i burrow-builder

Weekly Downloads

5

Version

0.2.0

License

MIT

Last publish

Collaborators

  • akshaykarthik