@cap-js-community/event-queue 2.0.0-beta.3 → 2.0.0-beta.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js-community/event-queue",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "An event queue that enables secure transactional processing of asynchronous and periodic events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -17,9 +17,9 @@ const subscribeRedisChannel = async (channel, subscribeHandler) => {
|
|
|
17
17
|
return await redisClient.subscribeChannel(config.redisOptions, channelWithNamespace, subscribeHandler);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const publishMessage = async (channel, message
|
|
20
|
+
const publishMessage = async (channel, message) => {
|
|
21
21
|
const redisClient = RedisClient.create(REDIS_CLIENT_NAME);
|
|
22
|
-
const channelWithNamespace = [config.redisNamespace(
|
|
22
|
+
const channelWithNamespace = [config.redisNamespace(false), channel].join("##");
|
|
23
23
|
return await redisClient.publishMessage(config.redisOptions, channelWithNamespace, message);
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -27,11 +27,9 @@ const attachRedisUnsubscribeHandler = () => {
|
|
|
27
27
|
|
|
28
28
|
const handleUnsubscribe = (tenantId) => {
|
|
29
29
|
if (config.redisEnabled) {
|
|
30
|
-
client
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
cds.log(COMPONENT_NAME).error(`publishing tenant unsubscribe failed. tenantId: ${tenantId}`, error);
|
|
34
|
-
});
|
|
30
|
+
client.publishMessage(REDIS_OFFBOARD_TENANT_CHANNEL, JSON.stringify({ tenantId })).catch((error) => {
|
|
31
|
+
cds.log(COMPONENT_NAME).error(`publishing tenant unsubscribe failed. tenantId: ${tenantId}`, error);
|
|
32
|
+
});
|
|
35
33
|
} else {
|
|
36
34
|
config.executeUnsubscribeHandlers(tenantId);
|
|
37
35
|
}
|