Question Jimmy Christian · Jul 5, 2022

Shutdown Ensemble Business Service upon Warning in the Event Log

Hello,

We have a scenario where a bad message(With control character in some fields) is coming frequently in our Standard HL7 Business Service.

I do see the process gets shut down because of E=D action code. I also see the service logging an "Warning" about the bad message. But service is not shutting down.

Is there a way to handle this error right at the service to avoid multiple processes going down? Not sure if we can create a task, which audits the service logs every few minutes. But that will involve some coding and checking of time when the errors happens.

Is there is a straight forward setting like action code we have for process in the business service?

Thanks,

Jimmy Christian.

Product version: Ensemble 2018.1

Comments

Alex Woodhead · Aug 17, 2022

Hi Jimmy,

One approach could be to define a FunctionSet method:

Class MyRule.FunctionSet Extends Ens.Rule.FunctionSet{ClassMethod StopService(serviceName As %String = "") As %Boolean{job ##class(Ens.Director).EnableConfigItem(serviceName,0,1)quit 1}}

Then in your routing rule that is recieving bad messages from your service you could use the new function:

You might also decide to simply match and suspend bad messages or route to a bad message handler if sequence is not an issue.

Assumes the characters are within the first 10,000 characters of HL7 message.

Hope this helped inspire some ideas.

Cheers,

Alex

0
Jimmy Christian  Sep 6, 2022 to Alex Woodhead

Hello Alex,

Sorry for late response.

I see this approach is very interesting. So in the router, i am checking if it is a bad message. If yes, then i shutdown the service. Right?

Sounds very applicable. I will try and see. Just a question. When the router receives the message, if it is bad, the rawcontent has "BAD" in it?

Thanks,

Jimmy Christian.

0
Alex Woodhead  Sep 6, 2022 to Jimmy Christian

Hi Jimmy,

Yes this is using the router context to test if a message has some invalid characters.

As an example I simply used the content "BAD" in the message to demonstrate.

If you want to identify specific characters by numeric code-point an additional FunctionSet method could be employed. For example:

/// RuleSet function to evaluate whether a given raw input string contains unwanted characters/// Unwanted characters are supplied as a comma delimited string./// For example detect "9,32" would match any ASCII Tab and ASCII space characters/// The $ASCII function can be used to identify the numeric code point of a character, to be supplied in the detect parameter.ClassMethod ContainsChars(rawData As %String = "", detect As %String = "") As %Boolean{
    quit:$Length(rawData)<1 0
    quit:$Length(detect)<1 0
    set found=0
    set len=$Length(detect,",")
    for item=1:1:len {
        set charNum=$Piece(detect,",",item)
        continue:charNum'?1.N
        set char=$Char(charNum)
        if rawData[char {
            $$$TRACE("Found Character "_charNum_" in rawData")
            set found=1
            quit
        }
    }
    quit found}

Usage example:

Cheers,

Alex

0
Jimmy Christian  Sep 6, 2022 to Alex Woodhead

Thank you Alex.

I just ran a HL7 Message with bad characters. But i do not see string "BAD" in the message which is sent to the HL7 Router.

I am looking for the Built map status, but it says nothing. But when i open the contents it gives an error.

If i can detect in some way that the sent message could not parse, then i can shutdown the service.

0