class RedPack::SyncRedisResponder

Public Class Methods

new(redis, transcoder) click to toggle source
# File lib/redpack-ruby/responders.rb, line 31
def initialize(redis, transcoder)
  @redis = redis
  @transcoder = transcoder
end

Public Instance Methods

fail(ctx, err) click to toggle source
# File lib/redpack-ruby/responders.rb, line 47
def fail(ctx, err)
  if ctx.REQUEST? then
    self.send(ctx.response_queue_name, ctx.msg_id, err, nil)        
  end
end
ok(ctx, result) click to toggle source
# File lib/redpack-ruby/responders.rb, line 41
def ok(ctx, result)
  if ctx.REQUEST? then
    self.send(ctx.response_queue_name, ctx.msg_id, nil, result)
  end
end
send(response_queue_name, msg_id, err, retval) click to toggle source
# File lib/redpack-ruby/responders.rb, line 36
def send(response_queue_name, msg_id, err, retval)
  v = {:data => [RedPack::Consts::RESPONSE, msg_id, err, retval]}
  @redis.rpush(response_queue_name, @transcoder.pack(v))                   
end