Callback from workerRole when task completed

I have a worker who creates a PDF document. I pass the necessary data through the queue to the work request, the work role creates the PDF document, saves it in the BLOB, but how can I send the BLOB address to the website to tell the user where to go to download the PDF?

+3
source share
3 answers

This is a typical scenario of a correlation identifier pattern .

When the work role is completed, it should send a message in turn , indicating that the document is ready. You can use the Correlation Identifier (for example, the document identifier) ​​to indicate in the message DocumentReadyEvent to which the original request related to this event belongs.

You can also follow the path of full CQRS and simply update the view table, which includes the new document, and allow the website request.

+4
source

You can do this in a different way, using a common naming structure. Let the website / user app select the blob name and location based on some standard agreement. Then the site / application can sometimes check blob through an HTTP request.

+1

- ?

You can do a lot, for example, you can create a table separated by a "user ID" and save the URL of the finished documents there, and set up an ajax call that checks the contents of this table in the background for this user, and when he finds a new one that has not yet has been “viewed”, show a warning with a download link.

Just an idea.

0
source

Source: https://habr.com/ru/post/1783384/


All Articles