Skip to content

Example Application using RxJava for Grails and RxGORM for REST

Notifications You must be signed in to change notification settings

jnunderwood/rx-grails-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Example Application using RxJava for Grails and RxGORM for REST

Description

This is an example application running on Java 8 using the following...

Client

Server

The goal is to use RxJava for Grails and RxGORM for REST so that our domain classes can be backed by a microservice instead of a database. (I also wanted to try out micronaut for the microservice)

The Problem: It Does Not Work

When accessing http://localhost:8080/employee/show/1, Chrome developer tools indicate that an HTTP status of 200 [OK] is being returned to the browser.

However, the client app fails to render the show view.

What Works

The micronaut server seems to work as does the communication between the client and server. For example, when requesting a client URL, such as http://localhost:8080/employee/show/1, logging indicates the following:

  • the client is sending the request to the server
  • the server is receiving the request from the client
  • the server is sending the response to the client
  • the client is receiving the response from the server

Client

The client runs on http://localhost:8080 and was generated by:

$ curl -O start.grails.org/client.zip -d version=3.3.5 -d features=events,geb2

I added the following lines to build.gradle in the dependencies section:

    compile "org.grails.plugins:rx-gorm-rest-client:1.1.0.RELEASE"
    compile "org.grails.plugins:rxjava2:2.0.0"

I added the following lines to application.yml:

---
grails:
    gorm:
        rest:
            host: http://localhost:3030
            log:
                level: TRACE

Controller and views were generated by:

$ ./grailsw generate-rx-all Employee

The client.EmployeeController was slightly modified to add logging to the show action. The original, generated action behaves similarly, as does the index action. Other actions were unused and removed for simplicity.

Server

The the server runs on http://localhost:3030 and was generated by:

$ mn create-app server --features groovy

Added the following lines to application.yml:

---
micronaut:
    server:
      port: 3030

A server.Employee object, with a name field, and a server.EmployeeController were written. They are very simple.

About

Example Application using RxJava for Grails and RxGORM for REST

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published