Class: Asap::Netty::PipelineFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/asap/netty/pipeline_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callback) ⇒ PipelineFactory

Returns a new instance of PipelineFactory.



8
9
10
# File 'lib/asap/netty/pipeline_factory.rb', line 8

def initialize(callback)
  @callback = callback
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



6
7
8
# File 'lib/asap/netty/pipeline_factory.rb', line 6

def callback
  @callback
end

Instance Method Details

#get_pipelineObject



12
13
14
15
16
17
# File 'lib/asap/netty/pipeline_factory.rb', line 12

def get_pipeline
  org.jboss.netty.channel.Channels.pipeline.tap do |pipeline|
    pipeline.add_last("codec", org.jboss.netty.handler.codec.http.HttpClientCodec.new)
    pipeline.add_last("handler", Asap::Netty::HttpResponseHandler.new(callback))
  end
end