https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
g

ghedeon

01/22/2019, 10:40 AM
Any rough estimations from officials of when Channels are going to be production ready? The quarter of the year maybe. (Note: it's not about push or faster delivering, it's about roadmaps and planning)
d

dekans

01/22/2019, 3:11 PM
They are production ready. But the API will change to support cold streams iirc.
v

Vsevolod Tolstopyatov [JB]

01/22/2019, 4:42 PM
They are production ready. Some API is experimental because we are not sure we won’t change it, but core functionality (send/receive, iteration, close) is stable and production ready
g

ghedeon

01/22/2019, 5:13 PM
I love kotlin as much as the next guy here and I'll use channels in my pet projects. But after a week of active research, reporting issues, exploring the github WIP discussions about upcoming changes, I officially advised my team to not use them in production (yeah, bring your pitchforks 🙂). It's not ready, at least on Android. The latest issue I reported not so long ago as today morning. Maybe I'll post here a gist with some findings, but overall impression is
not today
.
1
d

dekans

01/22/2019, 8:50 PM
What's wrong on Android? I use Kotlin/Coroutines on Android and it"s OK.
g

ghedeon

01/22/2019, 9:01 PM
Define coroutines. The topic is about channels. Nothing wrong with coroutines, we use them in production.
v

Vsevolod Tolstopyatov [JB]

01/23/2019, 8:07 AM
Constructive feedback is always welcomed, it really helps to build a better product. Feel free to share your concerns and pieces you think are making them unstable.
Also, try not to mix issues about channels (they should be very rare), actors (obsolete), channel operators (obsolete) and cold streams (not yet designed) 🙂
z

zokipirlo

01/23/2019, 8:11 AM
Actor
works fine, I'm using it in production and don't see any problems. Please don't remove it.
d

dekans

01/23/2019, 8:22 AM
@ghedeon correct! What's wrong with channels? I use them to remove some callbacks, and it works pretty well. I also use them via
actor
a lot.
g

ghedeon

01/23/2019, 8:27 AM
let's take it slowly, in a constructive manner. What do you mean channels operators issue is obsolete?
even the simple
merge
is not available. The next day you introduce channels in your code, you want to combine, merge, etc. People are already asking for
combineLatest
on SO: https://stackoverflow.com/questions/49215485/how-can-i-implement-rxjavas-combinelatest-on-kotlin-co-routines-receive-channel
Seriously, guys, I understand that you're biased, and channels might work in one trivial example out of 10 that were covered by RxJava before, but isn't it better to be honest here? People are getting hyped on "RxJava == Coroutines" only to face the disappointing reality later.
1. Operators. Only collection operators available. 2. Cold streams. (Also, because it's not implemented, you're doomed to pollute your API with
CoroutineScope
reference, that supposedly can be omitted with cold streams.) 3. Rx has LiveData interop, Channels don't. https://github.com/Kotlin/kotlinx.coroutines/issues/258 4. Debug Coroutines JVM flag is not available on android. Hard to understand what's going on some times. 5. Debugger fails to stop in consumeEach: youtrack.jetbrains.com/issue/KT-29426?project=kt (btw,
consumeEach
will be deprecated, iiric) 6. Testing support is not fully developed. Didn't find a way to properly test my channels code.
Dispatcher.setMain
helps, but seems like something similar to
InstantTaskExecutorRule
for LiveData is missing. TestCoroutineContext is already obsolete. 7. In general, good portion of api is marked as obosolete. And that's just from the top of my head. Plus tons of ongoing discussions on Github where it's clear that the API is not stable. Like deprecating
flatMap
for ReceiveChannel because it wasn't implemented correctly: https://github.com/Kotlin/kotlinx.coroutines/issues/180 I just can't afford the risk of 9 people pushing the code in production with this level of uncertainty.
Also, the lack of good examples: https://github.com/Kotlin/kotlinx.coroutines/issues/945 I'm not saying it's the JB duty to write examples, but the absence of apps that use channels (ironically, from the KotlinKonf speakers itself) is a sign of low adoption (to date). Which means, again, high risk in production.
v

Vsevolod Tolstopyatov [JB]

