Sha256: 727ec2985b5b869e0004f0a910dee3cf41810ab1164f2987aac6c06ce0a3b57e

Contents?: true

Size: 988 Bytes

Versions: 2

Compression:

Stored size: 988 Bytes

Contents

require 'avromatic/version'
require 'avromatic/model'
require 'avro_turf'
require 'avro_turf/messaging'

module Avromatic
  class << self
    attr_accessor :registry_url, :schema_store, :logger, :messaging
  end

  self.logger = Logger.new($stdout)

  def self.configure
    yield self
  end

  def self.build_schema_registry
    raise 'Avromatic must be configured with a registry_url' unless registry_url
    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)
  end

  def self.build_messaging!
    self.messaging = build_messaging
  end
end

require 'avromatic/railtie' if defined?(Rails)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avromatic-0.1.2 lib/avromatic.rb
avromatic-0.1.2.pre.rc0 lib/avromatic.rb