lib/avromatic.rb in avromatic-0.1.2 vs lib/avromatic.rb in avromatic-0.2.0
- old
+ new
@@ -3,11 +3,11 @@
require 'avro_turf'
require 'avro_turf/messaging'
module Avromatic
class << self
- attr_accessor :registry_url, :schema_store, :logger, :messaging
+ attr_accessor :schema_registry, :registry_url, :schema_store, :logger, :messaging
end
self.logger = Logger.new($stdout)
def self.configure
@@ -19,15 +19,14 @@
AvroTurf::CachedSchemaRegistry.new(
AvroTurf::SchemaRegistry.new(registry_url, logger: logger))
end
def self.build_messaging
- raise 'Avromatic must be configured with a registry_url' unless registry_url
raise 'Avromatic must be configured with a schema_store' unless schema_store
AvroTurf::Messaging.new(
- registry_url: Avromatic.registry_url,
- schema_store: Avromatic.schema_store,
- logger: Avromatic.logger)
+ registry: schema_registry || build_schema_registry,
+ schema_store: schema_store,
+ logger: logger)
end
def self.build_messaging!
self.messaging = build_messaging
end