1

for our project, we are using micro services with API gateway pattern. One of the features that the client do is to generate a report. Client, fills a form and uploads a file and our system will generate a report. We want to process the file and the form data, store the data in the database, then send all this data to the algorithm which eventually generates the reports.

We have one service that handles the database interactions: this service will be responsible from processing the form and saving to database and, the report generation involves 5 other services.

Our current consideration is to have the API gateway wait until the report generation is completed which doesn't sound right but I can't articulate why it "doesn't sound right". So, I need some help on this.

I believe a publisher subscriber pattern might be better but I'm not sure how errors are handled or how to keep track of the state of the report - also I need some insight on this area.

Please let me know if you need more information. I'll be very happy to discuss this further.

Thanks in advance

1

Publish/Subscribe would mean that any one of your micro services might want to get the GenerateReport instruction to start generating the report. If that's what you want then yes, pub/sub is part of the approach.

I do however suspect that one of the micro services is responsible of coordinating the generation. In that case you are just looking for plain messaging using a service bus or plain message queues.

With messaging you get a promise of that something will be done in the future. Thus when the message have been put on the queue nothing have yet been completed. You can google "eventual consistency" to learn more.

But since nothing have been completed, how do you tell the user when the report is done or if it fails? One approach is, again, messaging. But in this case you could simply send an email to the user. Either with a link to the generated report (or the report attached) or an error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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