Class: Fluent::CassandraUpdatetor

Inherits:
BufferedOutput
  • Object
show all
Includes:
CassandraConnection
Defined in:
lib/fluent/plugin/out_cassandra_update.rb

Instance Method Summary collapse

Methods included from CassandraConnection

#get_session

Instance Method Details

#configure(conf) ⇒ Object

shutdown



33
34
35
36
37
38
# File 'lib/fluent/plugin/out_cassandra_update.rb', line 33

def configure(conf)
  super

  @updateValue = self.update_value
  @whereCondUpd = self.where_condition_upd
end

#format(tag, time, record) ⇒ Object

configure



40
41
42
# File 'lib/fluent/plugin/out_cassandra_update.rb', line 40

def format(tag, time, record)
  record.to_msgpack
end

#shutdownObject

start



28
29
30
31
# File 'lib/fluent/plugin/out_cassandra_update.rb', line 28

def shutdown
  super
  @session.close if @session
end

#startObject



23
24
25
26
# File 'lib/fluent/plugin/out_cassandra_update.rb', line 23

def start
  super
  @session ||= get_session(self.host, self.port, self.keyspace, self.connect_timeout, self.username, self.password)
end

#write(chunk) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/fluent/plugin/out_cassandra_update.rb', line 44

def write(chunk)
  chunk.msgpack_each { |record|

    whereCondition = prepareParameter(@whereCondUpd, record)

    @updateValue = prepareParameter(@updateValue, record)
    updateCassandra(@updateValue, whereCondition)

  }
end