forked from nodefluent/yildiz-kafka-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (36 loc) · 1.34 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
44
45
46
47
48
49
"use strict";
const YildizSourceConfig = require("./lib/YildizSourceConfig.js");
const YildizSinkConfig = require("./lib/YildizSinkConfig.js");
const YildizSourceConnector = require("./lib/source/YildizSourceConnector.js");
const YildizSinkConnector = require("./lib/sink/YildizSinkConnector.js");
const YildizSourceTask = require("./lib/source/YildizSourceTask.js");
const YildizSinkTask = require("./lib/sink/YildizSinkTask.js");
const JsonConverter = require("./lib/utils/JsonConverter.js");
const ConverterFactory = require("./lib/utils/ConverterFactory.js");
const runSourceConnector = (properties, converters = [], onError = null) => {
const config = new YildizSourceConfig(properties,
YildizSourceConnector,
YildizSourceTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
const runSinkConnector = (properties, converters = [], onError = null) => {
const config = new YildizSinkConfig(properties,
YildizSinkConnector,
YildizSinkTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
module.exports = {
runSourceConnector,
runSinkConnector,
ConverterFactory
};