From d943cc9e1d8331747ec28d4f5c55318b737215e8 Mon Sep 17 00:00:00 2001 From: tharindu1st Date: Sun, 18 Feb 2024 22:41:42 +0530 Subject: [PATCH] fixing subscription issue --- common-controller/internal/utils/event_utils.go | 1 + .../subscription/SubscriptionDataStoreImpl.java | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common-controller/internal/utils/event_utils.go b/common-controller/internal/utils/event_utils.go index f6a157311..092765c4b 100644 --- a/common-controller/internal/utils/event_utils.go +++ b/common-controller/internal/utils/event_utils.go @@ -194,6 +194,7 @@ func sendApplicationKeyMappingEvent(applicationUUID string, applicationSpec cpv1 ApplicationIdentifier: env.AppID, KeyType: env.KeyType, EnvID: env.EnvID, + Organization: applicationSpec.Organization, }, } sendEvent(&event) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java index a326faaf3..33c132e65 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java @@ -308,10 +308,11 @@ public void addApplicationMapping(org.wso2.apk.enforcer.discovery.subscription.A resolvedApplicationMapping.setUuid(applicationMapping.getUuid()); resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef()); resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); - if (applicationMappingMap.containsKey(resolvedApplicationMapping.getUuid())) { - applicationMappingMap.replace(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping); + resolvedApplicationMapping.setOrganization(applicationMapping.getOrganization()); + if (applicationMappingMap.containsKey(resolvedApplicationMapping.getCacheKey())) { + applicationMappingMap.replace(resolvedApplicationMapping.getCacheKey(), resolvedApplicationMapping); } else { - applicationMappingMap.put(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping); + applicationMappingMap.put(resolvedApplicationMapping.getCacheKey(), resolvedApplicationMapping); } } @@ -342,7 +343,8 @@ public void removeApplicationMapping(org.wso2.apk.enforcer.discovery.subscriptio resolvedApplicationMapping.setUuid(applicationMapping.getUuid()); resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef()); resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); - applicationMappingMap.remove(resolvedApplicationMapping.getUuid()); + resolvedApplicationMapping.setOrganization(applicationMapping.getOrganization()); + applicationMappingMap.remove(resolvedApplicationMapping.getCacheKey()); } @Override