lib/rabbit.rb in rabbit_messaging-0.13.0 vs lib/rabbit.rb in rabbit_messaging-0.15.0

- old
+ new

@@ -20,11 +20,12 @@ attribute :project_id, Symbol attribute :hooks, default: {} attribute :environment, Symbol, default: :production attribute :queue_name_conversion attribute :receiving_job_class_callable - attribute :exception_notifier, default: -> { default_exception_notifier } + attribute :handler_resolver_callable + attribute :exception_notifier attribute :before_receiving_hooks, default: [] attribute :after_receiving_hooks, default: [] attribute :skip_publishing_in, default: %i[test development] attribute :receive_logger, default: lambda { @@ -38,12 +39,13 @@ attribute :malformed_logger, default: lambda { Logger.new(Rails.root.join("log", "malformed_messages.log")) } def validate! - raise InvalidConfig, "mising project_id" unless project_id - raise InvalidConfig, "mising group_id" unless group_id + raise InvalidConfig, "missing project_id" unless project_id + raise InvalidConfig, "missing group_id" unless group_id + raise InvalidConfig, "missing exception_notifier" unless exception_notifier unless environment.in? %i[test development production] raise "environment should be one of (test, development, production)" end end @@ -55,26 +57,23 @@ def app_name [group_id, project_id].join(".") end alias_method :read_queue, :app_name - - private - - def default_exception_notifier - -> (e) { Sentry.capture_exception(e) } - end end extend self def config @config ||= Config.new yield(@config) if block_given? @config end - alias_method :configure, :config + def configure + yield(config) + config.validate! + end def publish(message_options) message = Publishing::Message.new(message_options) if message.realtime?