Class LineProtocolWriter

java.lang.Object
com.influxdb.client.osgi.LineProtocolWriter
All Implemented Interfaces:
org.osgi.service.event.EventHandler

public class LineProtocolWriter extends Object implements org.osgi.service.event.EventHandler
OSGi event handler writing InfluxDB line protocol records.

Service is used to write RAW (line protocol) event data to InfluxDB. OSGi event topic DEFAULT_EVENT_TOPIC used by default. The following OSGi event properties are supported:

  • record (String): value must be a single line protocol record
  • records (List): value must be a list of line protocol records
  • precision (String, optional): write precision, values: s, ms, us, ns, default: ns
  • organization (String, optional): used to override InfluxDB organization of LineProtocolWriter service (by event).
  • bucket (String, optional): used to override InfluxDB bucket of LineProtocolWriter service (by event).

One of record or records must be set.

Timestamp is appended to the line protocol record if it is enabled by configuration option (in that case records must not contain timestamp data!). Value is read from OSGi event (property EventConstants.TIMESTAMP) or System.currentTimeMillis() is set if property not found.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Configuration for Line Protocol Writer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    OSGi event property name to override InfluxDB bucket.
    static final String
    Default OSGi event topic.
    static final String
    OSGi event property name to override InfluxDB organization.
    static final String
    OSGi event property name to set precision.
    static final String
    OSGi event property name used to write single line protocol record.
    static final String
    OSGi event property name used to write list of line protocol records.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleEvent(org.osgi.service.event.Event event)
    Write line protocol record from OSGi event.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_EVENT_TOPIC

      public static final String DEFAULT_EVENT_TOPIC
      Default OSGi event topic.
      See Also:
    • RECORD

      public static final String RECORD
      OSGi event property name used to write single line protocol record.
      See Also:
    • RECORDS

      public static final String RECORDS
      OSGi event property name used to write list of line protocol records.
      See Also:
    • PRECISION

      public static final String PRECISION
      OSGi event property name to set precision.
      See Also:
    • ORGANIZATION

      public static final String ORGANIZATION
      OSGi event property name to override InfluxDB organization.
      See Also:
    • BUCKET

      public static final String BUCKET
      OSGi event property name to override InfluxDB bucket.
      See Also:
  • Constructor Details

    • LineProtocolWriter

      public LineProtocolWriter()
  • Method Details

    • handleEvent

      public void handleEvent(org.osgi.service.event.Event event)
      Write line protocol record from OSGi event.
      Specified by:
      handleEvent in interface org.osgi.service.event.EventHandler
      Parameters:
      event - OSGI event containing data