Question
· Feb 14

How to log index errors as warning

I am using a routing process (EnsLib.MsgRouter.RoutingEngine) to transform and route objects inside a production. My class definition of an object that is created by a transformation has an Index like:

Index MyIndex On (Prop1, Prop2) [ Unique ];

During the transformations it might happen that an object is constructed that violates the Index because another object already created this unique index. This will lead to an ERROR 5805 inside the production. Which is fine, because I don't want to create this object on purpose.

Is it possible to adjust the reply code actions to just log a Warning and not an Error in this case? I'm aware that this is an error from the class definition perspective but from the production / workflow perspective it's the expected behaviour and an Error entry inside the production protocol could lead to confusions.

Any help is appreciated.
 

Product version: IRIS 2023.1
Discussion (3)2
Log in or sign up to continue

 Hi Robert,

thanks for the advice. I was hoping that the interop production of IRIS is able to handle cases like that but couldn't find anything in the documentation. Anyway I followed your hint and found a lightweight solution.

Here is what one can do to avoid spamming the production log with error messages in case a transformation create objects that violate the uniqe index of the class definition.

  1. Use a class that extends Ens.Rule.FunctionSet
  2. Create a class method that calls the MyIndexExists() method which returns a boolean
  3. Return the inverted boolean (to align with the intention of the method name and a better understanding inside the rule definition of the production)
  4. Add a routing rule for the object that checks the condition before the source object is sent to the transformation (you can now choose your function set method from the fx dropdown when you click on the condition within the rule on the rule editor page)
Class My.FunctionSet Extends Ens.Rule.FunctionSet [ Abstract, System = 4 ]
{

ClassMethod IsNewMyClassObject(Prop1,Prop2) As %Boolean [CodeMode = expression, Final]
{
'##class(MyClass).MyIndexExists(Prop1, Prop2)    
}

}