Sha256: 5df7758bd5e8477ba87ec3c9ee4343544d30d38f98ebb46a1228a41e47bb0d50

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

require 'shoryuken'

module Rollbar
  module Delay
    # Following class allows to send rollbars using Sho-ryu-ken as a background
    # jobs processor. See the queue_name method which states that your queues
    # needs to be names as "rollbar_ENVIRONMENT". Retry intervals will be used
    # to retry sending the same message again if failed before.
    class Shoryuken
      include ::Shoryuken::Worker

      class << self
        attr_accessor :queue
      end

      self.queue = "rollbar_#{Rollbar.configuration.environment}"

      def self.call(payload)
        new.call(payload, :queue => queue)
      end

      def call(payload, options = {})
        self.class.perform_async(payload, options)
      end

      # not allowing bulk, to not double-report rollbars if one of them failed in bunch.
      shoryuken_options :auto_delete => true,
                        :body_parser => :json,
                        :retry_intervals => [60, 180, 360, 120_0, 360_0, 186_00]

      def perform(_sqs_message, payload)
        Rollbar.process_from_async_handler(payload)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rollbar-3.6.0 lib/rollbar/delay/shoryuken.rb
rollbar-3.5.2 lib/rollbar/delay/shoryuken.rb
rollbar-3.5.1 lib/rollbar/delay/shoryuken.rb
rollbar-3.5.0 lib/rollbar/delay/shoryuken.rb
rollbar-3.4.2 lib/rollbar/delay/shoryuken.rb
rollbar-3.4.1 lib/rollbar/delay/shoryuken.rb
rollbar-3.4.0 lib/rollbar/delay/shoryuken.rb
rollbar-3.3.3 lib/rollbar/delay/shoryuken.rb
rollbar-3.3.2 lib/rollbar/delay/shoryuken.rb
rollbar-3.3.1 lib/rollbar/delay/shoryuken.rb
rollbar-3.3.0 lib/rollbar/delay/shoryuken.rb