Sha256: 6de8b6ebe5d7fa6d93bff9ce4e4b4947c08db6050b992ec4a219d0e273997ed6

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

module Alephant
  module Publisher
    module SQSHelper
      class Archiver
        attr_reader :cache

        def initialize(cache)
          @cache = cache
        end

        def see(message)
          return if message.nil?

          message.tap do |m|
            cache.put(
              "archive/#{m.id}",
              m.body,
              message_meta_for(m)
            )
          end
        end

        private

        def message_meta_for(m)
          {
            :id                => m.id,
            :md5               => m.md5,
            :logged_at         => Time.now.to_s,
            :queue             => m.queue.url,
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alephant-publisher-0.2.7 lib/alephant/publisher/sqs_helper/archive.rb
alephant-publisher-0.2.6 lib/alephant/publisher/sqs_helper/archive.rb