AvroMachine
Easily create a server that accepts Avro messages
Installation
Add this line to your application's Gemfile:
gem 'avro_machine'
And then execute:
$ bundle
Or install it yourself as:
$ gem install avro_machine
Usage
Create a responder class that inherits from Avro::IPC::Responder
:
class MyResponder < AvroMachine::Responder
def self.protocol
# return an Avro::Protocol
end
# assume this protocol defines a message1 that returns a string
def (request)
"foo"
end
# assume this protocols defines a message2 that returns an array<int>
def (request)
[1,2,3]
end
end
Extend the AvroMachine::Connection
class and define a responder
class:
class MyConnection < AvroMachine::Connection
def self.responder
MyResponder
end
end
See the example in the example folder.
Contributing
- Fork it ( https://github.com/[my-github-username]/avro_machine/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request