@sigodenjs/dee-natstreaming
v0.14.0
Published
A mq service for dee framework, powered by nats-streaming
Downloads
3
Maintainers
Readme
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" });