Hi,

I'm trying to come up with a scheme to match responses to the original 
request, and trigger a Future/Promise when the response is received.

Conceptually, something like:

Message m = new Message("Something");
Future<Response> rf = m.future();
rf.addListener(new FutureListener() {
  public void operationComplete(Future<Response> f) {
    if (f.isSuccess()) {
      Response r = f.get();
      // ... something with the response
    } else {
      // it failed
    }
  }
});
ctx.writeAndFlush(m);

A ChannelHandler further along the pipeline will take care of matching the 
responses to the requests, and will trigger the future accordingly.

I'm actually trying to implement a Modem handler, that will indicate 
whether the AT command was successfully executed or not, in case that helps 
add context.

Any thoughts?

Rogan

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/a1342143-1b4f-4891-8ee0-98dc6efde10c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to