#500 Notification Filtering System
The company provides a bulk notification service for other businesses. A product owner asks for a notification filtering system that takes user preferences into account.
Definitions
A notification contains:
- notification
id; - notification type:
EMAIL,SMS, orPUSH; - recipient
id; - message text.
A recipient may have preference settings:
- allowed notification channels;
- blocked senders.
The sent-notification history contains the list of notifications already sent to the user.
Important
User settings and notification history are supplied by other system components. For this exercise, define contracts for obtaining this data. Storage implementation is not required.
Exercise
Implement a notification filtering system that:
- accepts a list of notifications to filter and a sender
id; - excludes notifications that do not match the recipient's preferences;
- excludes notifications from blocked senders;
- prevents duplicate notification delivery;
- returns the filtered list of notifications ready to be sent.
If a notification with the same id has already been sent to a specific user during the last 24 hours,
it must not be sent again.
Notification delivery is outside the scope of the exercise. Another team will send the filtered list.
Question review
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor