Sha256: c42a63ba8d6c3a6207d5764677339ff84e35582d3f3f3b75add1259c5358c2a4

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

#!/usr/bin/env ruby
require 'thrift'
require 'json'
$:.unshift File.join(File.dirname(__FILE__), '../lib/fluent/plugin/thrift')
require 'flume_types'
require 'flume_constants'
require 'thrift_flume_event_server'

host = 'localhost'
port = 3586

socket = Thrift::Socket.new host, port.to_i
transport = Thrift::BufferedTransport.new socket
protocol = Thrift::BinaryProtocol.new transport
client = ThriftFlumeEventServer::Client.new protocol
transport.open

# 2011/09/02 Kazuki Ohta <kazuki.ohta@gmail.com>
# explicitly specify TCP_NODELAY for low-latency communication.
raw_sock = socket.to_io
raw_sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1

entry = ThriftFlumeEvent.new(:body=>{'a'=>'b'}.to_json,
                             :priority=>Priority::INFO,
                             :timestamp=>(Time.now.to_i * 1000))
client.append entry

transport.close

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-flume-0.1.1 bin/fluent-flume-remote
fluent-plugin-flume-0.1.0 bin/fluent-flume-remote