-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is this library Vertx 3 compatible ? #54
Comments
Hi, I'm not familiar with Vertx 3 so you're on your own here (unless a subscriber to this list knows the product). |
@javajack Yes you can. Just be sure to schedule the work with the RxHelpers class in the vert-rx package |
@javajack a quick example might look something like this... db.select().autoMap(User.class)
.subscribeOn(RxHelper.blockingScheduler(vertx))
.observerOn(RxHelper.scheduler(vertx))
.subscribe() @davidmoten I am a fairly new user of this library but my understanding would be that the library is respecting the thread preference by saying |
it would be great to have this library to work well with Vert.x perhaps we can collaborate on integration test with Vert.x 3.x and documentation ? |
@zsiegel yep that's right, normal manipulations with observables are fine as long as some sort of mapping of the ResultSet to an object occurred synchronously. The library leads you that way anyway with the method chaining. You have to do something like this to get into trouble with threads: db.select()
.get(rs -> rs)
.observeOn(Schedulers.io())
.map(rs -> rs.getString(1))
.toList().toBlocking().single(); In the above statement the resultset is mapped to an object on a different thread than the thread on which the resultset was created. Jdbc drivers don't guarantee thread safety in this scenario. As long as you avoid this sort of usage you can do whatever you like to your observables. |
and thanks for answering this one @zsiegel ! |
Is setting schedulers with observeOn/subscribeOn needed when using rxjava2-jdbc with non-blocking connections? |
@kdurnoga you should always use the |
Best to ask rxjava2-jdbc questions on it's project. Default behaviour in rxjava2-jdbc is to run on the |
Vertx 3 is already having some data access libraries
http://vertx.io/docs/vertx-sql-common/java/
and
http://vertx.io/docs/vertx-jdbc-client/java/
But I want to leverage this API as it is more intuitive in nature.
Can we use this library with Vertx 3 for asynchronous processing ?
The text was updated successfully, but these errors were encountered: