0.4.4 • Published 5 years ago

kubets v0.4.4

Weekly downloads
66
License
MIT
Repository
github
Last release
5 years ago

KubeTS - A typesafe wrapper for KubeMQ.

Downloads Version

License

A KubeMQ Library for Typescript enables Typescript developers to communicate with KubeMQ server in a type-safe way!.

Prerequisites

KubeMQ is what powers the library! NPM Package is the best way to install this package.

Examples

First steps
yarn add kubets
Or
npm i -s kubets
Initialising the classes.
import { ReceiverType, GeneralReceiver, GeneralSender } from 'kubets'
const reciever = new GeneralReceiver({
	host: '127.0.0.1',
	port: 50000,
	channel: 'testing_Command_channel',
	client: 'hello-world-receiver',
	type: ReceiverType.Query,
	defaultTimeout: 50000
});
const sender = new GeneralSender({
	host: '127.0.0.1',
	port: 50000,
	channel: 'testing_Command_channel',
	client: 'hello-world-sender',
	type: ReceiverType.Query,
	defaultTimeout: 50000
});
Listening to a message via RPC.
import { Request, Response } from 'kubets';
receiver.subscribe(async (cmd: Request) => {
    console.log('Received a message.')
    // ...

    const res = new Response();
    res.setBody(Buffer.from('example body!'))
    await receiver.ack(cmd, res);
})
Sending a message via RPC.
import { Request } from 'kubets'

const request = new Request();
request.setBody(Buffer.from(JSON.stringify({
    data: 'xxxx',
    moreData: 50513
})));
request.setTimeout(10000);

const res = await sender.send(request);
res.xxx
0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.2

5 years ago

0.3.0

5 years ago

0.3.1

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago