1.0.5 • Published 1 month ago

tmqp-client v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

tmqp-client

An open source npm package of a client to make connections to TurtleMQ server for Node.js.

Features

Turtle Message Queue Protocol (TMQP) is based on TCP (Transimssion Control Protocol) which is a communication protocol of the transport level in OSI tower.

  • Supports produce messages

  • Supprots consume messages

  • Supports delete queue

  • Supports cluster mode

Quick Start

Install

  npm install tmqp-client

Basic Usage

Producer

const Tmqp = require('tmqp-client');

(async () => {
  const tmqp = new Tmqp({ host: 'localhost', port: 5566 });
  const queue = 'my-queue';
  await tmqp.produce(queue, 'message')
})();

The default queue size is 1000. You can pass the configuration to the command.

await tmqp.produce(queue, 'message', { maxLength: 2000 })

Consumer

const Tmqp = require('tmqp-client');

(async () => {
  const tmqp = new Tmqp({ host: 'localhost', port: 5566 });
  const queue = 'my-queue'
  const messages = await tmqp.consume(queue, 1);
  console.log(messages);
})();

Delete queue

await tmqp.delete('my-queue');

Cluster

Create connection to Turtle Finder to get the TurtleMQ master server configuration.

// Connect to the Turtle Finder server
const tmqp = new Tmqp({ host: 'localhost', port: 25566, cluster: true });

Contact

Thank you for using tmqp-client :-)

c.kelvin.wu@gmail.com

1.0.5

1 month ago

1.0.2

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago