Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWATCH-2356: Send request to enabled-orgs-for-tasks for prune and sync #3277

Merged
merged 1 commit into from
May 2, 2024

Conversation

Sgitario
Copy link
Contributor

Jira issue: SWATCH-2356

Description

  • The method "pruneUnlistedSubscriptions" from SWATCH-2277 should produce a single message to "platform.rhsm-subscriptions.enabled-orgs-for-tasks" with a message containing the topic name "platform.rhsm-subscriptions.subscription-prune-task".
  • The method "syncAllSubscriptions" from SWATCH-2277 should produce a single message to "platform.rhsm-subscriptions.enabled-orgs-for-tasks" with a message containing the topic name "platform.rhsm-subscriptions.subscription-sync-task".
  • Create the consumer of "platform.rhsm-subscriptions.subscription-prune-task" that receives a message that includes the orgId. Leave the implementation empty.
  • Create the consumer of "platform.rhsm-subscriptions.subscription-sync-task" that receives a message that includes the orgId. Leave the implementation empty.

Testing

1.- podman-compose up
2.- start tally:

DEV_MODE=true SPRING_PROFILES_ACTIVE=worker ./gradlew :bootRun

3.- populate some enabled orgs:

INSERT INTO org_config(org_id, opt_in_type, created, updated) VALUES('org1', 'API', now(), now());
INSERT INTO org_config(org_id, opt_in_type, created, updated) VALUES('org2', 'API', now(), now());
INSERT INTO org_config(org_id, opt_in_type, created, updated) VALUES('org3', 'API', now(), now());

4.- start contracts service:

SERVER_PORT=8001 QUARKUS_MANAGEMENT_PORT=9001 ./gradlew :swatch-contracts:quarkusDev

5.- start subscriptions prune task:

curl -X DELETE http://localhost:8001/api/swatch-contracts/internal/subscriptions/prune

Verification: you should see the following traces in the contracts service:

2024-04-22 12:58:33,591 INFO  [com.red.swa.con.ser.SubscriptionPruneTaskConsumer] (vert.x-eventloop-thread-2) {sampled=true, spanId=704b47c251d90584, traceId=9f025d6524c19345c352f63a90038edc} Received task for subscription prune with org ID: org2
2024-04-22 12:58:33,617 INFO  [com.red.swa.con.ser.SubscriptionPruneTaskConsumer] (vert.x-eventloop-thread-2) {sampled=true, spanId=c67d5f89d66c21b3, traceId=525dbd269276d86683741c3babda5096} Received task for subscription prune with org ID: org1
2024-04-22 12:58:33,621 INFO  [com.red.swa.con.ser.SubscriptionPruneTaskConsumer] (vert.x-eventloop-thread-2) {sampled=true, spanId=59ff7779ae66dd9f, traceId=991b00e758fe03e8b637997fa35567a7} Received task for subscription prune with org ID: org3

6.- start subscriptions sync task:

curl -X PUT http://localhost:8001/api/swatch-contracts/internal/rpc/subscriptions/sync?forceSync=true

Verification: you should see the following traces in the contracts service:

2024-04-22 13:03:41,989 INFO  [com.red.swa.con.ser.SubscriptionSyncTaskConsumer] (vert.x-eventloop-thread-0) {sampled=true, spanId=88f9384fe792ddec, traceId=28e4d858dbedabf09e57c4ddeb0880ff} Received task for subscription sync with org ID: org2
2024-04-22 13:03:42,004 INFO  [com.red.swa.con.ser.SubscriptionSyncTaskConsumer] (vert.x-eventloop-thread-0) {sampled=true, spanId=df381ff8505e1515, traceId=0e93647077b0fdde011928108c962dca} Received task for subscription sync with org ID: org1
2024-04-22 13:03:42,008 INFO  [com.red.swa.con.ser.SubscriptionSyncTaskConsumer] (vert.x-eventloop-thread-0) {sampled=true, spanId=f14bacd241323115, traceId=bf296a85e11219eb9e778686053fb6f3} Received task for subscription sync with org ID: org3

@Sgitario Sgitario added QE Pull request should be approved by QE before merge Dev Pull requests that need developer review labels Apr 22, 2024
@kartikshahc kartikshahc self-assigned this Apr 22, 2024
@kartikshahc kartikshahc self-requested a review April 22, 2024 15:10
@Sgitario
Copy link
Contributor Author

/retest

@Aurobinda55 Aurobinda55 self-requested a review April 24, 2024 10:45
@Aurobinda55
Copy link

/retest

1 similar comment
@Sgitario
Copy link
Contributor Author

/retest

@kartikshahc
Copy link
Contributor

Steps are performing as described. Looking into few things in code.

@Sgitario Sgitario force-pushed the jcarvaja/SWATCH-2356 branch 2 times, most recently from 0eb8917 to 9e17267 Compare April 25, 2024 07:18
@Aurobinda55
Copy link

Verification steps:

  • Added one org in org_config
  • Called subscriptions/prune api and received the below logs in contract service
    2024-04-25 07:32:25,704 INFO [com.red.swa.con.ser.SubscriptionPruneTaskConsumer] (vert.x-eventloop-thread-1) {sampled=true, spanId=6279f5906f82e0ba, traceId=1e0b3573570fb704d0fd028a6c2c9e18} Received task for subscription prune with org ID: 14541308
  • Again called the subscription sync service and got the below logs
    2024-04-25 07:34:14,163 INFO [com.red.swa.con.ser.SubscriptionSyncTaskConsumer] (vert.x-eventloop-thread-0) {sampled=true, spanId=9c51d2ff03b27346, traceId=53ed63080ba5ffd8a629c5eab0a27058} Received task for subscription sync with org ID: 14541308

Looks good to me

@Aurobinda55
Copy link

@ntkathole ntkathole added QE/approved Pull requests that have been approved by all assigned QEs and removed QE Pull request should be approved by QE before merge labels Apr 30, 2024
@kartikshahc kartikshahc added Dev/approved Pull requests that have been approved by all assigned developers and removed Dev Pull requests that need developer review labels May 1, 2024
- The method "pruneUnlistedSubscriptions" from SWATCH-2277 should produce a single message to "platform.rhsm-subscriptions.enabled-orgs-for-tasks" with a message containing the topic name "platform.rhsm-subscriptions.subscription-prune-task".
- The method "syncAllSubscriptions" from SWATCH-2277 should produce a single message to "platform.rhsm-subscriptions.enabled-orgs-for-tasks" with a message containing the topic name "platform.rhsm-subscriptions.subscription-sync-task".
- Create the consumer of "platform.rhsm-subscriptions.subscription-prune-task" that receives a message that includes the orgId. Leave the implementation empty.
- Create the consumer of "platform.rhsm-subscriptions.subscription-sync-task" that receives a message that includes the orgId. Leave the implementation empty.
@Sgitario Sgitario merged commit 4449f2c into main May 2, 2024
5 checks passed
@Sgitario Sgitario deleted the jcarvaja/SWATCH-2356 branch May 2, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev/approved Pull requests that have been approved by all assigned developers QE/approved Pull requests that have been approved by all assigned QEs
Projects
None yet
4 participants