Striim 3.9.8 documentation

CREATE EXTERNAL CACHE

Note

In this release, this is not a cache. Striim queries the external database as data is needed. If the same data is needed again, Striim queries it again.

CREATE EXTERNAL CACHE <name> (
  AdapterName:'DatabaseReader',
  Username: '<username>',
  Password: '<password>',
  ConnectionURL: '<database connection string>',
  ConnectionRetry: <parameters>,
  FetchSize: <count>,
  Table: '<table name>',
  Columns: '<colums to read>',
  KeyToMap: '<column name>',
  SkipInvalid: <True / False>
)  
OF <type name>;
  • AdapterName must be DatabaseReader.

  • For Username, Password, ConnectionURL, FetchSize and discussion of whether you need to install a JDBC driver, see Database Reader.

  • With the default setting, if a connection attempt is unsuccessful, the adapter will try again in 30 seconds (retryInterval. If the second attempt is unsuccessful, in 30 seconds it will try a third time (maxRetries). If that is unsuccessful, the adapter will fail and log an exception. Negative values are not supported.

  • For Table, specify a single table. See the discussion of the Tables property in Database Reader for additional information.

  • For Columns, specify the names of the columns you wish to retrieve, separated by commas.

  • For KeyToMap specify the table's primary key column. If the table has no primary key, specify any column.

  • When skipinvalid has its default value of False, if the data in a cache does not match the defined format (for example, if it has fewer fields that are in the type), the application will crash. To skip invalid records, set to True.

  • You may omit ConnectionRetry, FetchSize, and SkipInvalid from TQL if their default values are appropriate.

  • The OF type must match the order, number, and data types of the specified columns.

For example:

CREATE TYPE RackType(
  rack_id String KEY,
  datacenter_id String,
  rack_aisle java.lang.Integer,
  rack_row java.lang.Integer,
  slot_count java.lang.Integer
);
CREATE EXTERNAL CACHE ConfiguredRacks (
  AdapterName:'DatabaseReader',
  ConnectionURL:'jdbc:mysql://10.1.10.149/datacenter',
  Username:'username',
  Password:'passwd',
  Table:'RackList',
  Columns: "rack_id,datacenter_id,rack_aisle,rack_row,slot_count",
  KeyToMap: 'rack_id'
)
OF RackType;