title: Propagate back-pressure between two netty channels
body: <p>I want to write a system using netty-4 where a server receives a request from one channel (cleverly dubbed <em>in</em>), does a transform and potentially puts the result onto another channel to another backend-system (dubbed <em>out</em>).</p>
  
  <p>But I would like to propagate back-pressure from the <em>out</em> channel to the <em>in</em> channel? Specifically&mdash;because the netty APIs are asynchronous&mdash;how do I get notified when <em>out</em> is no longer blocked up; and tell <em>in</em> to pause/resume?</p>
  
  <p><strong>Partial Solutions</strong></p>
  
  <p>I believe can tell when <em>out</em> channel is ready to write with <code>channel.isWritable()</code>.</p>
  
  <p>An answer to <a href="https://stackoverflow.com/questions/18312823/delay-channel-read-in-netty-4">this question</a> mentions disabling AUTO_READ, but then I believe I'd have to be in charge of polling the channel for reads. I'm not to happy about that&mdash;<em>unless</em> I can receive a message when it's ready to read. At this point, the utility of using netty is mostly just the no-copy buffers and the ByteToMessageDecoder superclass.</p>