diff --git a/NOTICE b/NOTICE index b1deb65eb3d0ab0da6a889ec666f7a9652025b31..324ec0e0144b170b97128dc477777a7160f26658 100644 --- a/NOTICE +++ b/NOTICE @@ -83,7 +83,7 @@ The following software have components provided under the terms of this license: - Byte Buddy (without dependencies) (from https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy) - Byte Buddy Java agent (from https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent) - ClassMate (from http://github.com/cowtowncoder/java-classmate) -- Cloud Key Management Service (KMS) API v1-rev20230421-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-cloudkms) +- Cloud Key Management Service (KMS) API (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-cloudkms) - Collections (from https://repo1.maven.org/maven2/commons-collections/commons-collections) - Commons Digester (from http://commons.apache.org/digester/) - Converter: Jackson (from https://github.com/square/retrofit, https://repo1.maven.org/maven2/com/squareup/retrofit2/converter-jackson) @@ -288,7 +288,7 @@ The following software have components provided under the terms of this license: - jackson-databind (from http://github.com/FasterXML/jackson, http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson) - java-cloudant (from https://cloudant.com) - javatuples (from http://www.javatuples.org) -- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250) +- javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) - javax.inject (from http://code.google.com/p/atinject/, https://repo1.maven.org/maven2/org/glassfish/hk2/external/javax.inject) - jose4j (from https://bitbucket.org/b_c/jose4j/) - json-path (from http://code.google.com/p/json-path/, https://github.com/jayway/JsonPath) @@ -428,7 +428,7 @@ The following software have components provided under the terms of this license: - Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - JavaBeans Activation Framework (from <http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp>, http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp, https://repo1.maven.org/maven2/com/sun/activation/javax.activation) -- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250) +- javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) ======================================================================== CDDL-1.1 @@ -438,7 +438,7 @@ The following software have components provided under the terms of this license: - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - JavaBeans Activation Framework (from <http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp>, http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp, https://repo1.maven.org/maven2/com/sun/activation/javax.activation) - JavaMail API (from https://repo1.maven.org/maven2/com/sun/mail/javax.mail) -- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250) +- javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) - tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== @@ -528,7 +528,7 @@ The following software have components provided under the terms of this license: - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - Java Servlet 4.0 API - JavaBeans Activation Framework (from <http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp>, http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp, https://repo1.maven.org/maven2/com/sun/activation/javax.activation) -- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250) +- javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) - tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/ExternalSubscriptionsManager.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/ExternalSubscriptionsManager.java index 4b4cdc9e074b85c4a32606ea79c2f900126c3ddc..7889a433389510dcace6193903cd621648e8335a 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/ExternalSubscriptionsManager.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/ExternalSubscriptionsManager.java @@ -18,6 +18,7 @@ package org.opengroup.osdu.notification.provider.gcp.config; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; @@ -50,7 +51,14 @@ public class ExternalSubscriptionsManager { List<Subscription> cachedInfos = Optional.ofNullable(getExternalSubscriptions(dataPartitionId)) .orElseThrow(() -> new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Server error", "OQM | Subscription info cache was not initialized")) .getSubscriptions(); - return getFilteredSubscription(cachedInfos, dataPartitionId, subscriptionId, serviceTopic); + + Subscription subscription = getFilteredSubscription(cachedInfos, dataPartitionId, + subscriptionId, serviceTopic); + + if (Objects.nonNull(subscription) && Objects.isNull(subscription.getSecret())) { + return sendGetSubscriptionRequest(dataPartitionId, subscriptionId, serviceTopic, cachedInfos); + } + return subscription; } private Subscription getFilteredSubscription(List<Subscription> subscriptions, String dataPartitionId, diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmNotificationHandler.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmNotificationHandler.java index 1b41fbb1a39e6c4003fc71e7abdfed6a95de248e..a4ecd52967de78adb6bfddeea2c1c22d62a33fc4 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmNotificationHandler.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmNotificationHandler.java @@ -16,6 +16,7 @@ package org.opengroup.osdu.notification.provider.gcp.pubsub; +import java.util.Objects; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpStatus; @@ -57,6 +58,12 @@ public class OqmNotificationHandler { } Subscription subscription = externalSubscriptionsManager.getSubscription(dataPartitionId, subscriptionId, serviceTopic); + if (Objects.isNull(subscription)) { + throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, + "Subscriber config not found.", + String.format("Subscriber with id: %s not found in cache", subscriptionId) + ); + } Secret secret = subscription.getSecret(); SecretAuth secretAuth = authFactory.getSecretAuth(secret.getSecretType()); diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/receiver/OqmPublishTopicReceiver.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/receiver/OqmPublishTopicReceiver.java index 3f784f5b6be477e0e2279223c1c55a5dfa35b487..49f985eb1a9e9ab5bd55515a154a212121854ab7 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/receiver/OqmPublishTopicReceiver.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/receiver/OqmPublishTopicReceiver.java @@ -17,6 +17,7 @@ package org.opengroup.osdu.notification.provider.gcp.pubsub.receiver; +import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.opengroup.osdu.core.common.http.HttpResponse; import org.opengroup.osdu.core.common.model.http.AppException; @@ -27,8 +28,6 @@ import org.opengroup.osdu.core.gcp.oqm.model.OqmSubscription; import org.opengroup.osdu.notification.provider.gcp.pubsub.OqmNotificationHandler; import org.opengroup.osdu.notification.provider.gcp.thread.ThreadScopeContextHolder; -import java.util.Map; - @Slf4j public class OqmPublishTopicReceiver implements OqmMessageReceiver {