Sha256: 2a3638d0716ab42d93224a93cb10442c97453ef0fbe4a111b5594c289d629883

Contents?: true

Size: 1.29 KB

Versions: 36

Compression:

Stored size: 1.29 KB

Contents

module Toiler
  module Aws
    # SQS Message abstraction
    # Provides methods for querying and acting on a SQS message
    class Message
      attr_accessor :client, :queue_url, :data

      def initialize(client, queue_url, data)
        @client = client
        @queue_url = queue_url
        @data = data
      end

      def delete
        client.delete_message(
          queue_url: queue_url,
          receipt_handle: data.receipt_handle
        )
      end

      def change_visibility(options)
        client.change_message_visibility(
          options.merge(queue_url: queue_url, receipt_handle: receipt_handle)
        )
      end

      def visibility_timeout=(timeout)
        client.change_message_visibility(
          queue_url: queue_url,
          receipt_handle: data.receipt_handle,
          visibility_timeout: timeout
        )
      end

      def message_id
        data.message_id
      end

      def receipt_handle
        data.receipt_handle
      end

      def md5_of_body
        data.md5_of_body
      end

      def body
        data.body
      end

      def attributes
        data.attributes
      end

      def md5_of_message_attributes
        data.md5_of_message_attributes
      end

      def message_attributes
        data.message_attributes
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
toiler-0.6.1 lib/toiler/aws/message.rb
toiler-0.6.0 lib/toiler/aws/message.rb
toiler-0.6.0.pre1 lib/toiler/aws/message.rb
toiler-0.5.1 lib/toiler/aws/message.rb
toiler-0.5.1.pre9 lib/toiler/aws/message.rb
toiler-0.5.1.pre7 lib/toiler/aws/message.rb
toiler-0.5.1.pre6 lib/toiler/aws/message.rb
toiler-0.5.1.pre5 lib/toiler/aws/message.rb
toiler-0.5.1.pre4 lib/toiler/aws/message.rb
toiler-0.5.1.pre3 lib/toiler/aws/message.rb
toiler-0.5.1.pre2 lib/toiler/aws/message.rb
toiler-0.5.1.pre1 lib/toiler/aws/message.rb
toiler-0.5.0 lib/toiler/aws/message.rb
toiler-0.4.3 lib/toiler/aws/message.rb
toiler-0.4.2 lib/toiler/aws/message.rb
toiler-0.4.1 lib/toiler/aws/message.rb
toiler-0.4.0 lib/toiler/aws/message.rb
toiler-0.4.0.beta1 lib/toiler/aws/message.rb
toiler-0.3.5 lib/toiler/aws/message.rb
toiler-0.3.4 lib/toiler/aws/message.rb