Sha256: c3b239697b2f9e0180f174ec68c1a89b0327cb72ba7eb1e2c68876fb5088d4bc

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 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

      def self.queue_name
        "rollbar_#{Rollbar.configuration.environment}"
      end

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

      ## responsible for performing job. - payload is a json parsed body of the message.
      def perform(_sqs_message, payload)
        Rollbar.process_from_async_handler(payload)
      end

      ## to push the job !
      def call(payload)
        self.class.perform_async(payload)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rollbar-2.16.4 lib/rollbar/delay/shoryuken.rb
rollbar-2.16.3 lib/rollbar/delay/shoryuken.rb
rollbar-2.16.2 lib/rollbar/delay/shoryuken.rb
rollbar-2.16.0 lib/rollbar/delay/shoryuken.rb
rollbar-2.15.6 lib/rollbar/delay/shoryuken.rb
rollbar-2.15.5 lib/rollbar/delay/shoryuken.rb
rollbar-2.15.4 lib/rollbar/delay/shoryuken.rb
rollbar-2.15.3 lib/rollbar/delay/shoryuken.rb
rollbar-2.15.2 lib/rollbar/delay/shoryuken.rb