Sha256: 6af2fc55c9537fae439f14655e58c3b802f0f4d538bcf15a983a1885e5463986

Contents?: true

Size: 945 Bytes

Versions: 4

Compression:

Stored size: 945 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_source_protocol'

host = 'localhost'
port = 3586

socket = Thrift::Socket.new host, port.to_i
transport = Thrift::FramedTransport.new socket
protocol = Thrift::CompactProtocol.new transport
client = ThriftSourceProtocol::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,
                             :headers => {
                               'timestamp' => (Time.now.to_i * 1000).to_s,
                               'tag'       => tag,
                             })
client.append entry

transport.close

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluent-plugin-flume-1.0.0.rc1 bin/fluent-flume-remote
fluent-plugin-flume-0.2.0 bin/fluent-flume-remote
fluent-plugin-flume-0.1.3 bin/fluent-flume-remote
fluent-plugin-flume-0.1.2 bin/fluent-flume-remote