Striim 3.9.4 / 3.9.5 documentation

Acquire the data using a source

As discussed in TQL programming rules and best practices, you must create a component before you can reference it in another component. This means that the first step in writing a TQL application is to create a source.

Save the following as …/Striim/Samples/simple.tql:

CREATE APPLICATION simple;

CREATE source SimpleSource USING FileReader (
  directory:'Samples',
  wildcard:'simple.csv',
  positionByEOF:false
)
PARSE USING DSVParser (
  header:Yes,
  trimquote:false
) OUTPUT TO RawDataStream;

CREATE TARGET SimpleRawOutput
USING SysOut(name:simpleRaw)
INPUT FROM RawDataStream;;

END APPLICATION simple;

The SysOut adapter writes the output to striim-node.log (see Reading log files). Alternatively, you may run Striim as a process (Running Striim as a process), in which case SysOut will write to the server terminal. This is useful for initial development since you can verify that the data is as expected at each step.

Load, deploy, and start simple.tql as described in Loading and reloading TQL applications during development. You should see the contents of RawDataStream in striim-node.log. Note that if you are running Striim as a process, SysOut output will be written to the terminal running the server process rather than to striim-node.log):

simple: WAEvent{
  data: ["COMPANY 1","D6RJPwyuLXoLqQRQcOcouJ26KGxJSf6hgbu","6705362103919221351","0",
"20130312173210","0916","USD","2.20","5150279519809946","41363","Quicksand"]
  metadata: {"FileName":"simple.csv","FileOffset":138}
  before: null
  dataPresenceBitMap: "AAA="
  beforePresenceBitMap: "AAA="
  typeUUID: null
};
simple: WAEvent{
  data: ["COMPANY 2","OFp6pKTMg26n1iiFY00M9uSqh9ZfMxMBRf1","4710011837121304048","4",
"20130312173210","0815","USD","22.78","5985180438915120","16950","Westfield"]
  metadata: {"FileName":"simple.csv","FileOffset":268}
  before: null
  dataPresenceBitMap: "AAA="
  beforePresenceBitMap: "AAA="
  typeUUID: null
}; 

The second and third lines of simple.csv have been converted to events. WAEvent is the Striim type used for FileReader output. The data field for each event is an array containing the comma-delimited fields from the source file. The five other fields are not used by this application.