class Bricolage::StreamingLoad::ChunkRouter

Public Class Methods

for_config(configs) click to toggle source
# File lib/bricolage/streamingload/chunkrouter.rb, line 12
def ChunkRouter.for_config(configs)
  new(configs.map {|c|
    Route.new(url: c.fetch('url'), schema: c.fetch('schema'), table: c.fetch('table'))
  })
end
new(routes) click to toggle source
# File lib/bricolage/streamingload/chunkrouter.rb, line 18
def initialize(routes)
  @routes = routes
end

Public Instance Methods

route(msg) click to toggle source
# File lib/bricolage/streamingload/chunkrouter.rb, line 22
def route(msg)
  @routes.each do |route|
    stream_name = route.match(msg.url)
    return IncomingChunk.new(msg, stream_name) if stream_name
  end
  raise ChunkRoutingFailed, "could not detect stream name: #{url.inspect}"
end