Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Notification
Commits
0c1d78e2
Commit
0c1d78e2
authored
Jul 28, 2021
by
Nikhil Singh[MicroSoft]
Committed by
Komal Makkar
Jul 28, 2021
Browse files
Usage of Non Request Scope bean for Service Bus Flow
parent
4845fc47
Changes
1
Hide whitespace changes
Inline
Side-by-side
notification-core/src/main/java/org/opengroup/osdu/notification/di/SubscriptionCacheFactory.java
View file @
0c1d78e2
...
...
@@ -19,7 +19,10 @@ package org.opengroup.osdu.notification.di;
import
org.opengroup.osdu.core.common.cache.ICache
;
import
org.opengroup.osdu.core.common.cache.MultiTenantCache
;
import
org.opengroup.osdu.core.common.cache.VmCache
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -27,7 +30,9 @@ import org.springframework.stereotype.Component;
@Component
public
class
SubscriptionCacheFactory
implements
ICache
<
String
,
String
>
{
@Autowired
private
TenantInfo
tenant
;
private
DpsHeaders
headers
;
@Autowired
private
ITenantFactory
tenantFactory
;
private
MultiTenantCache
<
String
>
caches
;
...
...
@@ -56,6 +61,10 @@ public class SubscriptionCacheFactory implements ICache<String, String> {
}
private
ICache
<
String
,
String
>
partitionCache
()
{
return
this
.
caches
.
get
(
String
.
format
(
"%s:subscription"
,
this
.
tenant
.
getDataPartitionId
()));
TenantInfo
tenantInfo
=
this
.
tenantFactory
.
getTenantInfo
(
this
.
headers
.
getPartitionIdWithFallbackToAccountId
());
if
(
tenantInfo
==
null
)
{
throw
AppException
.
createUnauthorized
(
String
.
format
(
"could not retrieve tenant info for data partition id: %s"
,
this
.
headers
.
getPartitionIdWithFallbackToAccountId
()));
}
return
this
.
caches
.
get
(
String
.
format
(
"%s:subscription"
,
tenantInfo
.
getDataPartitionId
()));
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment