-
Notifications
You must be signed in to change notification settings - Fork 667
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
Use Kotlinx Coroutines SharedFlow to subscribe to updates #1560
Comments
aSemy
changed the title
Use Kotlinx Coroutine SharedFlow to subscribe to updates
Use Kotlinx Coroutines SharedFlow to subscribe to updates
Aug 13, 2022
👍 Kotlin Flow support would be super nice. Being able to process data as streams rather than batches is a huge plus. Also, it decreases the load on the DB because of the backpressure mechanism of flows. Makes processing huge amounts of data very easy. I think the backpressure mechanism can be implemented by using pagination (limit - offset) with a synchronous drivers. |
any updates or plan? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to use a Kotlinx Coroutines
SharedFlow
to subscribe to entity updates.Example usage
Here's a very quick demo showing how I'd like to use it:
Updating
I would also like to be able to push updates into a table using a
MutableSharedFlow
. Although I think this can be achieved already, having a built-in library function would help with ergonomics.Restrictions
I understand that there are issues with the database drivers being inherently synchronous ('Working with Coroutines', #1551 (comment)). However, I would like it if this functionality was implemented as best-effort, even if the underlying driver was not optimally.
Current options?
I couldn't see any easy way to do this presently.
I couldn't find any 'subscribe' or 'listening' options described in the DSL or DAO docs, and I couldn't see any existing usage of a
Flow
in the project.SqlDelight has similar functionality: https://cashapp.github.io/sqldelight/jvm_sqlite/coroutines/
Related
The text was updated successfully, but these errors were encountered: