@sigodenjs/dee-natstreaming
TypeScript icon, indicating that this package has built-in type declarations

0.14.0 • Public • Published

Dee MQ Service

A mq service for dee framework, powered by nats-streaming

Usage

import * as DeeNatstreaming from "@sigodenjs/dee-natstreaming";

Dee({
  services: {
    mq: {
      initialize: DeeNatstreaming.init,
      args: {
        client: {
          clusterId: "test-cluster",
          stanOptions: {
            url: "nats://localhost:4222"
          }
        },
        producers: {
          sayHello: {
            schema: {
              name: { type: "string" }
            }
          }
        },
        subscribers: {
          "App.sayHello": {}
        },
        handlers: {
          "App.sayHello": (ctx: DeeNatstreaming.Context) => {
            expect(ctx.srvs).toBeDefined();
            expect(ctx.msg.getData().toString()).toBe('{"name":"tom"}');
          }
        }
      }
    }
  }
});

await srvs.mq.producers.sayHello({ name: "tom" });

Package Sidebar

Install

npm i @sigodenjs/dee-natstreaming

Weekly Downloads

0

Version

0.14.0

License

MIT

Unpacked Size

14.3 kB

Total Files

6

Last publish

Collaborators

  • sigoden