From c49d0082cafea97b5f1c783b43b938fb1fb737f5 Mon Sep 17 00:00:00 2001 From: samuelim01 <61283948+samuelim01@users.noreply.github.com> Date: Mon, 11 Nov 2024 03:30:42 +0800 Subject: [PATCH] Rename Match Queue (#88) * Rename match queue * oops --- services/match/README.md | 8 ++++---- services/match/src/events/consumer.ts | 2 +- services/match/src/events/producer.ts | 2 +- services/match/src/events/queues.ts | 2 +- services/question/src/events/queues.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/services/match/README.md b/services/match/README.md index f9bd326e72..c02dcd6105 100644 --- a/services/match/README.md +++ b/services/match/README.md @@ -225,10 +225,10 @@ docker compose down -v ## Producers -### Match Request Updated Producer +### Match Request Created Producer - This producer emits a message when a match request has been created or updated. -- **Queue**: `MATCH_REQUEST_UPDATED` +- **Queue**: `MATCH_REQUEST_CREATED` - **Data Produced** - `user` - The user associated with the created or updated match request. - `topics` - The topics of the created or updated match request. @@ -279,12 +279,12 @@ docker compose down -v ## Consumers -### Match Request Updated Consumer +### Match Request Created Consumer - This consumer attempts to find and assign a compatible match request based on their preferences (topics and difficulty) upon the update of a given match request. - Two match requests are said to be compatible if they share the same difficulty and have at least one topic in common. - Upon successfully finding a match, it produces a `MATCH_FOUND` event. -- **Queue**: `MATCH_REQUEST_UPDATED` - This message is emitted when a match request is created or updated. +- **Queue**: `MATCH_REQUEST_CREATED` - This message is emitted when a match request is created or updated. - **Data Consumed** - `user` - The user associated with the created or updated match request. - `topics` - The topics of the created or updated match request. diff --git a/services/match/src/events/consumer.ts b/services/match/src/events/consumer.ts index cbd2798ca6..9dcdfee094 100644 --- a/services/match/src/events/consumer.ts +++ b/services/match/src/events/consumer.ts @@ -55,7 +55,7 @@ async function consumeMatchFailed(msg: MatchFailedEvent) { } export async function initializeConsumers() { - messageBroker.consume(Queues.MATCH_REQUEST_UPDATED, consumeMatchUpdated); + messageBroker.consume(Queues.MATCH_REQUEST_CREATED, consumeMatchUpdated); messageBroker.consume(Queues.COLLAB_CREATED, consumeCollabCreated); messageBroker.consume(Queues.MATCH_FAILED, consumeMatchFailed); } diff --git a/services/match/src/events/producer.ts b/services/match/src/events/producer.ts index e217ef8da7..8d9c736d32 100644 --- a/services/match/src/events/producer.ts +++ b/services/match/src/events/producer.ts @@ -16,7 +16,7 @@ export async function produceMatchUpdatedRequest( topics, difficulty, }; - await messageBroker.produce(Queues.MATCH_REQUEST_UPDATED, message); + await messageBroker.produce(Queues.MATCH_REQUEST_CREATED, message); } export async function produceMatchFound(user1: any, user2: any, topics: string[], difficulty: Difficulty) { diff --git a/services/match/src/events/queues.ts b/services/match/src/events/queues.ts index 87a52f366f..8943b9431f 100644 --- a/services/match/src/events/queues.ts +++ b/services/match/src/events/queues.ts @@ -1,5 +1,5 @@ export enum Queues { - MATCH_REQUEST_UPDATED = 'MATCH_REQUEST_UPDATED', + MATCH_REQUEST_CREATED = 'MATCH_REQUEST_CREATED', MATCH_FOUND = 'MATCH_FOUND', QUESTION_FOUND = 'QUESTION_FOUND', COLLAB_CREATED = 'COLLAB_CREATED', diff --git a/services/question/src/events/queues.ts b/services/question/src/events/queues.ts index 87a52f366f..8943b9431f 100644 --- a/services/question/src/events/queues.ts +++ b/services/question/src/events/queues.ts @@ -1,5 +1,5 @@ export enum Queues { - MATCH_REQUEST_UPDATED = 'MATCH_REQUEST_UPDATED', + MATCH_REQUEST_CREATED = 'MATCH_REQUEST_CREATED', MATCH_FOUND = 'MATCH_FOUND', QUESTION_FOUND = 'QUESTION_FOUND', COLLAB_CREATED = 'COLLAB_CREATED',