Skip to content

Instantly share code, notes, and snippets.

@mchlstckl
Last active January 7, 2016 19:22
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 mchlstckl/5f90b7d82e991e224a9a to your computer and use it in GitHub Desktop.
Save mchlstckl/5f90b7d82e991e224a9a to your computer and use it in GitHub Desktop.
HystrixCommand returning Observable
//...elided code...//
@HystrixCommand(/* ...some very advanced hystrix configurations here... */)
open fun fetchUser(email: String): Observable<User> {
// MUST return ObservableResult when using @HystrixCommand and Observable<T>
// See: https://github.com/Netflix/Hystrix/issues/729
return object : ObservableResult<User>() {
override fun invoke() = client.fetchUser(email)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment