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

Context passing between coroutines and Reactor Mono/Flux #1138

Merged
merged 2 commits into from Jul 17, 2019

Conversation

SokolovaMaria
Copy link
Contributor

No description provided.

@qwwdfsad qwwdfsad self-requested a review April 30, 2019 15:08
private const val SIGNALLED = -2L // already signalled subscriber onCompleted/onError

@Suppress("CONFLICTING_JVM_DECLARATIONS", "RETURN_TYPE_MISMATCH_ON_INHERITANCE")
private class PublisherCoroutine<in T>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-pasting the whole integration is definitely not an option: it is hard to maintain, hard to test and easy to mess up.
For example, we can make it public and mark with InternalCoroutinesApi

): Flux<T> = Flux.from(reactorPublish(newCoroutineContext(context), block = block))

@ExperimentalCoroutinesApi
public fun <T> CoroutineScope.reactorPublish(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to introduce public reactorPublish API?
Integration should work with flux builder.

reactive/kotlinx-coroutines-reactor/src/Flux.kt Outdated Show resolved Hide resolved

class ReactorContextTest {
@Test
fun monoHookedContext() = runBlocking(Context.of(1, "1", 7, "7").asCoroutineContext()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code style: all our tests are started with test prefix

reactive/kotlinx-coroutines-reactor/src/ReactorContext.kt Outdated Show resolved Hide resolved
reactive/kotlinx-coroutines-reactor/src/ReactorContext.kt Outdated Show resolved Hide resolved
Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Please rebase it on current develop (it contains some changes in Flux.kt and Publish.kt), I will tweak documentation a bit and merge then

reactive/kotlinx-coroutines-reactor/src/Flux.kt Outdated Show resolved Hide resolved
@elizarov elizarov added this to the 1.3 milestone Jul 16, 2019
@SokolovaMaria SokolovaMaria force-pushed the reactor-context branch 2 times, most recently from 90cb996 to ff06d83 Compare July 17, 2019 08:44
@qwwdfsad qwwdfsad merged commit 693142c into develop Jul 17, 2019
@qwwdfsad qwwdfsad deleted the reactor-context branch July 17, 2019 14:20
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

Successfully merging this pull request may close these issues.

None yet

3 participants