Chapter 22. Running Streams and Couples

A TheonCoupler stream is normally run in one of two ways. Via a scheduled entry (in crontab for example). Triggered from an external event, such as email containing new data being received. It can also be invoked manually at any point. Either way the command to run a stream is the same.

ttkm mydb stream agent bis1

Above runs the stream called bis1 that is part of the mydb model.

Running a stream does two things. Brings the external data into the Stream Source Table in the physical database (where necessary). Runs each couple associated with the stream to update target tables with the new data (using the synchronisation process). These two stages can be done separately as well.

ttkm mydb stream agent bis1 refresh couple none
ttkm mydb stream agent bis1 couple

This is sometimes necessary when different data sources need to be consistent before the sync is carried out (as internally the Stream Source Table may be defined as a query across both separate data sets). Individual sync processes (each couple) can also be run via this command.

ttkm mydb stream agent bis1 refresh couple none
ttkm mydb stream agent bis1 couple x2ysync1
ttkm mydb stream agent bis1 couple x2ysync2

In the above the bis1 stream that is part of the mydb model is loaded. and then the x2ysync1 and x2ysync2 couple sync processes defined on that stream are individually run.

Note that when the TheonCoupler process is run as individual stages as above then each stage is atomic but not the whole process. The whole process is only atomic when the refresh and couple stages are run together.