Author : Steve McDuff, supply chain performance architect with contributions from Andrey Furukin, support
Business day scheduling
Some users of B2Bi & SFG sometimes need to schedule a business process to run on a specific business day of the month. For instance, run a process on the 4th business day of the month. This day may change depending on holidays.
While B2Bi & SFG do not currently offer this functionality out of the box, it's possible to create such schedule with a custom java task included in the following zip file:
BusinessDayOfTheMonth.zip
Steps to make it work
1 - Configure a business process to run every day at your chosen time.
2 - The business process will call the java task contained in the zip file above.
3 - The java task will store the current business day of the month in a variable as a number. It will be set to -1 during holidays and a numeric value of 1 and above during business days.
4 - Your business process should check if the business day of the month variable matches the day when you want to run. If it doesn't, abort.
5 - Run your desired process.
To install the JAR
1. Shut down B2Bi
2. From the 'bin' directory, execute:
$ ./install3rdParty.sh CustomScheduler_JavaTask 1_0 -j <path_to_JAR>
3. Verify that the new JAR is now referenced in <install>/properties/dynamicclasspath.cfg.
4. Start B2Bi
Java Task code sample
Service Type : JavaTask
Description : Get current business day of the month
System Name : JT_Scheduler
Group Name : None
Source Location Mode : Inline
Java Source :
import com.IBM.Steve.calmethods.BusinessDayScheduler;
String s = Integer.toString(BusinessDayScheduler.getCurrentBusinessDayOfMonth("C:\\temp\\holidays.txt"));
wfc.addWFContent("BusinessDayOfMonth",s);
return "OK";
NOTE : You can customize the path of the holidays.txt file. You can define multiple java tasks if you need to have multiple holiday definitions.
Business Process Definition:
<process name="JT_Scheduler">
<sequence name="Start">
<operation name="Java Task Service">
<participant name="JT_Scheduler"/> ### This references the name of the Java Task service up above
<output message="JT_SchedulerTypeInputMessage">
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</process>
Configure holidays
Copy the holidays.txt file in a folder of your choice on the file system. Ensure that it matches the configured path in the JavaTask.
Edit the holidays.txt to enter your list of holidays. Each holiday should be entered as a date per line in the YEAR-MONTH-DAY format.
Example that defines 3 holidays :
2017-05-12
2017-05-13
2017-05-14
NOTE : The holidays.txt file is reloaded on every execution. You can change it without restarting B2Bi.
#IBMSterlingB2BIntegratorandIBMSterlingFileGatewayDevelopers#DataExchange