---
# System prepended metadata

title: Notification service

---

# Notification service

## List of events that notification-service consumes

### 1. Exercise created event

Description: This event is published from exercise service when teacher create an exercise
> exchange name: notification-ex
> exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.created

```Message```

```JSON
    {
        "exercise": {
          "_id": "exerciseId",
          "exercise_name": "layout với CSS",
          "exercise_deadline": 12135155,
          "exercise_type": 'CSS',
          "course_id": "courseId",
          "creator_id": "userId",
          "creator_name": "Nguyễn Đức Huy"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 2. Exercise updated event

Description: This event is published from exercise service when teacher update an exercise
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.update

```Message```

```JSON
    {
        "exercise": {
          "_id": "exerciseId",
          "exercise_name": "layout với CSS",
          "exercise_deadline": 12135155
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 3. Exercise deleted event

Description: This event is published from exercise service when teacher delete an exercise
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.delete

```Message```

```JSON
    {
        "exercise": {
          "_id": "exerciseId"
        },
        "event": {
          "_id": "eventId"
        }
    }
```
### 4. Exercise submitted event

Description: This event is published from exercise service when students submit their solution
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.submit

```Message```

```JSON
    {
        "exercise": {
          "_id": "exerciseId",
          "submitter_id": "userId",
          "submitter_name": "Trần Tú Hảo",
          "submitter_email": "tuhao99@gmail.com"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 5. Exercise remarked event

Description: This event is published from exercise service when teacher remark an exercise
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.remark

```Message```

```JSON
    {
        "exercise": {
          "_id": "exerciseId"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 6. New comment in exercise event

Description: This event is published from exercise service when user comment in an exercise
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.comment

```Message```

```JSON
    {
        "comment": {
          "_id": "commentId",
          "commentator_id": "userId",
          "commentator_name": "Trần Tú Hảo",
          "exercise_id": "exerciseId",
          "exercise_name": "layout với CSS"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 7. Reply Comment in exercise event

Description: This event is published from exercise service when user reply your comment in an exercise
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-exercise-event-handler
> key: exercise.replyComment

```Message```

```JSON
    {
        "comment": {
          "_id": "commentId",
          "comment_parent": "commentId",
          "comment_parent_owner_id": "userId",
          "comment_parent_owner_email": "tuhao@gmail.com",
          "commentator_id": "userId",
          "commentator_name": "Trần Tú Hảo",
          "exercise_id": "exerciseId",
          "exercise_name": "layout với CSS"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 8. Course created event

Description: This event is published from course service when teacher creates a course
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-course-event-handler
> key: course.created

```Message```

```JSON
    {
        "course": {
          "_id": "courseId",
          "course_name": "web nâng cao"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 9. Course updated event

Description: This event is published from course service when teacher updates a course
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-course-event-handler
> key: course.update

```Message```

```JSON
    {
        "course": {
          "_id": "courseId",
          "course_name": "web nâng cao"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 10. Course deleted event

Description: This event is published from course service when user reply your comment in an course
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-course-event-handler
> key: course.delete

```Message```

```JSON
    {
        "course": {
          "_id": "courseId",
         },
        "event": {
            "_id": "eventId"
        }
    }
```
### 11. New comment in course event

Description: This event is published from course service when user comment in a course
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-course-event-handler
> key: course.comment

```Message```

```JSON
    {
        "comment": {
          "_id": "commentId",
          "commentator_id": "userId",
          "commentator_name": "Trần Tú Hảo",
          "course_id": "courseId",
          "course_name": "web nâng cao"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
### 12. Reply comment in course event

Description: This event is published from course service when user reply your comment in an course
> exchange name: notification-ex
exchange type: direct

> queue name: notification-svc-course-event-handler
> key: course.replyComment

```Message```

```JSON
    {
        "comment": {
          "_id": "commentId",
          "comment_parent": "commentId",
          "comment_parent_owner_id": "userId",
          "comment_parent_owner_email": "tuhao@gmail.com",
          "commentator_id": "userId",
          "commentator_name": "Trần Tú Hảo",
          "course_id": "courseId",
          "course_name": "web nâng cao"
        },
        "event": {
            "_id": "eventId"
        }
    }
```
