dgs-framework
dgs-framework copied to clipboard
feature: Support Flow as Subscription return type
Currently, the subscription only supports ReactiveStream Pulisher as return type, if possible to add Kotlin Flow support, it make my codes look more consistent when I am using Kotlin Coroutines.
val flow = MutableSharedFlow<Event>()
fun emitEvent() {
flow.emit(event)
...
}
fun eventAdded()=flow //the subscription function.
Internally Dgs can bridge it to a Publisher as required by graphql-java .
I think that is a good idea, thanks @hantsy for the suggestion.
Support for flow was added in c48492a.
@kilink It seems the commit provides Flow as return type of Data Fetching, how about Flow support for subscription/event modeling?
You're right. I've added support for it in #1800