@itentialopensource/adapter-kafkav2 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/error.json ADDED
@@ -0,0 +1,178 @@
1
+ {
2
+ "errors": [
3
+ {
4
+ "key": "Unable To Save To Database",
5
+ "icode": "AD.100",
6
+ "displayString": "Error on saving to Database $VARIABLE$",
7
+ "recommendation": "Verify the database connectivity and credentials"
8
+ },
9
+ {
10
+ "key": "Database Error",
11
+ "icode": "AD.101",
12
+ "displayString": "Database Error: $VARIABLE$",
13
+ "recommendation": "Verify the database connectivity, schema and permissions"
14
+ },
15
+ {
16
+ "key": "Database Credentials",
17
+ "icode": "AD.102",
18
+ "displayString": "Database Error: Invalid Credentials",
19
+ "recommendation": "Verify the database credentials"
20
+ },
21
+ {
22
+ "key": "No Queue Item",
23
+ "icode": "AD.110",
24
+ "displayString": "Queue Item $VARIABLE$ not found in queue",
25
+ "recommendation": "Make sure the queue is working properly"
26
+ },
27
+ {
28
+ "key": "Unable To Create Queue",
29
+ "icode": "AD.111",
30
+ "displayString": "Unable to create queue: $VARIABLE$",
31
+ "recommendation": "Verify access to the database, redis or system memory"
32
+ },
33
+ {
34
+ "key": "Queue Full",
35
+ "icode": "AD.112",
36
+ "displayString": "Request $VARIABLE$ Transaction $VARIABLE$ rejected - queue full at $VARIABLE$",
37
+ "recommendation": "Make sure the queue is working properly"
38
+ },
39
+ {
40
+ "key": "Unable To Clear Queue",
41
+ "icode": "AD.113",
42
+ "displayString": "Unable to clear queue: $VARIABLE$",
43
+ "recommendation": "Make sure the queue exists"
44
+ },
45
+ {
46
+ "key": "Unable To Claim Turn",
47
+ "icode": "AD.114",
48
+ "displayString": "Request $VARIABLE$ Transaction $VARIABLE$ unable to claim license: $VARIABLE$",
49
+ "recommendation": "Make sure the queue is working properly"
50
+ },
51
+ {
52
+ "key": "Unable To Free Turn",
53
+ "icode": "AD.115",
54
+ "displayString": "Request $VARIABLE$ Transaction $VARIABLE$ unable to free license: $VARIABLE$",
55
+ "recommendation": "Make sure the queue is working properly"
56
+ },
57
+ {
58
+ "key": "Item In Wrong State",
59
+ "icode": "AD.116",
60
+ "displayString": "Queue item is in the wrong state: $VARIABLE$ ",
61
+ "recommendation": "Make sure the queue is working properly"
62
+ },
63
+ {
64
+ "key": "Missing Data",
65
+ "icode": "AD.300",
66
+ "displayString": "$VARIABLE$ is required",
67
+ "recommendation": "Please provide the required data"
68
+ },
69
+ {
70
+ "key": "Missing File",
71
+ "icode": "AD.301",
72
+ "displayString": "Can not open file $VARIABLE$",
73
+ "recommendation": "Verify the file exists and has proper permissions"
74
+ },
75
+ {
76
+ "key": "Invalid Action File",
77
+ "icode": "AD.302",
78
+ "displayString": "Invalid action file: $VARIABLE$ in $VARIABLE$",
79
+ "recommendation": "Verify the action file"
80
+ },
81
+ {
82
+ "key": "Unsupported Protocol",
83
+ "icode": "AD.303",
84
+ "displayString": "Protocol $VARIABLE$ not currently supported",
85
+ "recommendation": "Verify the protocol on the action"
86
+ },
87
+ {
88
+ "key": "Invalid Schema File",
89
+ "icode": "AD.304",
90
+ "displayString": "Invalid schema file: $VARIABLE$ in $VARIABLE$",
91
+ "recommendation": "Verify the action file"
92
+ },
93
+ {
94
+ "key": "Invalid Properties",
95
+ "icode": "AD.305",
96
+ "displayString": "Invalid properties: $VARIABLE$",
97
+ "recommendation": "Verify the properties for the adapter"
98
+ },
99
+ {
100
+ "key": "Query Not Translated",
101
+ "icode": "AD.310",
102
+ "displayString": "Query Not Translated",
103
+ "recommendation": "Verify the information passed in the query object"
104
+ },
105
+ {
106
+ "key": "Payload Not Translated",
107
+ "icode": "AD.311",
108
+ "displayString": "Payload Not Translated",
109
+ "recommendation": "Verify the information passed in the payload object"
110
+ },
111
+ {
112
+ "key": "Schema Validation Failure",
113
+ "icode": "AD.312",
114
+ "displayString": "Schema validation failed on $VARIABLE$",
115
+ "recommendation": "Verify the information provided is in the correct format with everything required"
116
+ },
117
+ {
118
+ "key": "Entity Cache Not Loading",
119
+ "icode": "AD.320",
120
+ "displayString": "Could not load entity: $VARIABLE$, into cache",
121
+ "recommendation": "Verify the cache is working properly"
122
+ },
123
+ {
124
+ "key": "Error Verifying Entity Cache",
125
+ "icode": "AD.321",
126
+ "displayString": "Could not verify entity in cache",
127
+ "recommendation": "Verify the cache is working properly"
128
+ },
129
+ {
130
+ "key": "Unable To Authenticate",
131
+ "icode": "AD.400",
132
+ "displayString": "Unable to authenticate with $VARIABLE$, response $VARIABLE$",
133
+ "recommendation": "Verify the user credentials and check the response for more information"
134
+ },
135
+ {
136
+ "key": "Unable To Encode",
137
+ "icode": "AD.401",
138
+ "displayString": "Can not perform base64 encoding on $VARIABLE$",
139
+ "recommendation": "Check the authentication format"
140
+ },
141
+ {
142
+ "key": "Unable To Get Token",
143
+ "icode": "AD.402",
144
+ "displayString": "Unable to get token for user: $VARIABLE$",
145
+ "recommendation": "Verify the user credentials and the system information"
146
+ },
147
+ {
148
+ "key": "Error On Request",
149
+ "icode": "AD.500",
150
+ "displayString": "Error $VARIABLE$ received on request",
151
+ "recommendation": "Verify the request is accurate via debug logs and postman"
152
+ },
153
+ {
154
+ "key": "Request Timeout",
155
+ "icode": "AD.501",
156
+ "displayString": "The Adapter has run out of time for the request",
157
+ "recommendation": "Increase your adapter request.attempt_timeout property"
158
+ },
159
+ {
160
+ "key": "Invalid Response",
161
+ "icode": "AD.502",
162
+ "displayString": "Invalid response received for $VARIABLE$",
163
+ "recommendation": "Verify the request is accurate via debug logs and postman"
164
+ },
165
+ {
166
+ "key": "Failure Response",
167
+ "icode": "AD.503",
168
+ "displayString": "Failure response received for $VARIABLE$",
169
+ "recommendation": "Check the reason for failure in the stack trace"
170
+ },
171
+ {
172
+ "key": "Caught Exception",
173
+ "icode": "AD.900",
174
+ "displayString": "Caught Exception $VARIABLE$",
175
+ "recommendation": "Evaluate why the exception took place"
176
+ }
177
+ ]
178
+ }
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@itentialopensource/adapter-kafkav2",
3
+ "version": "0.3.12",
4
+ "description": "Itential adapter to connect to kafka",
5
+ "main": "adapter.js",
6
+ "wizardVersion": "2.35.0",
7
+ "engineVersion": "1.40.2",
8
+ "scripts": {
9
+ "artifactize": "npm i && node utils/packModificationScript.js",
10
+ "preinstall": "node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions",
11
+ "lint": "eslint . --ext .json --ext .js",
12
+ "lint:errors": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet",
13
+ "test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
14
+ "test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
15
+ "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
16
+ "test": "npm run test:unit && npm run test:integration",
17
+ "deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
18
+ "build": "npm run deploy",
19
+ "postinstall": "patch-package"
20
+ },
21
+ "keywords": [
22
+ "Itential",
23
+ "IAP",
24
+ "Automation",
25
+ "Integration",
26
+ "App-Artifacts",
27
+ "Adapter",
28
+ "Notification",
29
+ "Messaging",
30
+ "Kafka",
31
+ "Pre-Release"
32
+ ],
33
+ "license": "Apache-2.0",
34
+ "engines": {
35
+ "node": ">= 0.12.7"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git@gitlab.com:itentialopensource/adapters/notification-messaging/adapter-kafka.git"
40
+ },
41
+ "author": "Itential",
42
+ "homepage": "https://gitlab.com/itentialopensource/adapters/notification-messaging/adapter-kafka",
43
+ "dependencies": {
44
+ "ajv": "^6.12.0",
45
+ "avro-schema-registry": "^2.1.0",
46
+ "avsc": "^5.4.21",
47
+ "fs-extra": "^8.1.0",
48
+ "json-query": "^2.2.2",
49
+ "kafkajs": "2.2.3",
50
+ "package-json-validator": "^0.6.3",
51
+ "patch-package": "^6.4.7",
52
+ "readline-sync": "^1.4.10",
53
+ "request": "^2.88.2",
54
+ "uuid": "^3.0.1"
55
+ },
56
+ "devDependencies": {
57
+ "chai": "^4.2.0",
58
+ "eslint": "^7.2.0",
59
+ "eslint-config-airbnb-base": "^14.2.0",
60
+ "eslint-plugin-import": "^2.21.2",
61
+ "eslint-plugin-json": "^2.1.1",
62
+ "mocha": "^9.0.1",
63
+ "nyc": "^15.1.0",
64
+ "testdouble": "^3.16.1",
65
+ "winston": "^3.3.3"
66
+ },
67
+ "resolutions": {
68
+ "minimist": "^1.2.5"
69
+ },
70
+ "private": false
71
+ }
package/pronghorn.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": "@itentialopensource/adapter-kafkav2",
3
+ "type": "Adapter",
4
+ "export": "Kafkav2",
5
+ "displayName": "Kafkav2",
6
+ "title": "Kafkav2",
7
+ "src": "adapter.js",
8
+ "roles": [
9
+ "admin"
10
+ ],
11
+ "topics": {
12
+ "kafka": {},
13
+ "first_kafka_topic": {},
14
+ "test-topic": {}
15
+ },
16
+ "methods": [
17
+ {
18
+ "name": "sendMessage",
19
+ "summary": "send message",
20
+ "description": "send message",
21
+ "input": [
22
+ {
23
+ "name": "payloads",
24
+ "type": "array",
25
+ "info": "array of ProduceRequest",
26
+ "required": false
27
+ }
28
+ ],
29
+ "output": {
30
+ "name": "result",
31
+ "type": "object",
32
+ "description": "A JSON Object containing status, code and the result"
33
+ },
34
+ "route": {
35
+ "verb": "POST",
36
+ "path": "/sendMessage"
37
+ },
38
+ "roles": [
39
+ "admin"
40
+ ],
41
+ "task": true
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,198 @@
1
+ {
2
+ "$id": "adapter-kafkav2",
3
+ "type": "object",
4
+ "$schema": "http://json-schema.org/draft-07/schema#",
5
+ "oneOf": [
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "host": {
10
+ "type": "string",
11
+ "description": "hostname of the server",
12
+ "default": "localhost",
13
+ "examples": [
14
+ "systemx.customer.com"
15
+ ]
16
+ },
17
+ "port": {
18
+ "type": "integer",
19
+ "description": "port on which to connect to the server",
20
+ "default": 9092,
21
+ "minimum": 1,
22
+ "maximum": 65535
23
+ }
24
+ },
25
+ "required": [
26
+ "host",
27
+ "port"
28
+ ]
29
+ },
30
+ {
31
+ "type": "object",
32
+ "properties": {
33
+ "hostList": {
34
+ "type": "string",
35
+ "description": "A string of kafka broker/host combination delimited by comma",
36
+ "default": "localhost:9092",
37
+ "examples": [
38
+ "kafka-1.us-east-1.myapp.com:9093,kafka-2.us-east-1.myapp.com:9093,kafka-3.us-east-1.myapp.com:9093",
39
+ "kafka-1.us-east-1.myapp.com:9093"
40
+ ]
41
+ }
42
+ },
43
+ "required": [
44
+ "hostList"
45
+ ]
46
+ }
47
+ ],
48
+ "if": {
49
+ "not": {
50
+ "anyOf": [
51
+ {
52
+ "required": ["host"]
53
+ },
54
+ {
55
+ "required": ["hostList"]
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ "then": {
61
+ "properties": {
62
+ "host": {
63
+ "default": "localhost"
64
+ },
65
+ "port": {
66
+ "default": 9092
67
+ }
68
+ }
69
+ },
70
+ "properties": {
71
+ "registry_url": {
72
+ "type": "string",
73
+ "description": "registry url of schema",
74
+ "default": "",
75
+ "examples": [
76
+ "systemx.customer.com:8081"
77
+ ]
78
+ },
79
+ "topics": {
80
+ "type": "array",
81
+ "description": "An array of specific topics to move from kafka to rabbit",
82
+ "items": {
83
+ "type": [
84
+ "string",
85
+ "object"
86
+ ]
87
+ }
88
+ },
89
+ "parseMessage" :{
90
+ "type": "boolean",
91
+ "description": "Whether or not to prase the message as JSON when consumed by IAP",
92
+ "default" : true
93
+ },
94
+ "wrapMessage" : {
95
+ "type": "string",
96
+ "description": "A key to wrap the parsed JSON message",
97
+ "examples" : [ "message"],
98
+ "default" : "payload"
99
+ },
100
+ "interval_time": {
101
+ "type": "integer",
102
+ "description": "how often to write the topics file",
103
+ "default": 30000,
104
+ "minimum": 5000,
105
+ "maximum": 3600000
106
+ },
107
+ "stub": {
108
+ "type": "boolean",
109
+ "description": "run in stub mode - turns off topic writing",
110
+ "default": false
111
+ },
112
+ "client": {
113
+ "type": "object",
114
+ "properties": {
115
+ "connectTimeout": {
116
+ "type": "integer",
117
+ "default": 10000
118
+ },
119
+ "requestTimeout": {
120
+ "type": "integer",
121
+ "default": 30000
122
+ },
123
+ "autoConnect": {
124
+ "type": "boolean",
125
+ "default": true
126
+ },
127
+ "connectRetryOptions": {
128
+ "type": "object"
129
+ },
130
+ "idleConnection": {
131
+ "type": "integer",
132
+ "default": 300000
133
+ },
134
+ "reconnectOnIdle": {
135
+ "type": "boolean",
136
+ "default": true
137
+ },
138
+ "maxAsyncRequests": {
139
+ "type": "integer",
140
+ "default": 10
141
+ },
142
+ "sslOptions": {
143
+ "type": "object"
144
+ },
145
+ "sasl": {
146
+ "type": "object"
147
+ }
148
+ }
149
+ },
150
+ "producer": {
151
+ "type": "object",
152
+ "properties": {
153
+ "requireAcks": {
154
+ "type": "integer"
155
+ },
156
+ "ackTimeoutMs": {
157
+ "type": "integer"
158
+ },
159
+ "partitionerType": {
160
+ "type": "integer"
161
+ }
162
+ }
163
+ },
164
+ "consumer": {
165
+ "type": "object",
166
+ "properties": {
167
+ "groupId": {
168
+ "type": "string"
169
+ },
170
+ "autoCommit": {
171
+ "type": "boolean"
172
+ },
173
+ "autoCommitIntervalMs": {
174
+ "type": "integer"
175
+ },
176
+ "fetchMaxWaitMs": {
177
+ "type": "integer"
178
+ },
179
+ "fetchMinBytes": {
180
+ "type": "integer"
181
+ },
182
+ "fetchMaxBytes": {
183
+ "type": "integer"
184
+ },
185
+ "fromOffset": {
186
+ "type": "boolean"
187
+ },
188
+ "encoding": {
189
+ "type": "string"
190
+ },
191
+ "keyEncoding": {
192
+ "type": "string"
193
+ }
194
+ }
195
+ }
196
+ },
197
+ "definitions": {}
198
+ }
Binary file
@@ -0,0 +1,41 @@
1
+ {
2
+ "type": "Kafkav2",
3
+ "id": "kafkav2",
4
+ "properties": {
5
+ "host": "localhost",
6
+ "port": 9092,
7
+ "registry_url": "",
8
+ "topics": [],
9
+ "interval_time": 5000,
10
+ "stub": false,
11
+ "client": {
12
+ "connectTimeout": 10000,
13
+ "requestTimeout": 30000,
14
+ "autoConnect": true,
15
+ "connectRetryOptions": {},
16
+ "idleConnection": 300000,
17
+ "reconnectOnIdle": true,
18
+ "maxAsyncRequests": 10,
19
+ "sslOptions": {},
20
+ "sasl": {}
21
+ },
22
+ "producer": {
23
+ "requireAcks": 1,
24
+ "ackTimeoutMs": 100,
25
+ "partitionerType": 0
26
+ },
27
+ "consumer": {
28
+ "groupId": "kafka-node-group",
29
+ "autoCommit": false,
30
+ "autoCommitIntervalMs": 5000,
31
+ "fetchMaxWaitMs": 100,
32
+ "fetchMinBytes": 1,
33
+ "fetchMaxBytes": 1048576,
34
+ "fromOffset": true,
35
+ "encoding": "utf8",
36
+ "keyEncoding": "utf8"
37
+ }
38
+ },
39
+ "logLevel": "none",
40
+ "timeout": 60000
41
+ }