Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

RxJava Observables support for Spring REST plugin #1842

Open
marcin-jelenski opened this issue Aug 27, 2016 · 4 comments
Open

RxJava Observables support for Spring REST plugin #1842

marcin-jelenski opened this issue Aug 27, 2016 · 4 comments

Comments

@marcin-jelenski
Copy link

marcin-jelenski commented Aug 27, 2016

Hi,

I would like to ask if there are plans to add support for RxJava within rest-spring plugin, before I create new one.

For now, if somebody's using Observables and annotation-generated @restservice, this code has to be constantly repeated:

Observable.fromCallable(new Callable<String>()
{
    @Override
    public String call() throws Exception
    {
        return testRestService.getIndex();
    }
})

It would be nice to return Observable from Rest interface, like this:

@Rest(
    // ...
)
public interface TestRestService
{

    @Get("/")
    Observable<String> getIndex();

}

I've tried to implement custom message converter, but with no luck. Compilation fails after using parameterized type as a result (as shown above):

error: constructor Observable in class Observable<T> cannot be applied to given types;
required: OnSubscribe<String>
found: no arguments
reason: actual and formal argument lists differ in length
where T is a type-variable:
T extends Object declared in class Observable

Looking forward to hearing from you.

@dodgex
Copy link
Member

dodgex commented Aug 27, 2016

afaik there is no such plan right now. but i think you could try to contribute that feature so there would be no need for a complete new plugin.

@WonderCsabo
Copy link
Member

This was already requested in #1816, however i mark that one as a duplicate as this issue is better scoped. I agree this would be a great addition to AA-REST, but currently i do not have time to implement this. Contributions are welcome, as always!

@JackRo
Copy link

JackRo commented Aug 29, 2016

@marcin-jelenski your issue is so cool

@marcin-jelenski
Copy link
Author

As soon as I have more time to dive into AA, I will try to contribute this module (and maybe others) to support react components.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants