#How to listen for two separate get requests to return data

1 messages · Page 1 of 1 (latest)

round gale
#

I am returning data from two different api calls and once data is returned I need to combine parts of each list into a new list. My api calls are asynchronous and I'm unsure how to add a listener/observable to signal when both lists have returned data. Grateful for suggestions!

languid questBOT
#

This post has been reserved for your question.

Hey @round gale! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

icy venture
# round gale I am returning data from two different api calls and once data is returned I nee...

In the modern world, it is assumed that you want to run a kubernetes swarm, and these two requests of yours are likely to end up on two different servers.

So to link them both you're supposed to back them to a common data holder component between these two servers. Like a database or a distributed cache.

Anytime a server receives one such request, it would query the common data to check whether the other part is there. If so, it completes the operation. If not, it stores the part it just received.

That's the general viewpoint of the technologies you're using. You can follow them to the letter or adapt to it any way you see fit

round gale
#

Thanks for your response. My question is in regards to an Android app (I know there is Discord for Android, but Java questions aren't usually answered). There is no common data between the two lists. Is the Java-help chat just for backend or web projects? Apologies if it is.

languid questBOT
icy venture
#

That's not it, sorry, the way you describe your problem it looked like you were on the server side

#

Normally you should have a common state data structure that you save the result into, and when both results are obtained, you do what comes next.
But I don't know the specifics of Android

round gale
#

Got it, thanks for clarifying.

languid questBOT
# round gale Got it, thanks for clarifying.

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

chilly knoll