Skip to content

Easier support for Hystrix and a like #2113

Closed
@edudar

Description

@edudar

I tried to marry Retrofit and Hystrix together but that appears to be quite a cumbersome process. Ideally, I'd like to have something like this

@POST("...")
@HystrixCommand(groupKey="...", commandKey="...")
Observable<SomeObject> get();

However Retrofit uses JDK proxies and annotation info is not preserved so AOP stuff that wires together annotations and actual code does not work. For now, I had to create classes that match methods on interfaces and put @HystrixCommand into class methods instead. That does not look nice as I have to double the code.

Maybe allowing pluggable proxy (cglib, byte-buddy, etc) solution would be helpful in the long term here.

Activity

liangGTY

liangGTY commented on Nov 23, 2017

@liangGTY

hystrix-adapters? I think this is very good

swankjesse

swankjesse commented on Feb 26, 2018

@swankjesse
Collaborator

It’s not necessarily going to be a good fit because of the way Retrofit returns asynchronous objects. I think Hystrix is going to want to time the network call, not the method call to create an observable, etc.

Probably better to integrate Hystrix as a custom CallAdapter.

swankjesse

swankjesse commented on Feb 26, 2018

@swankjesse
Collaborator

(closing because I don’t think we’re going to get to this. If somebody would like to write a call adapter that hooks up Hystrix, that’d be great!)

liangGTY

liangGTY commented on Feb 26, 2018

@liangGTY

I've written a simple hystrix callAdapter before。But not supported fallback

hystrix callAdapter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @swankjesse@edudar@liangGTY

        Issue actions

          Easier support for Hystrix and a like · Issue #2113 · square/retrofit