Loads data into an Event Stream Processor project at a specified rate.
Use esp_playback to test a project. It can send data with a play rate, and upload data to a project from different sources.
[1329258744] started [1329258744] complete: 0 (success) 0 (errors) 0 (%) [1329258746] complete: 1 (success) 0 (errors) 33 (%) [1329258748] complete: 2 (success) 0 (errors) 66 (%) [1329258750] complete: 3 (success) 0 (errors) 100 (%) [1329258750] stoppedWhen a timestamp accompanied with a ‘stopped’ output is displayed, the utility has finished uploading events into ESP project. If any errors occur during the upload, an error message indicates the issue.
You can also slow down or speed up the rate of the playback. Use the -R option to specify the desired rate, either in rows/millisecond, or at a rate determined by the values in a timestamp/datetime column in input data. If you use the latter method, you can specify a timescale rate to speed up or slow down the playback.
Because esp_playback is a testing tool, there are various reasons for slowing down or speeding up the playback. Typically, you adjust the playback rate to verify your calculations and collection of data. When you're confident that your project is configured correctly, you can speed up the playback rate to simulate the anticipated incoming rate of actual data to ensure your project can handle the throughput.
Note that the input speed may influence your calculations. The example below demonstrates how modifying input speed can change the results of calculations due to timing discrepancies. The CCL code below sums the number of shares, numShares, and averages the price, price, of the input from the cbret_006 window.
create schema sharesSchema ( tradeId integer, symbol string, tradeDate date, numShares integer, price float ); CREATE MEMORY STORE "store" PROPERTIES INDEXTYPE ='tree', INDEXSIZEHINT =8; create input window cbret_006a schema sharesSchema primary key(tradeId) STORE "store" ; create output window cbret_006 primary key deduced as select a.tradeId, a.symbol, a.tradeDate, sum(a.numShares) as numShares, avg(a.price) as price from cbret_006a a keep 1 seconds per (symbol) group by a.symbol ;
A sample input of three lines of XML records to be read. The ESP_OPS value i indicates that all three records have an insert opcode.
<cbret_006a ESP_OPS="i" tradeId="1" symbol="EBAY" tradeDate="2000-05-04T12:00:01" numShares="500" price="150.0" /> <cbret_006a ESP_OPS="i" tradeId="2" symbol="EBAY" tradeDate="2000-05-04T12:00:02" numShares="100" price="50.625" /> <cbret_006a ESP_OPS="i" tradeId="3" symbol="EBAY" tradeDate="2000-05-04T12:00:04" numShares="1000" price="16.875" />
esp_playback is run below without modifying the playrate and the output is written by executing esp_subscribe connected to the cbret_006 window.
esp_playback -p remoteBox:19011/ws1/project1 -c sybase:sybase -C espxml:sum/input.xml esp_subscribe -p remoteBox:19011/ws1/project1 -c sybase:sybase -s cbret_006:
The output is a single XML record with the correct share sum and average price of the three input records.
<cbret_006 ESP_OPS="i" tradeId="3" symbol="EBAY" tradeDate="2000-05-04 12:00:04" numShares="1600" price="72.500000"/>
esp_playback is run below with the -R option changing the playrate to 1 record per 4000 milliseconds (4 seconds). The output is written to the standard output by executing esp_subscribe connected to the cbret_006 window.
esp_playback -p remoteBox:19011/ws1/project1 -c sybase:sybase -C espxml:sum/input.xml -R 1:4000 -t1 esp_subscribe -p remoteBox:19011/ws1/project1 -c sybase:sybase -s cbret_006:
The output of this execution of esp_playback is 3 XML records identical to the input file.
<cbret_006 ESP_OPS="i" tradeId="1" symbol="EBAY" tradeDate="2000-05-04 12:00:01" numShares="500" price="150.000000"/> <cbret_006 ESP_OPS="i" tradeId="2" symbol="EBAY" tradeDate="2000-05-04 12:00:02" numShares="100" price="50.625000"/> <cbret_006 ESP_OPS="i" tradeId="3" symbol="EBAY" tradeDate="2000-05-04 12:00:04" numShares="1000" price="16.875000"/>
keep 1 seconds per (symbol)As a result of slowing down the playrate to 1 record per 4 seconds, the share sum and average price were calculated differently since the project only ever stored the share sum and average price of 1 record at a time.
esp_playback -p [<host>:]<port>/workspace-name/project-name -c user[:password] [OPTION...]
Some of these options require file paths. When entering file paths on Windows, use forward slashes instead of back slashes.
Supported source formats include: ODBC, ESP XML, ESP DLM, Binary, Recorder, and KDB. When used with an ODBC source, the -D option is typically required to authenticate with the source database. However, if the ODBC manufacturer provides for storing the username/password parameter in the DSN (and you have done so), the -D option is not required.
The connection string for these formats are:
[SAPSybaseIQ] Description = SAP Sybase IQ database ServerName = iqhost_iqdemo DatabaseName = iqdemo CommLinks = tcpip{host=iqhost;port=2638} Driver = /iqhome/IQ-15_1/lib64/libodbc.so
For information on how a record in an XML file should be configured, see Publish and Subscribe Executables > esp_convert > Input Formats.
For information on how a record in a DLM file should be configured, see Publish and Subscribe Executables > esp_convert > Input Formats.
One can use esp_convert to convert data from either XML or DML to binary format.
records:milliseconds
where:
This property is not supported for the source type recorder.
columnName
where:
The columnName property is ignored for the source type Recorder and is currently not supported for binary file sources.
The streamName variable is case-sensitive.
This value is global for all strings in the source. Specifying a large value for this option may result in increased memory usage depending on the number of strings in the record and the value specified with the -B option.
esp_playback -c user:pass -D dbuser:dbpassword -p myserver:9786/default/odbc_playback_test -C ODBC:myODBC_connection:SQL:"select * from mytable" -s InputWindow1
esp_playback -c user -D dbuser -p myserver:9786/default/odbc_playback_test -C ODBC:myODBC_connection:SQL:"select * from mytable" -s InputWindow1You are then prompted to enter a password and an ODBC password.
esp_playback -c user:pass -p localhost:19022/w1/p1 -C "espxml:/tmp/trades.xml" -R 10000:1000 -R 15
$ESP_HOME/bin/esp_playback -c user:pass -p localhost:19011/w1/p1 -C "espdlm:qa/trades.csv:," -R 10000:1000 -R 15
$ESP_HOME/bin/esp_playback -c user:pass -p localhost:19011/w1/p1 -C "espdlm:qa/trades.csv:," -R time -L (When the CCL is : CREATE INPUT WINDOW VWAP SCHEMA (Sym STRING, VWAP Float, time long) PRIMARY KEY (Sym) keep 60 seconds;)