So I think this might be related to this post:
...but I'm still stumped.
The code in this project has a few issues, but from what I can tell, inserts, deletes, get all operations, and updates are all working against Mongo. I get no responses from ratpack, however, and debugging shows that the subscription of the observables within the Ratpack.groovy script itself is receiving the relevant, subscribed object.
The code in the project connect to a free mongo lab instance with a few (2 at the time of writing this) records.
You need to let Ratpack know that you're performing some async actions here.
We can take advantage of `Observable.compose` and `RxRatpack.bindExec` to let us subscribe to these mongo-rx based Observables back from Ratpack land.
I've issued a pull request here https://github.com/joshdurbin/rx-mongo-ratpack/pull/1
I've implemented `getPeople()`, `getPerson()`, and `insertPerson()` using this technique. Feel free to implement the rest of the Service methods.
Awesome!!! Got it. Makes sense... previous versions of apps had blocking 'blocks' which were managed by ExecControl or used the http client. What you did, mentioned here makes sense.
Thanks for the help.
You'd use the blocking blocks to perform I/O bound activity so as to not block the main processing thread.
Brief summary of when to use what:
`ExecControl.blocking()` allows you to take normal I/O bound blocking calls, e.g. making a database call or writing to a file without NIO and execute it in a separate thread so it doesn't block the thread processing the handler chain.
`ExecControl.promise()` allows asynchronous activity, e.g. `Thread.start()` to be coordinated within Ratpack. `ExecControl.promise()` provides a `Fulfiller` which allows you to respond to the state changes in the asynchronous activity via `Fulfiller.success()` and `Fulfiller.error()`.
With the `ratpack-rx` module we provide a convenience method that allows you to take third party Observables and subscribe back in Ratpack land. `RxRatpack.bindExec` allows you to easily consume third party Observables from Ratpack land. It's really syntactic sugar for `ExecControl.promise`. There are a few more goodies in `RxRatpack` that you may be interested in http://ratpack.io/manual/current/api/ratpack/rx/RxRatpack.html
|Free forum by Nabble||Edit this page|