Sha256: 6f232b8c1a9a6dd37dcdf2ea5708abf6f9a18d8b2a4cfc612d0e2d2bf517b5c7

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

module Pousse

  class RedisDelivery
    def initialize values = {}
      configuration = Pousse::configuration
      @redis_config = configuration.redis
    end

    def deliver!(mail)
      redis = nil
      begin
        redis = Redis.new @redis_config
        mail.to.each do |to|
          redis.publish(to, mail.body.decoded)
        end
      rescue Exception => e
        #TODO: Use a real logguer ??
        puts "NOTIFICATION NOT DELIVERED: #{e.message}"
      ensure
        redis.quit unless redis.nil?
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pousse-0.0.6 lib/pousse/redis_delivery.rb
pousse-0.0.5 lib/pousse/redis_delivery.rb