My problem concerns two services: NotificationService(should be used by more than just the SurveyService), SurveyService.

I want to send recurring notifications to the user asking for participation in a survey. These should be sent in a certain interval until the max notification number is reached or until the user participated in the survey.

Without the recurring part I would do it like this: The SurveyService dispatches an "UserAddedToSurvey" event which gets processed by the NotificationService which in response notifies the user.

But with recurring notifications I have to consider whether the user participated and when the last notification was send/how many were sent regarding this topic.

If I understand the idea behind microservices correctly is that they should not have any knowledge about each other. But I need information from both services to decide whether or not to inform the user again.

My only idea regarding this would be a cronjob in the SurveyService dispatching a UserStillNotParticipatedInSurvey event regularly and letting the NotificationService decide whether or not sending a notification based on the last notification date and the total number of notifications regarding this topic.

Would that be an appropriate solution? Or Are there any better/simpler ways of solving that problem?

  • Would that be an appropriate solution? Yes. If the notification service's responsibility is notifying, and the survey service's responsibility is keeping track of whether user's participated or not, then that seems the most logical and correct approach. I know nothing of your system beyond the two services, so I'm limited in whatever creative approaches I can offer. Jun 11, 2018 at 13:42

2 Answers 2


It seems you have three responsibilities here:

  • Complete the survey
  • Determine whether to remind the user to take the survey
  • Remind the user

That means that theoretically you could have three microservices. Your SurveyService sends an event UserParticipated to a new service, let's call it ReminderService. The ReminderService has knowledge about whether the survey has been completed and when the last reminder has been sent. Every interval you check for users that haven't completed the survey yet and send a notification event. The cronjob you mention could trigger the ReminderService, but you could also implement the scheduling in your ReminderService. This gives you a bit more control, e.g. to spread the notifications reducing peak loads on the notification service.

  • Thanks, doing the scheduling in a reminder service seems like a good way and enables easy triggering of reminders by other events, too. Jun 12, 2018 at 16:25

Having a cron job is not needed here. I'd just send a UserStartedSurvey at the start of a survey and a UserCompletedSurvey at the end of a survey from the SurveyService to the NotificationService. The NotificationService then knows when to stop sending invitations to the user and can even send Notifications to remind the user to finish a survey if you want to.

This way the SurveyService knows about the interface of the NotificationService, which is valid. It doesn't know what the NotificationService does with this information, nor does it need to know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.