I’m trying to supply my own Netty EventLoopGroup to be used for the io pool, how can I do this?
I see there is a method on the environment builder but it requires a
com.couchbase.client.deps.io.netty.channel.EventLoopGroup whereas I have
Hm you are raising a good point. Orignally we wanted to make this pluggable (so you can use the EpollEventLoopGroup for even more performance), but we are fat-jarring the core in order to prevent version clashes.
Are you wanting to reuse your own group or are you interested in using the Epoll one?
I’d like to reuse my own group.
In short I’m looking at how best to provide a tight integration to a framework I work on called Ratpack. It is also Netty based and I would like to use the same event loop group across both my Raptack app and the Couchbase java sdk. If epoll is available we do use that for our event loop too.
Ah, that’s indeed a caveat of fatjaring dependencies
It feels a little dirty for this particular use caes, but maybe what you could do is use the
Adapter pattern: wrap your existing
io.netty.channel.EventLoopGroup into an implementation of
com.couchbase.client.deps.io.netty.EventLoopGroup that just delegates every single method to the wrapped instance?
edit: not that simple since methods in the interface can return types from the netty namespace…
@rhart are you planning to open source a ratpack-couchbase module? If so, that would be totally awesome.
I’ll also look into how we can make that happen, maybe we need to introduce some kind of indirection directly in the SDK to make the conversions working. Any ideas?
Thanks. That might be worth a go to see if what I’m trying to do works out.
Possibly, if it makes sense to. What I’m looking at is what the integration needs to be and then whether that can be made into a module.
It’s all based from this forum post http://forum.ratpack.io/Rx-Observable-created-by-another-API-Quite-not-sure-what-s-the-correct-way-to-use-it-td933.html
The main issue is joining back to the original execution thread. We can supply an Rx scheduler easy enough but the scheduling happends from an io pool thread so I don’t think I can easily join back to the original execution. I was thinking that if the io pool was the same as the app pool then it might make that easier. It also makes sense for all Netty executions to happen using the same event loop.
yeah, not that simple too many adapters required
I’ll also chime in on the ratpack forum post on some specifics, because I think I need to clarify on SDK behaviour
Just to let you know, I made a POC ratpack-couchbase module : https://github.com/ylemoigne/ratpack-couchbase
It was while I was using it that I raised the issue you see in ratpack forum.
At this time, this is only a playground project, 3 in 1 (Improve my Rx skills, learn Ratpack, learn Couchbase SDK)
I don’t plan to maintain or develop it further at this time. Maybe I’ll come back to it when N1QL will go to production stage.
@ylemoigne thanks for sharing!