Created
July 5, 2014 16:09
-
-
Save maggandalf/1ecd5fcdf310b802c749 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
@Path("book") | |
public class BookService { | |
private static final String BOOKSERVICE = "http://localhost:8080/bookservice"; | |
private static final String COMMENTSERVICE = "http://localhost:8080/bookcomments"; | |
@Resource(name = "DefaultManagedExecutorService") | |
ManagedExecutorService executor; | |
Client bookServiceClient; | |
WebTarget bookServiceTarget; | |
Client commentServiceClient; | |
WebTarget commentServiceTarget; | |
@PostConstruct | |
void initializeRestClients() { | |
bookServiceClient = ClientBuilder.newClient(); | |
bookServiceTarget = bookServiceClient.target(BOOKSERVICE + "/rest/bookinfo"); | |
commentServiceClient = ClientBuilder.newClient(); | |
commentServiceTarget = commentServiceClient.target(COMMENTSERVICE + "/rest/comments"); | |
} | |
@GET | |
@Path("{isbn}") | |
@Produces(MediaType.APPLICATION_JSON) | |
public void bookAndComment(@Suspended final AsyncResponse asyncResponse, @PathParam("isbn") String isbn) { | |
//RxJava code shown below | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment