-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
43 lines (31 loc) · 1.27 KB
/
index.js
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
const BigTableSourceConfig = require('./lib/BigTableSourceConfig.js');
const BigTableSinkConfig = require('./lib/BigTableSinkConfig.js');
const BigTableSourceConnector = require('./lib/source/BigTableSourceConnector.js');
const BigTableSinkConnector = require('./lib/sink/BigTableSinkConnector.js');
const BigTableSourceTask = require('./lib/source/BigTableSourceTask.js');
const BigTableSinkTask = require('./lib/sink/BigTableSinkTask.js');
const JsonConverter = require('./lib/utils/JsonConverter.js');
const ConverterFactory = require('./lib/utils/ConverterFactory.js');
const runSourceConnector = (properties, converters = [], onError = null) => {
const config = new BigTableSourceConfig(properties,
BigTableSourceConnector,
BigTableSourceTask, [JsonConverter].concat(converters));
if (onError) {
config.on('error', onError);
}
return config.run().then(() => config);
};
const runSinkConnector = (properties, converters = [], onError = null) => {
const config = new BigTableSinkConfig(properties,
BigTableSinkConnector,
BigTableSinkTask, [JsonConverter].concat(converters));
if (onError) {
config.on('error', onError);
}
return config.run().then(() => config);
};
module.exports = {
runSourceConnector,
runSinkConnector,
ConverterFactory,
};