mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@gmail.com>
Subject request/response filter
Date Fri, 14 Jun 2013 09:27:51 GMT

I just pushed a request filter (we had one in mina 2 but with no doco
and weird code).

The idea is simple, on some protocols ( like CoAP and at some extend
HTTP) you push a response and could receive a async response.

This filter produce a IoFuture for waiting/listening the response to
your request.

The idea is to async chain request like that :

IoFuture<Response> future = rq.request(session, message, 10000);
response.register(new AbstractIoFutureListener<Response>() {
     public void completed(Response result) {
         rq.request(session, another..);
         // chain another handler

This avoid the need to coding state machine when the behaviour is not
too complex.

For guessing which message is the response to which query the messages
should provide a ".requestId()" method providing an identifier (in
coap it's a short integer).

I'm using it for CoAP, so an example will be provided.

The code is here :

Feedback Welcome :)
Julien Vermillard :::: http://people.apache.org/~jvermillard/

View raw message