class Deimos::SchemaBackends::AvroSchemaRegistry

Encode / decode using the Avro schema registry.

Public Instance Methods

decode_payload(payload, schema:) click to toggle source

@override

# File lib/deimos/schema_backends/avro_schema_registry.rb, line 12
def decode_payload(payload, schema:)
  avro_turf_messaging.decode(payload, schema_name: schema)
end
encode_payload(payload, schema: nil, topic: nil) click to toggle source

@override

# File lib/deimos/schema_backends/avro_schema_registry.rb, line 17
def encode_payload(payload, schema: nil, topic: nil)
  avro_turf_messaging.encode(payload, schema_name: schema, subject: topic || schema)
end

Private Instance Methods

avro_turf_messaging() click to toggle source

@return [AvroTurf::Messaging]

# File lib/deimos/schema_backends/avro_schema_registry.rb, line 24
def avro_turf_messaging
  @avro_turf_messaging ||= AvroTurf::Messaging.new(
    schema_store: @schema_store,
    registry_url: Deimos.config.schema.registry_url,
    schemas_path: Deimos.config.schema.path,
    namespace: @namespace
  )
end