4 weeks ago
Dear colleagues,
I want to build some sort of visualization of all iflows using a Scheduler and the date/time when they are going to run.
Usually the schedulers are externalized in our tenant to not require a new version and transport if we need to change it.
I used the Integration Suite APIs to access the configuration of an iFlow to see how the response looks like:
https://<tenant>.it-cpi001.cfapps.<subaccountregion>.hana.ondemand.com/api/v1/IntegrationDesigntimeArtifacts(Id='<iFlowID>',Version='<Version>')/Configurations
And the response for the scheduler parameter is:
"ParameterKey": "Scheduler",
"ParameterValue": "simple.repeat --tz=Etc/GMT --startAt=2025-04-25T02:40:00 --endAt=2034-01-01T17:59:00",
"DataType": "custom:schedule"
Comparing with the actual configuration:
We miss important information, like the day of the week when it is scheduled...
I could not find documentation of the information that is given in the response to understand what is possible:
Can someone suggest if there would be a better way of extracting this information or where to find more documentation?
Many thanks in advance
Best regards
Javier
PS.- If you want to use the TryOut directly in the SAP Business Accelator Hub, the url is partly hardcoded to the urls of the NEO environment, so it will not work with CF...
I left one comment using the feedback option. Hopefully it can be improved in the future, but I guess everyone uses Postman or Bruno these days 😁
4 weeks ago
Hey Javier,
I guess you might be out of luck here.
Recently I was playing around with configuration parameters api and figured out that schedule is a rather special one in terms of how they treat it.
My guess is "Advanced" configuration probably will get you something cron-ish like this one: 0 0/5 * ? * MON,WED,TUE,THU,FRI * --tz=Etc/GMT --startAt=2025-04-25T22:39:10 --endAt=2025-05-01T22:39:15
And it might even look like the quartz camel component cron definition, but as you can find on that page, trigger.timeZone and trigger.startAt or trigger.endAt are different parameters of quartz component, meaning SAP has its own way of storing it all in one property (and then parsing and transforming it to quartz fornat)
And it would mean no standard parser would later parse this property for you (as a developer I wold not recommend implementing it yourself).
This is what we have for cron definition above:
<camel:from id="StartEvent_4_1745527166083" uri="quartz://timercopyTimerEventDefinition6821?cron=0+0/5+*+?+*+MON,WED,TUE,THU,FRI+*&trigger.timeZone=Etc/GMT&trigger.startAt=2025-04-25T22:39:10UTC&trigger.endAt=2025-05-01T22:39:15UTC&trigger.misfireInstruction=2"/>
Kind regards,
Alex.
4 weeks ago
Hey Alex,
Thanks a lot for your comment. This is indeed more complex than I expected...
Other colleague pointed me to this blog:
https://community.sap.com/t5/technology-blogs-by-members/cpi-scheduling-monitoring/ba-p/13422636
Which I am currently exploring. With a small adaptation in the groovy script it works for Cloud Foundry and is able to extract the data from the tenant.
Thanks again for your explanation
BR
Javier
4 weeks ago
Hey Javier,
Just for the sake of completeness I will post a brief update: based on the the script Ariel wrote, it looks like he was able to find the parser which can be used for quartz definitions.
So he just searches for the quartz component definitions (that xml stuff I showed above) from the blueprint (meaning runtime, rather than design time - it will only work after you press "deploy") and then calculates next runs (using exactly the CronTrigger stuff we found above in quartz docs).
Basically, this function does the magic, so maybe you can just try using the parser yourself.
After all, as you can see this (from blueprint)
?cron=0+0/5+*+?+*+MON,WED,TUE,THU,FRI+*
is the same as this (from api for advanced schedule minus the --tz --startAt and --endAt)
0 0/5 * ? * MON,WED,TUE,THU,FRI *
And he replaces pluses with spaces while you already have it.
With "basic" mode probably runtime camel blueprint is the only way to get proper cron definition.
Regards,
Alex
3 weeks ago
Hi Javier,
can you pls share where/what you needed to change, to have it working in Cloud Foundry. there is error - probably you had the same...
BR
Mateusz
3 weeks ago
Hello Mateusz,
I modifed this function:
def getTenantInfo(url){
def map = [:]
tenantValues = url =~ /(?<=https:\/\/)(.+?(?=-))(.+?(?<=\.hci[a-z][a-z][a-z].)(.+?(?=\.hana)))/
map.id = tenantValues[0..-1][0][1]
map.region = tenantValues[0..-1][0][3]
map.tmnURL = "https://${map.id}-tmn.hci.${map.region}.hana.ondemand.com"
return map
}
Which creates the tmn (management) URL for Neo environment.
At the moment I didn't make it dynamically and just hardcode the one of my tenant.
map.id = "xxx"
map.region = "yyy"
map.tmnURL = "https://xxx.it-cpi001.cfapps.yyy.hana.ondemand.com"
id and region are used in other places so I have defined separately.
If you don't know where to find yours you can refer to this link:
Last but not least, you will need to solve the warnings of the groovy editor, otherwise you cannot apply the previous changes. For that you can remove the unused libraries and adapt the one using wildcards:
Before:
import groovy.json.*
I added only this one, but I have to check if more are needed:
import groovy.json.JsonOutput
It is important to mention that in CF you cannot paste the iFlow runtime url in the browser and that's it, but in CF you will need to authenticate first with your clientID and secret from your service key.
Hope it helps
Let me know if you manage to display the schedule table.
Best regards
Javier
3 weeks ago
you made my day Javier, it works, I would not expect that it will be so little changes 🙂 !
3 weeks ago
3 weeks ago
This sounds like a really useful project! Being able to visualize all the scheduled iFlows would definitely make it easier to manage and keep track of everything. Good luck with building it!