Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-40626

DB listen and notify the endpoints about the token update

XMLWordPrintable

    • Product / Portfolio Work
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • Unset
    • None
    • A&M Tech Debt Sprint Q3 2025, Access & Management Sprint 115, Access & Management Sprint 116, Access & Management Sprint 117, Access & Management Sprint 118

      Once the token is updated, db listen and notify the endpoints about the token is ready, and let the endpoints return the updated token

       

      This refers to this solution: https://docs.google.com/document/d/10_CiuaUxkMhNl0kks6Zz9BHS8GFDq7ZnSePcOXx4jVc/edit?tab=t.0#bookmark=id.2342cubplyfv

       

      This is requires changes in workspace creation*(RBAC API)* action and in RBAC Kafka consumer.

      Algorithm:

      1. Write to model & outbox (w/ some request ID) (RBAC API)
      2. SQL LISTEN for corresponding NOTIFY to come for that request ID (RBAC API)
      3. [concurrently]
      4. RBAC Kafka consumer IN RBAC picks this up from topic(debezium+outbox)
      5. RBAC writes this to Relations and in that response gets a ktn(RBAC Kafka consumer)
      6. RBAC then writes the ktn for the org (tenant) for this update and NOTIFY-ies the db with that request ID (RBAC Kafka consumer)
      1. Request picks up the NOTIFY, and responds to the user (RBAC API)

       

      Change for RBAC API

      Point 1. is existing part, point 2. and 4 is needed in RBAC API.

      RBAC API request goes through layers: View -> Serializer -> Service -> ORM

      For this case workspace creation action starts in workspace view : https://github.com/RedHatInsights/insights-rbac/blob/4b7077b31c20fc3a96a653d714714fca725ae450/rbac/management/workspace/view.py#L84

      This calls workspace serializer create  workspace method 

      https://github.com/RedHatInsights/insights-rbac/blob/14c995f111eab853ef238dfdc484e41d0387c371/rbac/management/workspace/serializer.py#L54

       

      which call create on workspace service where can be changes done:

      https://github.com/RedHatInsights/insights-rbac/blob/4b7077b31c20fc3a96a653d714714fca725ae450/rbac/management/workspace/service.py

       

      PSQL listen query needs to be added after outbox message is created & committed  (Point 2.)

      Example of Django code:

      https://docs.google.com/document/d/10_CiuaUxkMhNl0kks6Zz9BHS8GFDq7ZnSePcOXx4jVc/edit?tab=t.0#bookmark=id.ag3xw0pxleid

       

      as RBAC Kafka consumer is not ready, this can be tested with psql command.

      by calling "NOTIFY ... "

      This is code needs to be added under feature flags (RBAC has supported) in order to merge it separately. 

       

      RBAC Kafka consumer

      • point 3, ** Kafka consumer is not available at this moment.

       

       

       

       

       

              Unassigned Unassigned
              rh-ee-zhzeng Jay Zeng
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: