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