From 393438fd4a4ba9f6fc6a464f7e7a581ff8dfdb94 Mon Sep 17 00:00:00 2001
From: "Dmitrii Novikov (EPAM)" <dmitrii_novikov1@epam.com>
Date: Thu, 27 Apr 2023 13:16:47 +0000
Subject: [PATCH] Updated readme

---
 .../notification-gc/docs/anthos/README.md     | 23 +++++++++-----
 provider/notification-gc/docs/gc/README.md    | 30 +++++++++++++++----
 2 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/provider/notification-gc/docs/anthos/README.md b/provider/notification-gc/docs/anthos/README.md
index 5e1bdf25d..41810569b 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:
 
 ![Screenshot](./pics/rabbit.PNG)
 
+### 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 1e1280861..992d4ed8a 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.
-- 
GitLab