Skip to content

Commit

Permalink
Rename Match Queue (#88)
Browse files Browse the repository at this point in the history
* Rename match queue

* oops
  • Loading branch information
samuelim01 authored Nov 10, 2024
1 parent 86d2601 commit c49d008
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions services/match/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion services/match/src/events/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion services/match/src/events/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion services/match/src/events/queues.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 1 addition & 1 deletion services/question/src/events/queues.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit c49d008

Please sign in to comment.