Module: Avromatic

Defined in:
lib/avromatic.rb,
lib/avromatic/model.rb,
lib/avromatic/railtie.rb,
lib/avromatic/version.rb,
lib/avromatic/model/builder.rb,
lib/avromatic/model/attributes.rb,
lib/avromatic/model/custom_type.rb,
lib/avromatic/model/configurable.rb,
lib/avromatic/model/value_object.rb,
lib/avromatic/model/configuration.rb,
lib/avromatic/model/type_registry.rb,
lib/avromatic/model/message_decoder.rb,
lib/avromatic/model/null_custom_type.rb,
lib/avromatic/model/raw_serialization.rb,
lib/avromatic/model/passthrough_serializer.rb,
lib/avromatic/model/messaging_serialization.rb

Defined Under Namespace

Modules: Model Classes: Railtie

Constant Summary collapse

VERSION =
'0.6.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/avromatic.rb', line 8

def logger
  @logger
end

.messagingObject

Returns the value of attribute messaging.



8
9
10
# File 'lib/avromatic.rb', line 8

def messaging
  @messaging
end

.registry_urlObject

Returns the value of attribute registry_url.



8
9
10
# File 'lib/avromatic.rb', line 8

def registry_url
  @registry_url
end

.schema_registryObject

Returns the value of attribute schema_registry.



8
9
10
# File 'lib/avromatic.rb', line 8

def schema_registry
  @schema_registry
end

.schema_storeObject

Returns the value of attribute schema_store.



8
9
10
# File 'lib/avromatic.rb', line 8

def schema_store
  @schema_store
end

.type_registryObject

Returns the value of attribute type_registry.



8
9
10
# File 'lib/avromatic.rb', line 8

def type_registry
  @type_registry
end

Class Method Details

.build_messagingObject



28
29
30
31
32
33
34
35
# File 'lib/avromatic.rb', line 28

def self.build_messaging
  raise 'Avromatic must be configured with a schema_store' unless schema_store
  AvroTurf::Messaging.new(
    registry: schema_registry || build_schema_registry,
    schema_store: schema_store,
    logger: logger
  )
end

.build_messaging!Object



37
38
39
# File 'lib/avromatic.rb', line 37

def self.build_messaging!
  self.messaging = build_messaging
end

.build_schema_registryObject



21
22
23
24
25
26
# File 'lib/avromatic.rb', line 21

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

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Avromatic)

    the object that the method was called on



17
18
19
# File 'lib/avromatic.rb', line 17

def self.configure
  yield self
end