FSIA - Database polling in CTS Flows

Imagine you are developing series of CTS flow which need to be executed in sequence. As part of the sequence of flows you have requirement for database polling, for e.g. you can execute further flows only after you get green signal for certain field or table in database. This typically happens in main frame databases, where they have jobs been executed during night and then you can crawl the database or get the data from database only when the jobs have been completed. Job completion notification is then updated in certain table. For such scenario you can implement database polling mechanism as explained below.

As stated above, suppose you have sequence of flows, you complete the flow execution for Flow Runner 1 and then you cannot execute next flow executed by flow runner 2 unless you get a green signal from the database table or field. For this requirement for polling what can be done is, push another flow runner in between the flow runner 1 and 2. This intermediate flow runner would be doing the activity of database polling. The intermediate flow can be implemented in following manner. The flow would be combination for while loop, timer and database reader.

As part of the CTS flow for polling start with While operator, put the valid condition for the while operator for e.g. “IsNullOrEmpty(SystemName) ” where SystemName is the flow variable declared in the mapper and assigned with empty string value. After the while operator put timer operator, for allowing it periodic repetition of particular activity, in the above case it is going to be polling the database with particular query. Configure the time value with which you want to poll the database. After the time operator, put a look up join operator, which will do the look up for the particular table or field in a database. The look up join will use the database reader to get the data from the polling table in database. After the look up join put a mapper operator which will assign the value from the query to the condition variable, in the above case “SystemName”. “SystemName” will have valid value only if the query from the database reader operator returns valid value, else it would be empty. So the execution for the above flow will continue until the database reader return valid value. In case if you want to stop the DB polling explicitly after certain number of polling action, then you can use run code operator to check the number of polling done and then assign the value to the flow variable “SystemName”, so that the flow execution comes out of the while loop.

Above is one of the options on database polling using content transformations flows, there could be other alternatives as well.