2 Comments

  1. Thank you very much for the helpful writing.

    In your example, the controller provides the page attribute, but the client calling your service can not know how many pages are left, as the page is not given in the response.

    Do you have any idea how cursor-based-pagination can be implemented in a reactive way?

    1. Author

      Really good question. Check this answer on StackOverflow by a Spring Data Engineer. I agree with that answer: pagination goes a little bit against some reactive patterns. Also, bear in mind that the total number of records might grow while you consume them from the frontend.

      However, I do understand the requirement in some situations. For example, if you want to know in advance, on frontend side, how long is going to take to retrieve all results to provide a better user experience (like a progress indication). The simplest solution is just having a separate endpoint to provide this information. Check this pull request: https://github.com/mechero/full-reactive-stack/pull/1/files.

Comments