Class CassandraLtdbFeeder

java.lang.Object
org.eso.ias.sink.ltdb.CassandraLtdbFeeder

public class CassandraLtdbFeeder extends Object
The helper to interact with cassandra.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Signal that the connection ha sbeen closed
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    getErrors(boolean reset)
    Return the number of errors recorded so far
    long
    getValuesStored(boolean reset)
    Return the number of IASValues stored in the LTDB
    void
    start(String contactPoints, String keyspace, long ttl)
    Connect to cassandra and allocate resources
    void
    Close the connection with cassandra
    void
    store(String jsonString)
    Store the IASValue encoded by the passed JSON string by delegating to store(IASValue)
    void
    store(Collection<String> jsonStrings)
    Store the IASValues encoded by the passed JSON strings by delegating to store(IASValue)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • closed

      public volatile boolean closed
      Signal that the connection ha sbeen closed
  • Constructor Details

    • CassandraLtdbFeeder

      public CassandraLtdbFeeder()
  • Method Details

    • start

      public void start(String contactPoints, String keyspace, long ttl)
      Connect to cassandra and allocate resources
      Parameters:
      contactPoints - Cassandra contact points (nor null neither empty)
      keyspace - keyspace (nor null neither empty)
      ttl - the time to leave in hours (if <=0, no TTL)
    • stop

      public void stop()
      Close the connection with cassandra
    • store

      public void store(Collection<String> jsonStrings)
      Store the IASValues encoded by the passed JSON strings by delegating to store(IASValue)
      Parameters:
      jsonStrings - a collection of JSON strings encoding IASValues
    • store

      public void store(String jsonString)
      Store the IASValue encoded by the passed JSON string by delegating to store(IASValue)
      Parameters:
      jsonString - the JSON string encoding a IASValue
    • getErrors

      public long getErrors(boolean reset)
      Return the number of errors recorded so far
      Parameters:
      reset - if true reset the number of errors recorded so far
      Returns:
      the number of errors
    • getValuesStored

      public long getValuesStored(boolean reset)
      Return the number of IASValues stored in the LTDB
      Parameters:
      reset - if true reset the number of IASValues stored in the LTDB so far
      Returns:
      the number of IASValues stored in the LTDB