Sha256: c68109c11d7f4e4432ebac2851ce2722f2ceae66e8ef37e20aedd7cfbc653109
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
# frozen_string_literal: true module PubSubModelSync class Config cattr_accessor(:subscribers) { [] } cattr_accessor(:service_name) { :google } # customizable callbacks cattr_accessor(:debug) { false } cattr_accessor :logger # LoggerInst cattr_accessor(:transactions_max_buffer) { 100 } cattr_accessor(:enable_rails4_before_commit) { Rails::VERSION::MAJOR == 4 } cattr_accessor(:on_before_processing) { ->(_payload, _info) {} } # return :cancel to skip cattr_accessor(:on_success_processing) { ->(_payload, _info) {} } cattr_accessor(:on_error_processing) { ->(_exception, _info) {} } cattr_accessor(:on_before_publish) { ->(_payload) {} } # return :cancel to skip cattr_accessor(:on_after_publish) { ->(_payload) {} } cattr_accessor(:on_error_publish) { ->(_exception, _info) {} } # google service cattr_accessor :project, :credentials, :topic_name, :subscription_name, :default_topic_name # rabbitmq service cattr_accessor :bunny_connection, :topic_name, :subscription_name, :default_topic_name # kafka service cattr_accessor :kafka_connection, :topic_name, :subscription_name, :default_topic_name def self.log(msg, kind = :info) msg = "PS_MSYNC ==> #{msg}" if logger == :raise_error kind == :error ? raise(msg) : puts(msg) else logger ? logger.send(kind, msg) : puts(msg) end end def self.subscription_key klass = Rails.application.class app_name = klass.respond_to?(:module_parent_name) ? klass.module_parent_name : klass.parent_name subscription_name || app_name end class << self alias default_topic_name_old default_topic_name def default_topic_name default_topic_name_old || Array(topic_name).first end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pub_sub_model_sync-1.0.beta2 | lib/pub_sub_model_sync/config.rb |
pub_sub_model_sync-1.0.beta1 | lib/pub_sub_model_sync/config.rb |