IBM WebSphere Cast Iron facilitates to run the orchestrations in many ways; web services, HTTP Receive, Scheduled job, etc. Scheduled jobs are good candidate when you need to run an orchestration periodically such as once in a minute, once in 5 minutes, once in a day, etc. However, the challenge here is that performing QA on the scheduled jobs may become an issue as the QA team will have very little time to no time to prepare the test data as the scheduled job will kick off at the predetermined time. This is very true for those scheduled jobs whose frequency is very short such as once in one minute, 5 minute. On the other side, the scheduled jobs whose frequency is longer is hard to test as the QA team has to wait till the scheduled job kicks off. This article will present a technique to address this problem that can make the QA process very easy.
HTTP Receive and Conditional Check
The technique here is to design the orchestration to have both the Scheduled Job activity and HTTP Receive activity and have a Pick activity in before them so that the orchestration can be either invoked as a scheduled job to run at a predetermined time or can be invoked manually by using a HTTP Post. Actually this is a very popular technique and nothing new here. But this technique only allows the user to manually trigger the orchestration on top of the ability to run it at a predetermined time. Though the QA team doesn’t need to wait to get the orchestration invoked automatically at the predetermined time and invoke it whenever they want by using the HTTP request, the problem here is that it still has the Scheduled job activity which will get fired when the time elapses which once again may impact with the test data. To overcome this, add a configuration property named ‘IsAutoRunEnabled’ and set it to ‘N’ (without the quote). Now create a string variable named ‘isAutoRunEnabled’ and drag and drop a ‘Map Variables’ activity into the designer pane. Select this variable by clicking the ‘Select output’ and right click the variable and click ‘Define default value’. Choose the configuration property named ‘IsAutoRunEnabled’ that we just now defined. Publish this orchestration to the runtime and try configuring it with ‘Y’ and ‘N’ to enable and disable the job. The following screen shot illustrates how the orchestration looks like.
Fig 1a. Orchestration with the if condition to check whether the Orchestration can continue to run.
Fig 1b. Configuring the map variable to read the configuration property
Fig 1c. The IF Condition.