@@ -348,14 +348,16 @@ curl -X PATCH http://localhost:8080/api/collaboration/room/6724e9d892fb3e9f04c2e
348
348
## Documentation on Queue (RabbitMQ)
349
349
350
350
The collaboration service uses RabbitMQ as a message broker to facilitate communication between microservices (such as
351
- the ` matching service ` and ` collaboration service ` ) in an asynchronous manner. The system consists of a consumer and two
351
+ the ` matching service ` and ` collaboration service ` ) in an asynchronous manner. The system consists of a consumer and four
352
352
producers:
353
353
354
354
### Queues Used
355
355
356
356
- ` QUESTION_FOUND ` : Handles messages related to matching users and creating collaboration rooms.
357
357
- ` COLLAB_CREATED ` : Sends messages indicating that a collaboration room has been successfully created.
358
358
- ` MATCH_FAILED ` : Sends messages indicating that a collaboration room could not be created.
359
+ - ` CREATE_HISTORY ` : Sends messages requesting that user history be created for the new collaboration room.
360
+ - ` UPDATE_HISTORY ` : Sends messages requesting that user history be updated for the new collaboration room.
359
361
360
362
---
361
363
@@ -393,6 +395,53 @@ The producer will send a message to the `MATCH_FAILED` queue when a collaboratio
393
395
}
394
396
```
395
397
398
+ The producer will send a message to the ` CREATE_HISTORY ` queue when a collaboration room was created successfully.
399
+
400
+ - ** Queue** : ` CREATE_HISTORY `
401
+ - ** Data Produced**
402
+ - ` roomId ` - The ID of the collaboration room.
403
+ - ` user1 ` - The first user associated with the collaboration room.
404
+ - ` user2 ` - The second user associated with the collaboration room.
405
+ - ` question ` - The question associated with the collaboration room.
406
+
407
+ ``` json
408
+ {
409
+ "roomId" : " 67234d29aa52f2376973f96a" ,
410
+ "user1" : {
411
+ "username" : " user123" ,
412
+ "_id" : " 671a064a6f536e9af46b0017"
413
+ },
414
+ "user2" : {
415
+ "username" : " userabc" ,
416
+ "_id" : " 671a06526f536e9af46b001f"
417
+ },
418
+ "question" : {
419
+ "id" : 1 ,
420
+ "title" : " Roman to Integer" ,
421
+ "description" : " Given a roman numeral, convert it to an integer." ,
422
+ "topics" : [ " Algorithms" ],
423
+ "difficulty" : " Easy" ,
424
+ "_id" : " 671a0615dc63fe2d5f3bbae5"
425
+ },
426
+ },
427
+ ```
428
+
429
+ The producer will send a message to the ` UPDATE_HISTORY ` queue when a user forfeits or completes a collaborative session.
430
+
431
+ - ** Queue** : ` UPDATE_HISTORY `
432
+ - ** Data Produced**
433
+ - ` roomId ` - The ID of the collaboration room.
434
+ - ` userId ` - The user associated with the update.
435
+ - ` status ` - The new status associated with the collaboration room. It may be ` "IN_PROGRESS" ` , ` "FORFEITED" ` , or ` "COMPLETED" ` .
436
+
437
+ ``` json
438
+ {
439
+ "roomId" : " 67234d29aa52f2376973f96a" ,
440
+ "userId" : " 671a064a6f536e9af46b0017" ,
441
+ "status" : " FORFEITED"
442
+ },
443
+ ```
444
+
396
445
---
397
446
398
447
## Consumer
0 commit comments