-
Notifications
You must be signed in to change notification settings - Fork 5
/
billing.ts
executable file
·41 lines (36 loc) · 1.2 KB
/
billing.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /usr/bin/env -S node -r ts-node/register/transpile-only -r tsconfig-paths/register
import "reflect-metadata";
import { program } from "commander";
import AsyncEventBus from "@Apps/Consumers/AsyncEventBus/AsyncEventBus";
import http from "@Apps/HTTP";
import KernelFactory from "./src/Kernel";
program
.version("1.0.0")
;
program
.command("queue:consume")
.description("Consume queues")
.option("-q, --queue [Queue Name]", "Name of the queue to consume")
.option("-p, --pattern [Topic pattern]", "Topic filter")
.option("-l, --limit [Message Limit]", "Define the max number of messages the worker can consume before graceful exit. Default 100")
.option("-m, --monitor [Monitor]", "Monitoring server")
.action(async (options) => {
const kernel = await KernelFactory()
const bus = new AsyncEventBus(
kernel,
options.queue || "events",
options.pattern || "#",
options.limit || 1000,
options.monitor || false,
);
await bus.consume();
})
;
program
.command("http")
.description("Start http server")
.action(async (options) => {
await http();
})
;
program.parse(process.argv);