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.
24 lines
487 B
Ruby
24 lines
487 B
Ruby
|
|
require "lib/net/message"
|
|
|
|
module LogStash; module Net; module Messages
|
|
class PingRequest < RequestMessage
|
|
register
|
|
|
|
def initialize
|
|
super
|
|
self.pingdata = Time.now.to_f
|
|
end
|
|
|
|
# Message attributes
|
|
hashbind :pingdata, "/args/pingdata"
|
|
|
|
end # class PingRequest
|
|
|
|
class PingResponse < ResponseMessage
|
|
register
|
|
|
|
# Message attributes
|
|
hashbind :pingdata, "/args/pingdata"
|
|
end # class PingResponse
|
|
end; end; end # module LogStash::Net::Messages
|