blob: 0c7a403aa7c1f2d0dcd6a79362f8503f4c92fa2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
---
title: Introduction
type: docs
---
# RxJersey - Reactive Jersey Feature
[![Build Status](https://travis-ci.org/alex-shpak/rx-jersey.svg?branch=master)](https://travis-ci.org/alex-shpak/rx-jersey)
![Maven Central](https://img.shields.io/maven-central/v/net.winterly.rxjersey/core-server.svg)
RxJersey is RxJava extension for [Jersey](https://jersey.java.net/) framework providing non-blocking Jax-RS server and client.
RxJersey target is to handle large amount requests in small static set of threads, which is highly suitable for microservice applications.
Library uses Jersey 2 async support with `@Suspended` and `AsyncResponse` under the hood.
## Features
- [x] RxJava Support
- [x] RxJava 2 Support
- [x] RxJava Proxy Client
- [x] Async Request Interceptors
- [x] Dropwizard bundle
## Roadmap
- [ ] Futures support
- [ ] Vert.x integration
- [ ] Improved proxy client
## Maven Artifacts
### Maven Central
```
compile "net.winterly.rxjersey:dropwizard:$rxJerseyVersion"
compile "net.winterly.rxjersey:rxjava-client:$rxJerseyVersion"
compile "net.winterly.rxjersey:rxjava-server:$rxJerseyVersion"
compile "net.winterly.rxjersey:rxjava2-client:$rxJerseyVersion"
compile "net.winterly.rxjersey:rxjava2-server:$rxJerseyVersion"
```
### JitPack
Most recent snapshot is available via [JitPack](https://jitpack.io/#alex-shpak/rx-jersey/)
```
compile "com.github.alex-shpak.rx-jersey:dropwizard:$rxJerseyVersion"
compile "com.github.alex-shpak.rx-jersey:rxjava-client:$rxJerseyVersion"
compile "com.github.alex-shpak.rx-jersey:rxjava-server:$rxJerseyVersion"
compile "com.github.alex-shpak.rx-jersey:rxjava2-client:$rxJerseyVersion"
compile "com.github.alex-shpak.rx-jersey:rxjava2-server:$rxJerseyVersion"
```
## Example
```java
@Path("/example/")
public class GithubResource {
@Remote("https://api.github.com/")
private GithubApi githubApi;
@GET
@Path("github")
public Single<GithubRepository> getRepository() {
return githubApi.getRepository("alex-shpak", "rx-jersey").toSingle();
}
}
@Path("/")
public interface GithubApi {
@GET
@Path("/repos/{user}/{repo}")
Observable<GithubRepository> getRepository(@PathParam("user") String username, @PathParam("repo") String repo);
}
```
## Licence
[MIT](LICENCE.txt)
|