Renba Urq
Renba Urq

Reputation: 21

Duplicate entries using Spring Batch and R2DBC

I'm new in the R2DBC environment and i'm afraid using it along Spring Batch to findAll the rows in a table with more than 8 million records can duplicate some rows in the process since R2DBC don't use a sequential order to iterate in a findAll, bcs of that, Is it safe to implement it along Spring Batch? Or do You think there Is a better approach for this task?

Upvotes: 0

Views: 72

Answers (1)

Hantsy
Hantsy

Reputation: 9321

There is no R2dbc integration in Spring Batch, check the issue here to update the status.

For Reactive Streams, you can call findAll which will emit the records into the result stream, set a backpressure strategy, and process them one by one.

repository.findAll()
.onBackpressureBuffer(...)
.map(...) // process it here
.onComplete // calling when it is completed
.onError // handling errs
.subscribe() 

Upvotes: 0

Related Questions