Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chaining of Observable outputs #6

Closed
sagarrao opened this issue Aug 26, 2014 · 0 comments
Closed

Chaining of Observable outputs #6

sagarrao opened this issue Aug 26, 2014 · 0 comments

Comments

@sagarrao
Copy link

Hi,

We were looking to leverage the reactive model using hystrix for one of our use cases. The scenario is that we poll an API, which basically returns a List of hasmaps of events of sports. An event is something which takes place every season, so in case of tennis, a US Open would be an event.

Once we get that list, we iterate over that List of hashmap of events, take an individual event and invoke another API to fetch the matches within that event. So, all the 128 matches to be played in the US Open would be returned here. Eventually, we want to persist the Event object with the List of competitions in our Mongo Datastore/.

Now, we have created a separate HystrixCommand for each of the API calls and also for the persist part. So, we are trying to keep things in as asynchronous a manner as possible.

But, this is where the problem starts.The fixtures API expects an eventId as part of its url. Now, the problem is, that how can I send that List of Competition object back to the original callee event in a non-blocking manner? I found one way : .toBlockingObservable().single(), which basically is able to return the emitted the List from this observable to the callee. But, this makes the call blocking which also seems to stall the original iteration of the event for loop.

Is there any non-blocking way of doing this? I read some of the examples and found a groovy based one for Videos using map(). Is that the only way or would some tweak in my original approach suffice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant