Skip to content
Snippets Groups Projects
Commit c58fff16 authored by Yunhua Koglin's avatar Yunhua Koglin
Browse files

Merge remote-tracking branch 'origin/master' into dev

parents bc4fa64b 1f502839
No related branches found
No related tags found
1 merge request!437merge code to gitlab
......@@ -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/)
========================================================================
......
......@@ -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,
......
......@@ -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());
......
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment