Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Netty3 based Transport in Finagle
case class Netty3Transporter[In, Out](
pipelineFactory: ChannelPipelineFactory,
newChannel: ChannelPipeline => Channel =
newTransport: Channel => Transport[In, Out] =
new ChannelTransport[In, Out](_),
// various timeout/ssl options
) extends (
(SocketAddress, StatsReceiver) => Future[Transport[In, Out]]
private def newPipeline(
addr: SocketAddress,
statsReceiver: StatsReceiver
val pipeline = pipelineFactory.getPipeline()
// add stats, timeouts, and ssl handlers
pipeline // #1
private def newConfiguredChannel(
addr: SocketAddress,
statsReceiver: StatsReceiver
val ch = newChannel(newPipeline(addr, statsReceiver))
def apply(
addr: SocketAddress,
statsReceiver: StatsReceiver
): Future[Transport[In, Out]] = {
val conn = new ChannelConnector[In, Out](
() => newConfiguredChannel(addr, statsReceiver),
newTransport, statsReceiver) // #2
} }
// #1 Create a new ChannelPipeline and add the needed handlers
// #2 Create a new ChannelConnector which is used internally
// see
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.