01/23/2019, 9:04 AM
I’ve understood your concerns, so let me clarify: Channels are not replacement for RxJava. Neither we advertise them as Rx replacement, nor they are. Channels are hot-sources of the data, while RxJava is mostly cold. Channels are just blocking queues on steroids, where instead of blocking senders/receivers suspend. You do not expect, say,
java.lang.Stream
to be the replacement for Rx, do you? 🙂 If you are looking for Rx replacement, it is not there yet: https://github.com/Kotlin/kotlinx.coroutines/issues/254 Implementing all operators on top of channels is not our goal for a bunch of reasons: 1) When cold streams arrive, there are chances we should rewrite all channel operators to be consistent with the new model. And this is not something we want to do for a stable API. 2) Cold stream may affect the design and semantics of how to implement operators for channels, even its signature, which is not something backwards-compatible. And maintaining twice as much as normal operators (and explaining why they are here) is not our goal as well. 3) Without cold streams, but with a lot of Rx-like operators, the average user (which usually do not read any documentation, especially one that explains semantics rather than API) will start to use channels like he uses Rx. It will be much slower, it won’t match Rx semantics and generally it will be a disappointing experience. 4) Some operators are hard or make no sense for hot streams. Flat map issue with the only possible
produce
implementation is a good indicator of that. There is some API that looks rx-ish on top of channels, it is obsolete for exactly these reasons. So yes, if you want to use channels as direct drop-in Rx replacement, it is not going to work. Channels are a good fit as bridges for [callback-suspension] and [suspension-suspension] worlds and bad for free-form streams transformations and making meaningful business-logic inside of its operators.
On some specifics:
4. Debug Coroutines JVM flag is not available on android. Hard to understand what’s going on some times.
Do you mean
kotlinx.coroutines.debug
property or debug module?
but seems like something similar to
InstantTaskExecutorRule
for LiveData is missing
I am not very familiar with LiveData, but isn’t
Dispachers.Unconfined
what you are looking for?
g

ghedeon

01/23/2019, 9:42 AM
@Vsevolod Tolstopyatov [JB] I hear you, but here is the deal. People used to have one stream abstraction — Rx, now they have another, but with fewer operators. You just can't avoid the comparison between the two. I don't think it's physically possible. I bet you guys are already tired of people bringing Rx to the discussion over and over again. And I don't judge them. It will keep coming. Medium is flooded with articles
king is dead long live king
, throw away Rx now or you're not cool. I see two options. To take an official strong stance — "people, you're using it wrong!" and close all the issues on github, where people are expecting Rx alike behavior as "won't fix". Or to embrace it. To acknowledge that you're solving similar use cases and eventually to replace Rx. And your actions prove that Kotlin is embracing it.
@elizarov
acknowledged, that operators are coming, that
LiveData
interop is coming, etc. But I'm pretty sure you're well aware of all this 🙂, you just can't announce it officially, that you compete with Rx, because then people will demand Rx richness and maturity today. A very smart thing to do, if you ask me. (Thank you. Really appreciate your time for participating).
Do you mean
kotlinx.coroutines.debug
property or debug module?
iiric,
kotlinx.coroutines.debug
is ok, it's enabled for debug builds automatically, and
DebugProbes
doesn't work on Android.
isn’t
Dispachers.Unconfined
what you are looking for?
I meant similar to
RxAndroidPlugins
and
InstantTaskExecutorRule
for LiveData, but seems like it's already decided to not implement it and go with DI: https://github.com/Kotlin/kotlinx.coroutines/issues/102.
v

Vsevolod Tolstopyatov [JB]

01/23/2019, 3:39 PM
I see two options. To take an official strong stance — “people, you’re using it wrong!” and close all the issues on github, where people are expecting Rx alike behavior as “won’t fix”. Or to embrace it.
We will try to do both 🙂 Cold streams are our next biggest feature and we want it to be stable and production-ready Rx replacement, including operators. Hopefully, when cold streams arrive (and start its hype), most of the “issues” with channels will go away, the rest is an educational problem.
DebugProbes
doesn’t work on Android
We will try to fix it with AspectJ
it’s already decided to not implement it and go with DI
Right, only the main dispatcher is mockable, a rationale is here: https://github.com/Kotlin/kotlinx.coroutines/issues/810#issuecomment-439927255
Thank you for the feedback! It is constructive and very valuable for us