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

jeggy

07/07/2021, 11:02 PM
I'm playing with flow and trying to integrate it with RabbitMQ. But I'm running into an issue where I can't emit values to a flow. I've created a simple example of my problem as shown on the image below. How would I solve this issue? If I try to run it in some other coroutine, Flow will just throw an error with the message
Emission from another coroutine is detected.
l

louiscad

07/07/2021, 11:24 PM
You want to use
callbackFlow
, BTW, make sure to look at its doc and to support cancellation properly.
🤩 1
j

jeggy

07/08/2021, 9:29 AM
Thanks, this is exactly what I need 🙂
2 Views