summaryrefslogtreecommitdiff
path: root/app/workers/cassandra_writer.rb
blob: 2d2ce1fcf80ff71efe04b33e154de83bfbc3f893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class CassandraWriter
  include Sneakers::Worker
  from_queue "worker.cassandra"

  def work(event_json)
    attributes = JSON.parse(event_json)

    Document.create!(
      agent_id: attributes['agent_id'],
      path: attributes['data']['path'],
      filename: File.basename(attributes['data']['path']),
      fingerprint: attributes["data"]["fingerprint"],
    )
    ack!
  end
end