Skip to content

Instantly share code, notes, and snippets.

@ermadmi78
Created October 20, 2021 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ermadmi78/4c1e47111d3586639e3217b6427badc3 to your computer and use it in GitHub Desktop.
Save ermadmi78/4c1e47111d3586639e3217b6427badc3 to your computer and use it in GitHub Desktop.
// Instantiate DSL context
val context = cinemaContextOf(createKtorAdapter())
launch(Dispatchers.Default) {
context.subscription {
filmCreated {
id()
title()
}
}.subscribe {
while (true) {
val result = receive()
result.filmCreated.also { film ->
println(film.title)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment