Skip to content

Usage

Version: 1.0.0

The standard ESF DB wire components can be used to interact with a MySQL database. They can be found in the Wire Components list under the Emitters/Receivers section of the Wire Graph tab.

DB Store

The ESF DB Store component allows the wire graphs to interact with a database instance. It stores in a user-defined table all the envelopes received by the component. The component can be configured as follows:

  • table.name (mandatory) is the name of the table to be created.
  • maximum.table.size (mandatory) is the maximum size of the table.
  • cleanup.records.keep (mandatory) is the number of records in the table to keep while performing a cleanup operation.
  • DbService Target Filter (mandatory) is the database instance used by the wire component.

MysqlStore

DB Filter

The ESF DB Filter component can run a custom SQL query on the provided database. It can be configured as follows:

  • sql.view (mandatory) is the SQL to be executed to build a view.
  • cache.expiration.interval (mandatory) is the cache validity in seconds. When the cache expires, a new read in the database will be performed.
  • MySQLDbService Target Filter (mandatory) is the database instance used by the wire component.
  • emit.on.empty.result (mandatory) defines the behaviour of the component if the result of the performed query is empty. If set to true, an empty envelope will be emitted in this case, if set to false no envelopes will be emitted.

Attention

Do not surround the table or columns names with double-quotes in the sql.view field.

MysqlFilter

Example

The following wire graph is an example on how these components can be used. The Timer emits an envelope at fixed rate that triggers a DB Store and a DB Filter components. The DB Store will save the content of the incominf envelope in the configured database. The DB Filter, instead, will perform a SQL query on the same database and emits the results to a Logger.

MysqlWireGraph