mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
hand-code. This method is as fast as the hand-coded method and with less writing. - Make message registration easier with a simple 'register' function: class Foo < Message register end We dynamically generate the message 'type' by the class name.
29 lines
638 B
Ruby
29 lines
638 B
Ruby
|
|
require "lib/net/message"
|
|
|
|
module LogStash; module Net; module Messages
|
|
class IndexEventRequest < RequestMessage
|
|
register
|
|
|
|
def initialize
|
|
super
|
|
self.metadata = Hash.new
|
|
end
|
|
|
|
hashbind :log_type, "/args/type"
|
|
hashbind :log_data, "/args/message"
|
|
hashbind :metadata, "/args/metadata"
|
|
end # class IndexEventRequest
|
|
|
|
class IndexEventResponse < ResponseMessage
|
|
register
|
|
|
|
# Message attributes
|
|
hashbind :code, "/args/code"
|
|
hashbind :error, "/args/error"
|
|
|
|
def success?
|
|
return self.code == 0
|
|
end
|
|
end # class IndexEventResponse
|
|
end; end; end # module LogStash::Net::Messages
|