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

Rename Match Queue #88

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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