Question
· Apr 12, 2019

Timing of Database look up

We use a lot of external MS SQL calls to look up numerous things when it comes to HL7. I am running into an issue where the outbound calls are queued but the message is sent onto the next process before it gets a response. How do I get it to wait till the response gets back from the MS SQL call before sending it onto the next process?

 

Below is a screen shot of what I am trying to explain...Select Research Study executes at 8:33 the message is sent to the next process at 8:34, but the response of the MSSQL call doesn't come till 9:31.

Discussion (8)2
Log in or sign up to continue

Hi

You have to use the SendRequestSync() method for sending the request to your business operation from your business process.

Using the SendRequestSync() the business process will not process the next message until a response is received. Your messages will be queuing in the business process.

Additionally, I would suggest to check why the database response takes so long. 

Regards 

Stelios 

Hi Scott,

I've accomplished this in the past by calling the SQL Operation with the SendRequestSync() method in a <code> action rather than using the <call> action. The default is to wait until the response is received.

This will be problematic if you must maintain FIFO (thus setting the Pool Size to 1), since the BPL will stop processing until the response is received. And increasing the pool size could have undesirable side effects other than loss of FIFO ... so you're likely to see horrible message latency at times given the metrics you're reporting.

EDIT: Stelios of course beat me to it ... I stepped away from the keyboard before hitting the Publish button and only realized it some hours later laugh

Probably something like this (I'm not sure of the full name of the osuwmc.PatientBilling... class, and you probably want to do some sort of exception handling or at least error checking):

       set callrequest = ##class(osuwmc.PatientBilling.DataStructures.SelectResearchID).%New()

       set callresponse = ##class(EnsLib.SQL.Snapshot).%New()

       set callrequest.ResearchID = context.RschMRN

       do process.SendRequestSync("PatientBillingDBPoll", callrequest, .callresponse)

       set context.ClarityRS = callresponse

The default behavior of SendRequestSync is to never timeout, but you can always include a -1 as the 4th parameter to be a bit more descriptive.