Module: Karafka::Parsers::Avro

Defined in:
lib/karafka/parsers/avro.rb,
lib/karafka/parsers/avro/parser.rb,
lib/karafka/parsers/avro/version.rb

Defined Under Namespace

Classes: Parser

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.from_path(schema_name, codec: nil) ⇒ Object

Raises:

  • (ArgumentError)


26
27
28
29
30
# File 'lib/karafka/parsers/avro.rb', line 26

def self.from_path(schema_name, codec: nil)
  raise ArgumentError, 'You have to specify schemas_path first' if @schemas_path.nil?

  Parser.new(AvroTurf.new(schemas_path: @schemas_path, codec: codec), schema_name)
end

.from_registry(schema_name = nil) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
24
# File 'lib/karafka/parsers/avro.rb', line 20

def self.from_registry(schema_name = nil)
  raise ArgumentError, 'You have to specify registry_path first' if @registry_url.nil?

  Parser.new(AvroTurf::Messaging.new(registry_url: @registry_url), schema_name)
end

.registry_url=(registry_url) ⇒ Object



12
13
14
# File 'lib/karafka/parsers/avro.rb', line 12

def self.registry_url=(registry_url)
  @registry_url = registry_url
end

.schemas_path=(schemas_path) ⇒ Object



16
17
18
# File 'lib/karafka/parsers/avro.rb', line 16

def self.schemas_path=(schemas_path)
  @schemas_path = schemas_path
end