https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

Dariusz Kuc

09/20/2019, 3:14 PM
hello, I'm trying to figure out the proper way to do interop between reactor and coroutines - I need to populate reactor subscriber context with value computed from coroutine.
g

gildor

09/20/2019, 3:15 PM
Probably make sense to ask in #spring or check their implementation, as I remember the last versions of Spring provide some integration with reactor context for coroutines
💯 1
d

Dariusz Kuc

09/20/2019, 3:16 PM
yeah already did and waiting for response
w

withoutclass

09/20/2019, 3:16 PM
Latest spring supports coroutines and should not require special interop
d

Dariusz Kuc

09/20/2019, 3:17 PM
also as a side note -> that webfilter logic does seem to work fine as when i start the spring boot app it properly populates it
d

Dariusz Kuc

09/20/2019, 3:17 PM
might be just unit test
yeah it "should" work 🙂
g

gildor

09/20/2019, 3:19 PM
I'm not familiar with reactor, but curious what kind integration so you need, what you want to achieve
d

Dariusz Kuc

09/20/2019, 3:20 PM
well i'm trying to have some unit test for verifying the context is populated right
so that step verifier tests worked fine when i used regular method to calculate value to be stored in the reactor subscriber context
but unfortunately it broke when i moved to coroutines
it does seem like an issue with reactor step verifier
to complete the thread -> so the issue was that step verifier attempts to verify the context on the result of the filter mono chain. Since final value is not yet computed there is nothing yet added to the context so the StepVerifier checks against the context will fail. Unit test fix was to manually capture the context in the reactor chain and then complete it before attempting to verify the context (https://github.com/ExpediaGroup/graphql-kotlin/pull/361/commits/f746a886ddd97fa11dd29badecc8d7014d6fc75c)
8 Views