Class: FFWD::Plugin::Protobuf::InputUDP
- Inherits:
-
Connection
- Object
- Connection
- FFWD::Plugin::Protobuf::InputUDP
- Includes:
- EM::Protocols::FrameObjectProtocol, Logging
- Defined in:
- lib/ffwd/plugin/protobuf.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(bind, core, config) ⇒ InputUDP
constructor
A new instance of InputUDP.
- #receive_data(datagram) ⇒ Object
Constructor Details
#initialize(bind, core, config) ⇒ InputUDP
Returns a new instance of InputUDP.
67 68 69 70 |
# File 'lib/ffwd/plugin/protobuf.rb', line 67 def initialize bind, core, config @bind = bind @core = core end |
Class Method Details
.plugin_type ⇒ Object
72 73 74 |
# File 'lib/ffwd/plugin/protobuf.rb', line 72 def self.plugin_type "protobuf" end |
Instance Method Details
#receive_data(datagram) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ffwd/plugin/protobuf.rb', line 76 def receive_data datagram Serializer.load(datagram) do |type, data| if type == :event @core.input.event data @bind.increment :received_events next end if type == :metric @core.input.metric data @bind.increment :received_metrics next end end rescue => e log.error "Failed to receive data", e if log.debug? log.debug("DUMP: " + FFWD.dump2hex(datagram)) end end |