-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix/64795 ps report issue friday 7th june (#2808)
* small refactor * Lint fix * Remove ps-report-staging-start message send function * Fold the transformer step into the ps-report-2 pupil data function to save a step * Send the staging start message from ps-report-1 rather than ps-report-2
- Loading branch information
1 parent
78e3392
commit 0d707cb
Showing
38 changed files
with
87 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
import { ServiceBusClient } from '@azure/service-bus' | ||
import config from '../pupil-api/config' | ||
import { type ServiceBusQueueName } from './service-bus-queue.names' | ||
import { ServiceBusAdministrationClient, ServiceBusClient } from '@azure/service-bus' | ||
|
||
export interface IServiceBusQueueService { | ||
dispatch (message: IServiceBusQueueMessage, queueName: string): Promise<void> | ||
getActiveMessageCount (queueName: ServiceBusQueueName): Promise<number> | ||
} | ||
|
||
export interface IServiceBusQueueMessage { | ||
body: any | ||
messageId?: string | ||
contentType?: string | ||
} | ||
|
||
export class ServiceBusQueueService implements IServiceBusQueueService { | ||
private readonly serviceBusClient: ServiceBusClient | ||
private readonly serviceBusAdministrationClient: ServiceBusAdministrationClient | ||
|
||
constructor () { | ||
if (config.ServiceBus.connectionString === undefined) { | ||
throw new Error('Azure Service Bus Connection String missing') | ||
} | ||
this.serviceBusClient = new ServiceBusClient(config.ServiceBus.connectionString) | ||
this.serviceBusAdministrationClient = new ServiceBusAdministrationClient(config.ServiceBus.connectionString) | ||
} | ||
|
||
async dispatch (message: IServiceBusQueueMessage, queueName: ServiceBusQueueName): Promise<void> { | ||
const sender = this.serviceBusClient.createSender(queueName.toString()) | ||
await sender.sendMessages(message) | ||
return sender.close() | ||
} | ||
|
||
async getActiveMessageCount (queueName: ServiceBusQueueName): Promise<number> { | ||
const queueRuntimeProperties = await this.serviceBusAdministrationClient.getQueueRuntimeProperties(queueName.toString()) | ||
const msgCount = queueRuntimeProperties.activeMessageCount | ||
if (msgCount === undefined || msgCount === null) { | ||
return -1 | ||
} | ||
return msgCount | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../ps-report-3-transformer/mocks/answers.ts → ...t/ps-report-2-pupil-data/mocks/answers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eport-3-transformer/mocks/check-config.ts → ...report-2-pupil-data/mocks/check-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-report-3-transformer/mocks/check-form.ts → ...s-report-2-pupil-data/mocks/check-form.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t-3-transformer/mocks/check-incomplete.ts → ...rt-2-pupil-data/mocks/check-incomplete.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rt/ps-report-3-transformer/mocks/check.ts → ...ort/ps-report-2-pupil-data/mocks/check.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/ps-report-3-transformer/mocks/device.ts → ...rt/ps-report-2-pupil-data/mocks/device.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/ps-report-3-transformer/mocks/events.ts → ...rt/ps-report-2-pupil-data/mocks/events.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...complete-and-restart-available-corrupt.ts → ...complete-and-restart-available-corrupt.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mer/mocks/pupil-not-attending-annulled.ts → ...ata/mocks/pupil-not-attending-annulled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rmer/mocks/pupil-not-attending-corrupt.ts → ...data/mocks/pupil-not-attending-corrupt.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-transformer/mocks/pupil-not-attending.ts → ...2-pupil-data/mocks/pupil-not-attending.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rmer/mocks/pupil-who-completed-a-check.ts → ...data/mocks/pupil-who-completed-a-check.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rmer/mocks/pupil-with-incomplete-check.ts → ...data/mocks/pupil-with-incomplete-check.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/ps-report-3-transformer/mocks/school.ts → ...rt/ps-report-2-pupil-data/mocks/school.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.