forked from felipemuhamed/dojot-module-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
54 lines (50 loc) · 1.66 KB
/
index.d.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
42
43
44
45
46
47
48
49
50
51
52
53
54
declare module '@andrewjsc/dojot-module' {
class Messenger {
public constructor(name: string, config?: any);
public getTenants(): string[];
public emit(subject: string, tenant: string, event: string, data: any): void;
public on(subject: string, event: string, callback: (tenant: string, data: any) => void): void;
public createChannel(subject: string, mode?: "r" | "w" | "rw", isGlobal?: boolean): void;
public publish(subject: string, tenant:string, message:any): void;
public init(): Promise<void>;
}
class Auth {
public getManagementTokent(tenant: string): void;
public getTenants(auth: string): Promise<any>;
}
interface Config {
kafka: {
consumer: any,
producer: any,
},
databroker: {
host: string,
},
auth: {
host: string,
},
dojot: {
managementService: string,
subjects: {
tenancy: string,
devices: string,
deviceData: string,
}
}
}
class KafkaProducer {
constructor(producerConfig: any);
connect(): Promise<void>;
produce(topic: string, message: any, key?: string, partition?: number): Promise<any>;
disconnect(): Promise<any>;
}
class KafkaConsumer {
constructor(consumerConfig: any);
connect(): void;
subscribe(topic: string): void;
consume(maxMessages?: number): Promise<any>;
// onMessageListener(callback: (data: any) => void): void;
commit(): void;
disconnect(): Promise<any>;
}
}