module Avromatic
Constants
- VERSION
Attributes
Public Class Methods
Source
# File lib/avromatic.rb, line 52 def self.build_messaging raise 'Avromatic must be configured with a schema_store' unless schema_store Avromatic::Messaging.new( registry: schema_registry || build_schema_registry, schema_store: schema_store, logger: logger ) end
Source
# File lib/avromatic.rb, line 62 def self.build_messaging! self.messaging = build_messaging end
Source
# File lib/avromatic.rb, line 34 def self.build_schema_registry raise 'Avromatic must be configured with a registry_url' unless registry_url if use_schema_fingerprint_lookup AvroSchemaRegistry::CachedClient.new( AvroSchemaRegistry::Client.new(registry_url, logger: logger) ) else AvroTurf::CachedConfluentSchemaRegistry.new( AvroTurf::ConfluentSchemaRegistry.new(registry_url, logger: logger) ) end end
Source
# File lib/avromatic.rb, line 48 def self.build_schema_registry! self.schema_registry = build_schema_registry end
Source
# File lib/avromatic.rb, line 30 def self.configure yield self end
Source
# File lib/avromatic.rb, line 85 def self.eager_load_models @eager_load_model_names end
Source
# File lib/avromatic.rb, line 81 def self.eager_load_models=(models) @eager_load_model_names = Array(models).map { |model| model.is_a?(Class) ? model.name : model }.freeze end
Source
# File lib/avromatic.rb, line 68 def self.prepare! nested_models.clear if schema_store if schema_store.respond_to?(:clear_schemas) schema_store.clear_schemas elsif schema_store.respond_to?(:clear) schema_store.clear end end eager_load_models! end
This method is called as a Rails to_prepare hook after the application first initializes during boot-up and prior to each code reloading.
Private Class Methods
Source
# File lib/avromatic.rb, line 89 def self.eager_load_models! @eager_load_model_names&.each { |model_name| model_name.constantize.register! } end