diff --git a/devops/gc/deploy/templates/deploy-redis.yaml b/devops/gc/deploy/templates/deploy-redis.yaml index de4905ae235875e755efcd008c83d0361accf817..ddafa905ba6858b47654883ecceffd7c49c7030c 100644 --- a/devops/gc/deploy/templates/deploy-redis.yaml +++ b/devops/gc/deploy/templates/deploy-redis.yaml @@ -14,8 +14,8 @@ spec: labels: app: {{ printf "redis-%s" .Values.conf.appName | quote }} annotations: - sidecar.istio.io/proxyCPU: 10m - sidecar.istio.io/proxyMemory: 100Mi + sidecar.istio.io/proxyCPU: 5m + sidecar.istio.io/proxyMemory: 50Mi spec: containers: - args: @@ -32,6 +32,6 @@ spec: protocol: TCP resources: requests: - cpu: 10m - memory: 50Mi + cpu: 5m + memory: 20Mi {{ end }} diff --git a/devops/gc/deploy/values.yaml b/devops/gc/deploy/values.yaml index bd781e8578bd76d7775cce172fb294b935b1f148..2169af86ec8f95e24674853e158ac90a3c343277 100644 --- a/devops/gc/deploy/values.yaml +++ b/devops/gc/deploy/values.yaml @@ -14,8 +14,8 @@ data: redisNotificationPort: 6379 redisImage: "docker.io/library/redis:7" #Deployments - requestsCpu: "10m" - requestsMemory: "512Mi" + requestsCpu: "20m" + requestsMemory: "450Mi" limitsCpu: "1" limitsMemory: "1.5G" serviceAccountName: "notification" @@ -31,7 +31,7 @@ conf: redisSSL: false istio: - proxyCPU: "10m" + proxyCPU: "5m" proxyCPULimit: "200m" - proxyMemory: "100Mi" + proxyMemory: "50Mi" proxyMemoryLimit: "256Mi" diff --git a/provider/notification-azure/pom.xml b/provider/notification-azure/pom.xml index fbfdc6cd1b5ed2d40ee04d74b0744715b863cd27..2de41935b69e7b8196ea1495ae848eb969b9401e 100644 --- a/provider/notification-azure/pom.xml +++ b/provider/notification-azure/pom.xml @@ -39,7 +39,7 @@ <springframework.version>4.3.0.RELEASE</springframework.version> <reactor.netty.version>0.11.0.RELEASE</reactor.netty.version> <reactor.core.version>3.3.0.RELEASE</reactor.core.version> - <osdu.corelibazure.version>0.19.0-rc8</osdu.corelibazure.version> + <osdu.corelibazure.version>0.21.0-rc3</osdu.corelibazure.version> <osdu.oscorecommon.version>0.19.0-rc6</osdu.oscorecommon.version> <junit.version>5.6.0</junit.version> <jjwt.version>3.8.1</jjwt.version> diff --git a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java index 3f9712054ca41e1736108257b504392489851c52..e5182e6c625f74363fb7f2040d52b2717d671648 100644 --- a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java +++ b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java @@ -71,8 +71,6 @@ public class ProcessNotification { MDC.setContextMap(mdcContextMap.getContextMap(correlationId, dataPartitionId, collaborationId)); dpsHeaders.setThreadContext(dataPartitionId, correlationId, collaborationId); - LOGGER.debug("Notification process started for message with id: {}", message.getMessageId()); - HttpResponse response = notificationHandler.notifySubscriber(notificationContent.getNotificationId(), notificationContent.getData(), notificationContent.getExtractAttributes()); diff --git a/provider/notification-gc/docs/anthos/README.md b/provider/notification-gc/docs/anthos/README.md index 5e1bdf25d9c97565d49b0ab5909b0e79e6e705f0..41810569b4951a6375420e02eff38639490b39fd 100644 --- a/provider/notification-gc/docs/anthos/README.md +++ b/provider/notification-gc/docs/anthos/README.md @@ -205,15 +205,18 @@ curl -L -X PATCH 'https://dev.osdu.club/api/partition/v1/partitions/opendes' -H </details> -## PubSub configuration +## RabbitMQ configuration -At PubSub should be created set of topics and subscriptions. +At RabbitMQ should be created set of exchanges and queues. -| topic name | subscription name pattern | description | sensitive? | -|-------------------------------------------------------|--------------------------------------------------|----------------------------------------------------------|------------| -| `register-subscriber-control` | `notification-control-topic-{data-partition-id}` | Register subscriber control topic | yes | -| `{topic-name}` e.g. `records-changed` | `notification-{topic-name}-service` | Service topics from `topics.json` on Register service | yes | -| `{topic-name}-publish` e.g. `records-changed-publish` | `notification-{topic-name}-publish}` | Publish topics in relation 1-on-1 for each service topic | yes | +| topic name | subscription name pattern | description | sensitive? | +|-------------------------------------------------------------------------|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------| +| `register-subscriber-control` | `notification-control-topic-{data-partition-id}` | Register subscriber control topic | yes | +| `register-subscriber-control-exchange` | `notification-control-topic-{data-partition-id}` | Register subscriber control delay topic | yes | +| `{topic-name}` e.g. `records-changed` | `notification-{topic-name}-service` | Service topics from [topics.json](https://community.opengroup.org/osdu/platform/system/register/-/blob/master/provider/register-gc/src/main/resources/topics.json) on Register service | yes | +| `{topic-name}-exchange` e.g. `records-changed-exchange` | `notification-{topic-name}-service` | Service delay topics from [topics.json](https://community.opengroup.org/osdu/platform/system/register/-/blob/master/provider/register-gc/src/main/resources/topics.json) on Register service | yes | +| `{topic-name}-publish` e.g. `records-changed-publish` | `notification-{topic-name}-publish` | Publish topics in relation 1-on-1 for each service topic | yes | +| `{topic-name}-publish-exchange` e.g. `records-changed-publish-exchange` | `notification-{topic-name}-publish` | Publish delay topics in relation 1-on-1 for each service topic | yes | Control topic name can be overridden by: @@ -223,6 +226,12 @@ Control topic name can be overridden by:  +### Important. Dead lettering configuration + +For every service exchange special delay exchange with postfix `-exchange` +and type `x-delayed-message` should exist. +Retries and delays configured by `rabbitmqRetryLimit` and `rabbitmqRetryDelay` OQM properties. + ## Keycloak configuration [Keycloak service accounts setup](https://www.keycloak.org/docs/latest/server_admin/#_service_accounts) diff --git a/provider/notification-gc/docs/gc/README.md b/provider/notification-gc/docs/gc/README.md index 1e128086154024f8664eff36cc0d11d5a520a575..992d4ed8a4596962bdb2cc4a33cc8a2042170853 100644 --- a/provider/notification-gc/docs/gc/README.md +++ b/provider/notification-gc/docs/gc/README.md @@ -114,14 +114,34 @@ $ (cd notification-core/ && mvn clean install) At PubSub should be created set of topics and subscriptions. (see [Overview](#overview)) -| topic name | subscription name pattern | description | sensitive? | -|-------------------------------------------------------|--------------------------------------------------|----------------------------------------------------------|------------| -| `register-subscriber-control` | `notification-control-topic-{data-partition-id}` | Register subscriber control topic | yes | -| `{topic-name}` e.g. `records-changed` | `notification-{topic-name}-service` | Service topics from `topics.json` on Register service | yes | -| `{topic-name}-publish` e.g. `records-changed-publish` | `notification-{topic-name}-publish}` | Publish topics in relation 1-on-1 for each service topic | yes | +| topic name | subscription name pattern | description | sensitive? | +|-------------------------------------------------------|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------| +| `register-subscriber-control` | `notification-control-topic-{data-partition-id}` | Register subscriber control topic | yes | +| `{topic-name}` e.g. `records-changed` | `notification-{topic-name}-service` | Service topics from [topics.json](https://community.opengroup.org/osdu/platform/system/register/-/blob/master/provider/register-gc/src/main/resources/topics.json) on Register service | yes | +| `{topic-name}-publish` e.g. `records-changed-publish` | `notification-{topic-name}-publish}` | Publish topics in relation 1-on-1 for each service topic | yes | Control topic name can be overridden by: * through the Spring Boot property `oqm-register-subscriber-control-topic-name` * environment variable `OQM_REGISTER_SUBSCRIBER_CONTROL_TOPIC_NAME` + +### Important. Dead lettering configuration + +Default values of subscription settings `Dead lettering = Disabled`, +and `Retry policy = Retry immediately` leads to a **significant increase in paying bills**. + +To avoid such a situation need to configure the dead letter topic and set +parameters: +- Maximum delivery attempts = 5 +- Retry policy = Retry after exponential backoff delay +- Minimum backoff duration = 10 seconds +- Maximum backoff duration = 600 seconds + +On the subscription dead lettering settings tab: +- Select an active dead letter topic +- Assign Publisher role +- Assign Subscriber role +- Dead letter topic should not be the source topic + +Notification service uses a common `dead-lettering-notification` topic because dead lettering logic is not supported yet. diff --git a/provider/notification-gc/pom.xml b/provider/notification-gc/pom.xml index a81b7af3b7d6afedd5f3f5eeee502a3d2fb8dc8d..c74cf1f64b60af1910e1fd402246bc0fc467feb5 100644 --- a/provider/notification-gc/pom.xml +++ b/provider/notification-gc/pom.xml @@ -43,11 +43,12 @@ <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>os-core-common</artifactId> + <version>0.21.0-rc4</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gcp</artifactId> - <version>0.20.0-rc1</version> + <artifactId>core-lib-gc</artifactId> + <version>0.21.0-rc4</version> </dependency> <dependency> @@ -112,6 +113,11 @@ <artifactId>jackson-annotations</artifactId> <version>${jackson.version}</version> </dependency> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>oqm</artifactId> + <version>0.21.0-rc3</version> + </dependency> </dependencies> <build> diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/CacheConfig.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/CacheConfig.java index 67e844ae4ec9a4bec853a5163314696419cc132a..24673cf6985135590b59eee2561420f636dcc947 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/CacheConfig.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/config/CacheConfig.java @@ -18,7 +18,10 @@ package org.opengroup.osdu.notification.provider.gcp.config; import lombok.RequiredArgsConstructor; +import org.opengroup.osdu.core.common.cache.ICache; import org.opengroup.osdu.core.common.cache.IRedisCache; +import org.opengroup.osdu.core.common.cache.VmCache; +import org.opengroup.osdu.core.common.partition.PartitionInfo; import org.opengroup.osdu.core.gcp.cache.RedisCacheBuilder; import org.opengroup.osdu.notification.provider.gcp.model.ExternalSubscriptions; import org.springframework.context.annotation.Bean; @@ -42,4 +45,9 @@ public class CacheConfig { ExternalSubscriptions.class ); } + + @Bean + public ICache<String, PartitionInfo> partitionInfoCache() { + return new VmCache<>(600, 2000); + } } \ No newline at end of file diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriptionProvider.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriptionProvider.java index e3a59167cf31d7b36914c0e79ce1df6f3efe5c0d..fb0daad8697a47c723f3187fdb29452de2355e68 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriptionProvider.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriptionProvider.java @@ -2,7 +2,6 @@ package org.opengroup.osdu.notification.provider.gcp.pubsub; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; import org.opengroup.osdu.core.common.model.tenant.TenantInfo; import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory; import org.opengroup.osdu.core.gcp.oqm.driver.OqmDriver; @@ -13,6 +12,7 @@ import org.opengroup.osdu.notification.provider.gcp.config.OqmConfigurationPrope import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; +import javax.validation.constraints.NotNull; import java.util.Collections; import java.util.List; diff --git a/provider/notification-gc/src/main/resources/application.properties b/provider/notification-gc/src/main/resources/application.properties index 0b2d7993f8df49644a0d0d8641f837dea729c739..8cc65690eda213d5ae3b56e1406d62de56f168b1 100644 --- a/provider/notification-gc/src/main/resources/application.properties +++ b/provider/notification-gc/src/main/resources/application.properties @@ -48,3 +48,5 @@ redis-port=${REDIS_USER_INFO_PORT:6379} redis-password=${REDIS_USER_INFO_PASSWORD:} redis-with-ssl=${REDIS_USER_INFO_WITH_SSL:false} cache.codec=jackson + +propertyResolver.strategy=partition \ No newline at end of file