Netty/mina cooperation. Is it possible to wrap netty's ChannelBuffer to MINA's IOBuffer?

374 views Asked by At

Idea is to integrate apache vysper to existing netty application. Is it possible to ChannelBuffer from client being connected to netty as mina'a ChannelBuffer so it could be deligated to the vysper?

Idea is to make custom netty based endpoint for apache vysper, obtain ChanellBuffer and pass it to vysper.

2

There are 2 answers

0
zillion1 On BEST ANSWER

Apache Vysper uses MINA, an non-blocking I/O-Framework similar to netty.

When I designed Vysper, I tried not to couple MINA too tightly to the rest of Vysper. So in theory it should be possible to replace MINA with netty, if you want to go that route. Looking at the source code, you'd need to port all the functionality from package https://svn.apache.org/repos/asf/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/mina to netty and replace it's usages. It's do-able, but requires some work. Additionally, Vypser uses XMPP as a protocol which is based on/is a subset of XML. Vysper uses a non-blocking XML parser 'nbxml', which is a subproject of Vysper. (https://svn.apache.org/repos/asf/mina/vysper/trunk/nbxml) You'd need to replace this with a netty version of nbxml, too. On the Vysper mailing list at [email protected] I'd be able to help you with this in detail.

Another route would be to use netty endpoints, and - as Norman suggested - somehow pass the buffers to Vysper/MINA. This sounds like an elegant approach, but I doubt it is more feasible than the previous approach. I don't know if netty has a non-blocking XML parser that matches Vysper's needs. It probably would require some ugly stunts to wrap netty around MINA.

A last advice would be to use Vypser as-is. MINA didn't receive as much love over the last years as netty, but it is a non-blocking IO-framework, too. If you really are stuck to netty, consider using it as a proxy, having netty at one endpoint and Vysper/MINA at another and just route bytes you receive at the netty endpoint through to Vysper/MINA.

0
Norman Maurer On

I guess you could just write your own impl that wraps it. Or use the backed bytearray and wrap this.