Skip to content

Kura Wire Graph Setup

In the Kura Wire Graph, it is possible to interact with a PostgreSQL® database using the following Wire Components:

  • Wire Record Store: allows to store the received WireRecords into a specific table of the database.
  • Wire Record Query: allows to perform a query in PostgreSQL® syntax and emit the result as a list of WireRecords.

After having set up a PostgreSQL® and the PostgreSQL® Client in an ESF installation, head over to the Wire Graph section of the ESF UI. Drag and drop the following items into the graph and arrange them as in the picture below:

  • Timer: 5 seconds, or whatever desired timing.
  • Wire Record Store
  • Wire Record Query
  • Logger: set to VERBOSE mode.

The Wire Record Store and Wire Record Query components are configured as follows.

Wire Record Store Configuration

The Wire Record Store is configured to store the data in table WR_DATA. Note that if the table does not exist the first time a record arrives, it will be created. The maximum table size is limited to 10000 and the number of records to keep after a cleanup (triggered when the table has reached the limit) is set to 5000. The WireRecordStoreProvider Target Filter instead has been set to the PID of the previously created com.eurotech.framework.postgresql.client.provider.PostgresqlClientService instance.

Warning

The Wire Record Store component will create new columns if the type of the received metric does not match any existing column. The column gets instead erased and recreated if there is a type mismatch.

It is recommended to limit the number of column creations since a default PostgreSQL® installation supports a maximum of 1600 columns. Keep in mind that a drop column statement in PostgreSQL® simply marks a column as dropped, it does not delete it (reference). A common stack trace if the limits get exceeded is:

org.postgresql.util.PSQLException: ERROR: tables can have at most 1600 columns

Wire Record Query Configuration

The query to perform is specified inside the Query field; in this case, a simple count on the table is performed. The Cache Expiration Interval (Seconds) is set to 0, meaning that no cache is maintained when emitting the result. The QueryableWireRecordStoreProvider Target Filter has been set to the previously created com.eurotech.framework.postgresql.client.provider.PostgresqlClientService instance and the component is set to not emit anything if the query does not produce any result.