1 | import { ConfigParams } from 'pip-services3-commons-node';
|
2 | import { IReferences } from 'pip-services3-commons-node';
|
3 | import { ConnectionParams } from './ConnectionParams';
|
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 | export declare class ConnectionResolver {
|
46 | private readonly _connections;
|
47 | private _references;
|
48 | |
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | constructor(config?: ConfigParams, references?: IReferences);
|
55 | /**
|
56 | * Configures component by passing configuration parameters.
|
57 | *
|
58 | * @param config configuration parameters to be set.
|
59 | */
|
60 | configure(config: ConfigParams): void;
|
61 | /**
|
62 | * Sets references to dependent components.
|
63 | *
|
64 | * @param references references to locate the component dependencies.
|
65 | */
|
66 | setReferences(references: IReferences): void;
|
67 | /**
|
68 | * Gets all connections configured in component configuration.
|
69 | *
|
70 | * Redirect to Discovery services is not done at this point.
|
71 | * If you need fully fleshed connection use [[resolve]] method instead.
|
72 | *
|
73 | * @returns a list with connection parameters
|
74 | */
|
75 | getAll(): ConnectionParams[];
|
76 | /**
|
77 | * Adds a new connection to component connections
|
78 | *
|
79 | * @param connection new connection parameters to be added
|
80 | */
|
81 | add(connection: ConnectionParams): void;
|
82 | private resolveInDiscovery;
|
83 | /**
|
84 | * Resolves a single component connection. If connections are configured to be retrieved
|
85 | * from Discovery service it finds a [[IDiscovery]] and resolves the connection there.
|
86 | *
|
87 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
88 | * @param callback callback function that receives resolved connection or error.
|
89 | *
|
90 | * @see [[IDiscovery]]
|
91 | */
|
92 | resolve(correlationId: string, callback: (err: any, result: ConnectionParams) => void): void;
|
93 | private resolveAllInDiscovery;
|
94 | /**
|
95 | * Resolves all component connection. If connections are configured to be retrieved
|
96 | * from Discovery service it finds a [[IDiscovery]] and resolves the connection there.
|
97 | *
|
98 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
99 | * @param callback callback function that receives resolved connections or error.
|
100 | *
|
101 | * @see [[IDiscovery]]
|
102 | */
|
103 | resolveAll(correlationId: string, callback: (err: any, result: ConnectionParams[]) => void): void;
|
104 | private registerInDiscovery;
|
105 | /**
|
106 | * Registers the given connection in all referenced discovery services.
|
107 | * This method can be used for dynamic service discovery.
|
108 | *
|
109 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
110 | * @param connection a connection to register.
|
111 | * @param callback callback function that receives registered connection or error.
|
112 | *
|
113 | * @see [[IDiscovery]]
|
114 | */
|
115 | register(correlationId: string, connection: ConnectionParams, callback: (err: any) => void): void;
|
116 | }
|