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

Problem Implamenting Complex flow on Single Stream #237

Open
frank-dspeed opened this issue Mar 2, 2017 · 0 comments
Open

Problem Implamenting Complex flow on Single Stream #237

frank-dspeed opened this issue Mar 2, 2017 · 0 comments

Comments

@frank-dspeed
Copy link

frank-dspeed commented Mar 2, 2017

The Main Question here is what's the best way to async in stream execute database requests that could return easily up to some million values paginated so that I can in process2 use the values to process them

the only working solution for me was creating 2 streams one that goes till process 1 and then emits from process1 the loop results till there are no once anymore

but I think I am missing something I am 100% sure there is a way that I can do that in a single stream
and not taking the values from the DB query results stream via onValue process and emit them.

My main problem is that i don't know how to loop over a stream value until i have all results :)
and then keep emmit results
I understand only that i could loop over it until it is complet processed and then return complet result but thats not possible because data size

i see no function that could do it only withHandler and Scan maybe.

// Constant string value from string
var first = Kefir.constant('str')
// First results for the constant returns stream of array itms
var firstResult = first.map(createFirst)
var process1 = firstResults.flatten().map(generateMoreStuffButKeepOld_Stuff) // WithHandler, Scan, 
// Here it starts to get Complex because generateMoreStuffButKeepOld_Stuff will 
// async produce results for each value of firstResult and we don't know how much it creates 
// It could be easy around a million items so we need to emit results while processing


// Transforming results from process1 into its final state.
var process2 = process1.flatten().map()
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