Here is some code that is very similiar to the one I am using currently. I am using Spring's JdbcTemplate for handling my connections against the database (and TransactionTemplate for transactions). Spring should give my connections back to the connection pool (Hikari in this case):
public Observable<MyObject> getObjectAsObservable() {
return vertx.executeBlockingObservable(future -> {
MyObject o = null;
try {
o = getMyObject();
} catch (Exception e) {
logger.error(e.getMessage());
future.fail(e);
return;
}
future.complete(o);
return;
}, false);
}
private MyObject getMyObject(String id) {
String objectData = jdbcTemplate.queryForObject("select o from myObjects where id=?;"),
new Object[]{id}, String.class);
return JsonUtil.toPojo(objectData, MyObject.class);
}
I added the ordered flag there and it seems to solve my problems. I started seeing more Vertx workers threads being active at the same for example.
Nat, there weren't really any exceptions in the log. I guess it was just a queue filling up.
Kind regards,
Tim