-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
48 lines (35 loc) · 1.35 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
"use strict";
const SalesforceSourceConfig = require("./lib/SalesforceSourceConfig.js");
const SalesforceSinkConfig = require("./lib/SalesforceSinkConfig.js");
const SalesforceSourceConnector = require("./lib/source/SalesforceSourceConnector.js");
const SalesforceSinkConnector = require("./lib/sink/SalesforceSinkConnector.js");
const SalesforceSourceTask = require("./lib/source/SalesforceSourceTask.js");
const SalesforceSinkTask = require("./lib/sink/SalesforceSinkTask.js");
const { JsonConverter, ConverterFactory } = require("kafka-connect");
const runSourceConnector = (properties, converters = [], onError = null) => {
const config = new SalesforceSourceConfig(properties,
SalesforceSourceConnector,
SalesforceSourceTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
const runSinkConnector = (properties, converters = [], onError = null) => {
const config = new SalesforceSinkConfig(properties,
SalesforceSinkConnector,
SalesforceSinkTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
module.exports = {
runSourceConnector,
runSinkConnector,
ConverterFactory
};