@cap-js-community/event-queue 0.1.56 → 0.1.57
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/README.md +1 -1
- package/package.json +18 -8
- package/src/redisPubSub.js +4 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ enhancing the overall performance of your application.
|
|
|
13
13
|
|
|
14
14
|
## Getting started
|
|
15
15
|
|
|
16
|
-
- Run `npm add @cap-community/event-queue` in `@sap/cds` project
|
|
16
|
+
- Run `npm add @cap-js-community/event-queue` in `@sap/cds` project
|
|
17
17
|
- Activate the cds-plugin in the cds section of the package.sjon
|
|
18
18
|
|
|
19
19
|
### As cds-plugin
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js-community/event-queue",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "event queue
|
|
3
|
+
"version": "0.1.57",
|
|
4
|
+
"description": "An event queue that enables secure transactional processing of asynchronous events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
"cds-plugin.js",
|
|
10
10
|
"index.cds"
|
|
11
11
|
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"CAP",
|
|
14
|
+
"CDS",
|
|
15
|
+
"messaging",
|
|
16
|
+
"async",
|
|
17
|
+
"redis",
|
|
18
|
+
"load-balancing",
|
|
19
|
+
"eventing",
|
|
20
|
+
"multi-tenancy"
|
|
21
|
+
],
|
|
12
22
|
"scripts": {
|
|
13
23
|
"test:unit": "jest --testPathIgnorePatterns=\"/test-integration/\"",
|
|
14
24
|
"test:integration": "jest --testPathIgnorePatterns=\"/test/\" --runInBand --forceExit",
|
|
@@ -31,23 +41,23 @@
|
|
|
31
41
|
"node": ">=16"
|
|
32
42
|
},
|
|
33
43
|
"dependencies": {
|
|
34
|
-
"uuid": "9.0.
|
|
35
|
-
"redis": "4.6.
|
|
44
|
+
"uuid": "9.0.1",
|
|
45
|
+
"redis": "4.6.10",
|
|
36
46
|
"verror": "1.10.1",
|
|
37
47
|
"yaml": "2.3.2"
|
|
38
48
|
},
|
|
39
49
|
"devDependencies": {
|
|
40
50
|
"@sap/eslint-plugin-cds": "2.6.3",
|
|
41
51
|
"@sap/cds-dk": "7.1.1",
|
|
42
|
-
"hdb": "0.19.
|
|
52
|
+
"hdb": "0.19.6",
|
|
43
53
|
"eslint-plugin-node": "11.1.0",
|
|
44
54
|
"sqlite3": "5.1.6",
|
|
45
55
|
"express": "4.18.2",
|
|
46
56
|
"@sap/cds": "7.1.2",
|
|
47
|
-
"eslint": "8.
|
|
57
|
+
"eslint": "8.50.0",
|
|
48
58
|
"eslint-config-prettier": "9.0.0",
|
|
49
|
-
"eslint-plugin-jest": "27.
|
|
50
|
-
"jest": "29.
|
|
59
|
+
"eslint-plugin-jest": "27.4.0",
|
|
60
|
+
"jest": "29.7.0",
|
|
51
61
|
"prettier": "3.0.3"
|
|
52
62
|
},
|
|
53
63
|
"homepage": "https://cap-js-community.github.io/event-queue/",
|
package/src/redisPubSub.js
CHANGED
|
@@ -47,7 +47,9 @@ const publishEvent = async (tenantId, type, subType) => {
|
|
|
47
47
|
const logger = cds.log(COMPONENT_NAME);
|
|
48
48
|
const configInstance = config.getConfigInstance();
|
|
49
49
|
if (!configInstance.redisEnabled) {
|
|
50
|
-
|
|
50
|
+
if (configInstance.registerAsEventProcessor) {
|
|
51
|
+
await _handleEventInternally(tenantId, type, subType);
|
|
52
|
+
}
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
try {
|
|
@@ -86,7 +88,7 @@ const _handleEventInternally = async (tenantId, type, subType) => {
|
|
|
86
88
|
// NOTE: we need this because of logging otherwise logs would not contain the subdomain
|
|
87
89
|
http: { req: { authInfo: { getSubdomain: () => subdomain } } },
|
|
88
90
|
});
|
|
89
|
-
processEventQueue(context, type, subType);
|
|
91
|
+
getWorkerPoolInstance().addToQueue(async () => processEventQueue(context, type, subType));
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
module.exports = {
|