CPI Scheduler that also have a manual processing option

For some of my CPI flows, I have something that needs to be scheduled. The scheduler should run every hour and process deltas. There can though be problems with the processing or for some reason data about a person should be sent again. It can either be for testing of is something was wrong or to test new functionality. In this post, I’ll share a little about how this can be solved as a design.

My goal is to reuse as much of the functionality as possible, so I should not maintain the code in multiple locations. I, therefore, went with the following process. It contains 3 flows

  1. Scheduled service. This runs every hour and creates a timestamp for when it was the last run. Once it has run it will save the timestamp from when processing start, so next time will include the changes.
  2. Internal process. This is the part that processes the Query. In this case, it is SuccessFactors where it fetches all new employee photos. For each photo, it needs to do some resizing image in a separate iflow. Then it needs to perform a lookup to get the ID of employee and then sent it to a service. The connection to this is just the internal processing, but could also be using ProcessDirect.
  3. An HTTP service where the user could send in an XML with information on which users need to be a part of the query.

2019-04-24_11-26-01.png

For the internal process, I did have to split the query based on which input it was coming with. In the scheduled approach it would be if lastChangedData > last time, whereas with the query it was if userId = ‘DKDGR’. I could probably also have placed the filter generation in the two components, that way I did not need the split here.

For other cases, I have separated it using the ProcessDirect adapter, but it ended up with too many flows and was difficult to manage. Then it is a lot easier to run in one iFlow.

 

Learn with me. 

I’m teaching a course in SAP CPI, so you can learn to understand how to architect real CPI integrations. Check out the full course at https://www.cpicourse.com/sap-cpi-course, you can also find the first modules free on this page.