Sha256: 14d7566fc3913f656e540bdb66ef1afd111809c4c21ddde54cdced221d564ee3
Contents?: true
Size: 846 Bytes
Versions: 4
Compression:
Stored size: 846 Bytes
Contents
# frozen_string_literal: true require "sneakers" require "rabbit" require "rabbit/receiving/receive" class Rabbit::Receiving::Worker include Sneakers::Worker def work_with_params(message, delivery_info, arguments) # args and info have custom rabbit classes, have to convert them to hash receive_message(message, delivery_info.to_h, arguments.to_h) ack! rescue => error handle_error!(error) end def receive_message(message, delivery_info, arguments) Rabbit::Receiving::Receive.new( message: message.dup.force_encoding("UTF-8"), delivery_info: delivery_info, arguments: arguments, ).call end def handle_error!(error) raise if Rabbit.config.environment == :test Rabbit.config.exception_notifier.call(error) # wait to prevent queue overflow sleep 1 requeue! end end
Version data entries
4 entries across 4 versions & 1 rubygems