-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.ts
More file actions
33 lines (28 loc) · 856 Bytes
/
index.ts
File metadata and controls
33 lines (28 loc) · 856 Bytes
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
import { WsSql } from "./sql/wsSql";
import { WSConfig } from "./common/config";
import { WsConsumer } from "./tmq/wsTmq";
import logger, { setLevel } from "./common/log";
import { WebSocketConnectionPool } from "./client/wsConnectorPool";
let sqlConnect = async (conf: WSConfig) => {
try {
return await WsSql.open(conf);
} catch (err: any) {
logger.error(err);
throw err;
}
};
let tmqConnect = async (configMap: Map<string, string>) => {
try {
return await WsConsumer.newConsumer(configMap);
} catch (err: any) {
logger.error(err);
throw err;
}
};
let setLogLevel = (level: string) => {
setLevel(level);
};
let destroy = () => {
WebSocketConnectionPool.instance().destroyed();
};
export { sqlConnect, tmqConnect, setLogLevel, destroy };