Class: GlassOctopus::Middleware::AvroParser
- Inherits:
-
Object
- Object
- GlassOctopus::Middleware::AvroParser
- Defined in:
- lib/glass_octopus/middleware/avro_parser.rb
Defined Under Namespace
Classes: ContextWithAvroParsedMessage
Instance Method Summary collapse
- #call(ctx) ⇒ Object
-
#initialize(app, schema_registry_url, options = {}) ⇒ AvroParser
constructor
A new instance of AvroParser.
Constructor Details
#initialize(app, schema_registry_url, options = {}) ⇒ AvroParser
Returns a new instance of AvroParser.
12 13 14 15 |
# File 'lib/glass_octopus/middleware/avro_parser.rb', line 12 def initialize(app, schema_registry_url, ={}) @app = app @decoder = AvroTurf::Messaging.new(registry_url: schema_registry_url, logger: [:logger]) end |
Instance Method Details
#call(ctx) ⇒ Object
17 18 19 20 21 |
# File 'lib/glass_octopus/middleware/avro_parser.rb', line 17 def call(ctx) = @decoder.decode(ctx..value) ctx = ContextWithAvroParsedMessage.new(ctx, ) @app.call(ctx) end |