Return of Service

Asked

Viewed 26 times

1

I am with the following problem, I make an ajax call to my service and it returns me a paged list everything ok.. And I have a button where I download to excel, only because it is a very heavy table and I have no way to page this in excel I end up having the error of time out in the return of my call ajax.

I have heard of a stop you make the call and while the service is processed I have another service asking if it is finished and when it is finished returns to the customer, but n have idea of the name of this call or if there is any better way to accomplish this..

Can someone please help me ?

  • You’re talking about Partial-Content?

  • Why don’t you simply serve the excel file without ajax?

  • @Renan then I have to make the call ajax pq my UI does not process anything she asks everything for my service so I need the ajax to make the right call?

  • @Gabrielrodrigues if you are able to use ajax, you are able to redirect to the file URL, which is much simpler. Then the browser downloads the file quietly.

1 answer

0

There are several ways to implement such a mechanism, called asynchronous process, where the processing of a heavy task takes place in parallel with the original request. A standard flow could be described as follows:

  • The task T1 is requested by the client C1.
  • The server initializes a thread in background where the task starts running. It assigns an ID to this process - for example, ID1.
  • The server returns the process ID to the client, allowing it to continue to be used by the user.
  • From time to time the client asks, for the server, what is the execution status of the task ID1; return can be, for example, 'cancelled', 'running' or 'finished'.
  • If finished, the server can return the content generated by the processing in background.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.