Thank you Luis, this was useful.
However, I've encountered two issues while adapting the code you provided to my specific situation:
if ..RetryCount = 1 {
; Find the production
#dim p As Ens.Config.Production
Set p = ##class(Ens.Config.Production).%OpenId("ProductionName")
if '$isObject(p) {
$$$LOGERROR("Production not found")
quit
}
#dim item As Ens.Config.Item
#dim sett As Ens.Config.Setting
; Loop over all the elements of the production
for i=1:1:p.Items.Count() {
s item=p.Items.GetAt(i)
; Find the desired business component
if (item.Name="Component1Name"
||(item.Name="Component2Name"))
{
$$$LOGINFO(item.Name_" found")
; Explore settings
for s=1:1:item.Settings.Count() {
set sett=item.Settings.GetAt(s)
; Search for the FailureTimeout
if (sett.Name="FailureTimeout"){
$$$LOGINFO(sett.Name_" found")
; Change the valure of the FailureTimeout based on the Severity
If Severity = "high" {
set sett.Value = -1
} Else {
set sett.Value = 30
}
}
}
}
}
Set sc = p.%Save()
If $$$ISERR(sc) {
$$$LOGERROR($System.Status.GetErrorText(sc))
quit
}
}
With this code, I can adjust the FailureTimeout value based on the Severity parameter, and the updated value is correctly shown in the Production settings. Nevertheless, there are a couple of issues:
- This functionality only applies to modified settings, as it doesn't affect settings with default values, which are not included in the loop (set sett=item.Settings.GetAt(s)). Consequently, it's necessary to modify the settings at least once to ensure they are processed within the loop.
- While the FailureTimeout value gets updated, the sending procedure uses this updated value for the subsequent message, not the current one. As a consequence, the current message continues to operate with the outdated FailureTimeout value, causing the sending (and re-sending) procedure to deviate from the desired timeouts.
- Log in to post comments