From c3e14050c588983f8895a2dd459bace3533a3481 Mon Sep 17 00:00:00 2001 From: Dheepak Ramanathan <54600590+dheepak-aot@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:20:19 -0600 Subject: [PATCH] #1652 - Update Scheduler Cron Job (#3659) # Update the Scheduler Cron Configuration ## Updated scheduler Cron As per the ticket, the scheduler cron values have been updated after converting the given PST time in the ticket to UTC time. | Scheduler | PST TIME | UTC TIME | CRON EXPRESSION | | ------------------------------------------------ | -------- | -------- | --------------------- | | ier12-integration | \- | \- | `15/30 * * * *` | | | | | | | cra-process-integration | 21:00 | 05:00 | `0 5 * * *` | | cra-response-integration | 08:00 | 16:00 | `0 16 * * *` | | | | | | | sin-validation-process-integration | 06:00 | 14:00 | `0 14 * * *` | | sin-validation-response-integration | 06:00 | 14:00 | `0 14 * * *` | | | | | | | part-time-msfaa-process-integration | 00:00 | 08:00 | `0 8 * * *` | | | | | | | part-time-e-cert-integration | 00:00 | 08:00 | `0 8 * * *` | | part-time-feedback-integration | 04:00 | 12:00 | `0 12 * * *` | | | | | | | full-time-msfaa-integration | 01:00 | 09:00 | `0 9 * * *` | | | | | | | full-time-e-cert-integration | 22:00 | 06:00 | `0 6 * * *` | | full-time-feedback-integration | 12:00 | 20:00 | `0 20 * * *` | | | | | | | federal-restrictions-integration | 05:00 | 13:00 | `0 13 * * *` | | | | | | | full-time-disbursement-receipts-file-integration | 10:30 | 18:30 | `30 18 * * *` | | | | | | | ece-process-integration | 22:00 | 06:00 | `0 6 * * *` | | ece-process-response-integration | 01:45 | 09:45 | `45 09 * * *` | | | | | | | part-time-msfaa-process-response-integration | 04:00 | 12:00 | `0 12 * * *` | | full-time-msfaa-process-response-integration | 09:15 | 17:15 | `15 17 * * *` | | | | | | | student-loan-balances-part-time-integration | 22:30 | 06:30 | `30 6 * * *` | | sfas-integration | - | - | `15/30 * * * *` | ## Existing cron ![image](https://github.com/user-attachments/assets/29f131ec-5019-485d-8121-0731424f4a7c) ## PR Highlights - [x] Updated a particular property of JSONB column using `jsonb_set` ![image](https://github.com/user-attachments/assets/0c03d9c5-f285-4404-b6f9-e149a94c7a50) - [x] SIN validation response processing was using the queue name `sin-validation-request-integration` and respective scheduler name. Both queue names and scheduler names have been updated. ## Migration Rollback ![image](https://github.com/user-attachments/assets/a331eacc-9f6e-4e12-832e-9610948caeca) ![image](https://github.com/user-attachments/assets/bc357a72-a8c0-4945-b4e0-c054ff1c7c9f) ![image](https://github.com/user-attachments/assets/176312d6-35c9-4dd0-8395-747e4c19d731) --- ...614598-UpdateConfigurationSchedulerCron.ts | 21 ++ ...391-UpdateQueueNameSINValidationRequest.ts | 21 ++ ...ck-update-configuration-scheduler-cron.sql | 227 ++++++++++++++++++ ...date-queue-name-sin-validation-request.sql | 6 + .../Update-configuration-scheduler-cron.sql | 227 ++++++++++++++++++ ...date-queue-name-sin-validation-request.sql | 6 + ...-process-response-integration.scheduler.ts | 6 +- .../src/queue-consumers.module.ts | 4 +- .../libs/utilities/src/queue.constant.ts | 2 +- 9 files changed, 514 insertions(+), 6 deletions(-) create mode 100644 sources/packages/backend/apps/db-migrations/src/migrations/1724722614598-UpdateConfigurationSchedulerCron.ts create mode 100644 sources/packages/backend/apps/db-migrations/src/migrations/1724724771391-UpdateQueueNameSINValidationRequest.ts create mode 100644 sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-configuration-scheduler-cron.sql create mode 100644 sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-queue-name-sin-validation-request.sql create mode 100644 sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-configuration-scheduler-cron.sql create mode 100644 sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-queue-name-sin-validation-request.sql diff --git a/sources/packages/backend/apps/db-migrations/src/migrations/1724722614598-UpdateConfigurationSchedulerCron.ts b/sources/packages/backend/apps/db-migrations/src/migrations/1724722614598-UpdateConfigurationSchedulerCron.ts new file mode 100644 index 0000000000..6a1c22913a --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/migrations/1724722614598-UpdateConfigurationSchedulerCron.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; +import { getSQLFileData } from "../utilities/sqlLoader"; + +export class UpdateConfigurationSchedulerCron1724722614598 + implements MigrationInterface +{ + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + getSQLFileData("Update-configuration-scheduler-cron.sql", "Queue"), + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + getSQLFileData( + "Rollback-update-configuration-scheduler-cron.sql", + "Queue", + ), + ); + } +} diff --git a/sources/packages/backend/apps/db-migrations/src/migrations/1724724771391-UpdateQueueNameSINValidationRequest.ts b/sources/packages/backend/apps/db-migrations/src/migrations/1724724771391-UpdateQueueNameSINValidationRequest.ts new file mode 100644 index 0000000000..260fdc5381 --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/migrations/1724724771391-UpdateQueueNameSINValidationRequest.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; +import { getSQLFileData } from "../utilities/sqlLoader"; + +export class UpdateQueueNameSINValidationRequest1724724771391 + implements MigrationInterface +{ + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + getSQLFileData("Update-queue-name-sin-validation-request.sql", "Queue"), + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + getSQLFileData( + "Rollback-update-queue-name-sin-validation-request.sql", + "Queue", + ), + ); + } +} diff --git a/sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-configuration-scheduler-cron.sql b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-configuration-scheduler-cron.sql new file mode 100644 index 0000000000..748ab4cd2f --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-configuration-scheduler-cron.sql @@ -0,0 +1,227 @@ +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'ier12-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 2,8,14,20 * * *"', + false + ) +where + queue_name = 'cra-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 5,11,17,23 * * *"', + false + ) +where + queue_name = 'cra-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'sin-validation-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'sin-validation-request-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'part-time-msfaa-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'part-time-e-cert-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'part-time-feedback-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'full-time-msfaa-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'full-time-e-cert-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'full-time-feedback-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 11 * * *"', + false + ) +where + queue_name = 'federal-restrictions-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'disbursement-receipts-file-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'ece-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'ece-process-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'part-time-msfaa-process-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'full-time-msfaa-process-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 17 * * *"', + false + ) +where + queue_name = 'student-loan-balances-part-time-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 12 * * *"', + false + ) +where + queue_name = 'sfas-integration'; \ No newline at end of file diff --git a/sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-queue-name-sin-validation-request.sql b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-queue-name-sin-validation-request.sql new file mode 100644 index 0000000000..7b90001b39 --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Rollback-update-queue-name-sin-validation-request.sql @@ -0,0 +1,6 @@ +update + sims.queue_configurations +set + queue_name = 'sin-validation-request-integration' +where + queue_name = 'sin-validation-response-integration'; \ No newline at end of file diff --git a/sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-configuration-scheduler-cron.sql b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-configuration-scheduler-cron.sql new file mode 100644 index 0000000000..7f5acb068d --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-configuration-scheduler-cron.sql @@ -0,0 +1,227 @@ +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"15/30 * * * *"', + false + ) +where + queue_name = 'ier12-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 5 * * *"', + false + ) +where + queue_name = 'cra-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 16 * * *"', + false + ) +where + queue_name = 'cra-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'sin-validation-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 14 * * *"', + false + ) +where + queue_name = 'sin-validation-request-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 8 * * *"', + false + ) +where + queue_name = 'part-time-msfaa-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 8 * * *"', + false + ) +where + queue_name = 'part-time-e-cert-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 12 * * *"', + false + ) +where + queue_name = 'part-time-feedback-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 9 * * *"', + false + ) +where + queue_name = 'full-time-msfaa-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 6 * * *"', + false + ) +where + queue_name = 'full-time-e-cert-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 20 * * *"', + false + ) +where + queue_name = 'full-time-feedback-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 13 * * *"', + false + ) +where + queue_name = 'federal-restrictions-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"30 18 * * *"', + false + ) +where + queue_name = 'disbursement-receipts-file-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 6 * * *"', + false + ) +where + queue_name = 'ece-process-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"45 09 * * *"', + false + ) +where + queue_name = 'ece-process-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"0 12 * * *"', + false + ) +where + queue_name = 'part-time-msfaa-process-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"15 17 * * *"', + false + ) +where + queue_name = 'full-time-msfaa-process-response-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"30 6 * * *"', + false + ) +where + queue_name = 'student-loan-balances-part-time-integration'; + +update + sims.queue_configurations +set + queue_configuration = jsonb_set( + queue_configuration, + '{cron}', + '"15/30 * * * *"', + false + ) +where + queue_name = 'sfas-integration'; \ No newline at end of file diff --git a/sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-queue-name-sin-validation-request.sql b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-queue-name-sin-validation-request.sql new file mode 100644 index 0000000000..baaf2575b9 --- /dev/null +++ b/sources/packages/backend/apps/db-migrations/src/sql/Queue/Update-queue-name-sin-validation-request.sql @@ -0,0 +1,6 @@ +update + sims.queue_configurations +set + queue_name = 'sin-validation-response-integration' +where + queue_name = 'sin-validation-request-integration'; \ No newline at end of file diff --git a/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/esdc-integration/sin-validation-integration/sin-validation-process-response-integration.scheduler.ts b/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/esdc-integration/sin-validation-integration/sin-validation-process-response-integration.scheduler.ts index 4271773ea6..a8464a0b1c 100644 --- a/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/esdc-integration/sin-validation-integration/sin-validation-process-response-integration.scheduler.ts +++ b/sources/packages/backend/apps/queue-consumers/src/processors/schedulers/esdc-integration/sin-validation-integration/sin-validation-process-response-integration.scheduler.ts @@ -8,10 +8,10 @@ import { QueueProcessSummary } from "../../../models/processors.models"; import { BaseScheduler } from "../../base-scheduler"; import { ProcessResponseQueue } from "../models/esdc.models"; -@Processor(QueueNames.SINValidationRequestIntegration) -export class SINValidationRequestIntegrationScheduler extends BaseScheduler { +@Processor(QueueNames.SINValidationResponseIntegration) +export class SINValidationResponseIntegrationScheduler extends BaseScheduler { constructor( - @InjectQueue(QueueNames.SINValidationRequestIntegration) + @InjectQueue(QueueNames.SINValidationResponseIntegration) schedulerQueue: Queue, queueService: QueueService, private readonly sinValidationProcessingService: SINValidationProcessingService, diff --git a/sources/packages/backend/apps/queue-consumers/src/queue-consumers.module.ts b/sources/packages/backend/apps/queue-consumers/src/queue-consumers.module.ts index 281a918a8f..3d14eb68e5 100644 --- a/sources/packages/backend/apps/queue-consumers/src/queue-consumers.module.ts +++ b/sources/packages/backend/apps/queue-consumers/src/queue-consumers.module.ts @@ -8,7 +8,7 @@ import { CRAResponseIntegrationScheduler, CRAProcessIntegrationScheduler, SINValidationProcessIntegrationScheduler, - SINValidationRequestIntegrationScheduler, + SINValidationResponseIntegrationScheduler, StudentLoanBalancesPartTimeIntegrationScheduler, FullTimeMSFAAProcessIntegrationScheduler, PartTimeMSFAAProcessIntegrationScheduler, @@ -114,7 +114,7 @@ import { CASService } from "@sims/integrations/cas/cas.service"; SequenceControlService, WorkflowClientService, SINValidationProcessIntegrationScheduler, - SINValidationRequestIntegrationScheduler, + SINValidationResponseIntegrationScheduler, StudentLoanBalancesPartTimeIntegrationScheduler, FullTimeMSFAAProcessIntegrationScheduler, MSFAANumberService, diff --git a/sources/packages/backend/libs/utilities/src/queue.constant.ts b/sources/packages/backend/libs/utilities/src/queue.constant.ts index 60ad6ec453..b76ad130c5 100644 --- a/sources/packages/backend/libs/utilities/src/queue.constant.ts +++ b/sources/packages/backend/libs/utilities/src/queue.constant.ts @@ -9,7 +9,7 @@ export enum QueueNames { CRAProcessIntegration = "cra-process-integration", CRAResponseIntegration = "cra-response-integration", SINValidationProcessIntegration = "sin-validation-process-integration", - SINValidationRequestIntegration = "sin-validation-request-integration", + SINValidationResponseIntegration = "sin-validation-response-integration", PartTimeMSFAAProcessIntegration = "part-time-msfaa-process-integration", PartTimeECertIntegration = "part-time-e-cert-integration", PartTimeFeedbackIntegration = "part-time-feedback-integration",