Sessions in Netty

thatsanee martin.rogan.inc at gmail.com
Tue Dec 8 04:00:55 EST 2009


Hi,

I would like to add session like behaviour to my Netty app. In MINA I would
have set my app session in the IoSession attributes. Then it would be
available everywhere via the ubiquitous IoSession.

At first I thought I would emulate this behaviour in Netty with
ChannelHandlerContext.setAttachment(appSession), but this only seems to be
available to the handler in which it is set. The attachment is not available
to other handlers in the pipeline.

Then I thought I would set @ChannelPipelineCoverage("one") and store my app
session as an attribute of the handler. The problem with this approach is
that, again, the attribute is only available to the handler in which it is
set. I really wanted access to my app session up and down the pipeline.

So it seems I have to maintain my own session map, perhaps based on the
Channel.getId()? Then everywhere I need access to my app session I have to
retrieve it from the global map. Does this approach seem reasonable? Or have
I overlooked something?

Thanks,

Martin


-- 
View this message in context: http://n2.nabble.com/Sessions-in-Netty-tp4131287p4131287.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list