Hi

You can set a timeout for async calls by calling the SetTimer() method.

See below an example with an async call where the OnTimeout gets called:

 Method OnRequest(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status
{
  SET t=$$$OK
  SET t=..SendRequestAsync("BOout",pRequest,1,"RequestCompletionKeyOne",)
  Set tSC = ..SetTimer("PT10S")
  Quit t
}

 
Method OnResponse(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, callresponse As %Library.Persistent, pCompletionKey As %String) As %Status
{
  if pCompletionKey="RequestCompletionKeyOne"
  {
    $$$TRACE("Response for request with CompletionKey RequestCompletionKeyOne has been received")
  }
  Quit $$$OK
} 



Method OnTimeout(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, pCompletionKey As %String) As %Status
{
// Subclass responsibility
  $$$LOGWARNING(" Timeout Occurred")
  Quit $$$OK
}

Regards

Stelios

After you receive the K21 response you could get the patient identifier that you need by looping through all the identifiers that are included in the K21 PID:3(X).1  field and extract the id that you want only if the PID:3(x).4 has a specific value.

Then you could create clone of the ORU message and you can set the value of the PID using the identifier extracted from the K21 response.

 

For example:

If your business process is receiving the ORU message then an example OnRequest method could be like the following one:

 

Method OnRequest(pRequest As EnsLib.HL7.Message, Output pResponse As Ens.Response) As %Status
{
                SET sc=$$$OK
                //assumes that you have created the Q21 here…
                SET sc=..SendRequestSync("PASSystem", Q21msg,.K21Resp)
                IF sc
                {                                             
                                For i=1:1:K21Resp.GetValueAt("PIDgrp.PID:3(*)")
                                {                                             
                                                IF K21Resp.GetValueAt("PIDgrp.PID:3("_i_").4.1")="5"
                                                {
                                                                SET PatID=K21Resp.GetValueAt("PIDgrp.PID:3("_i_").1")
                                                }                                             
                                }
                                SET newORU=pRequest.%ConstructClone()
                                IF $GET(PatID)'="" SET sc=newORU.SetValueAt(PatID,"PIDgrpgrp(1).PIDgrp.PID:3(1).1")
                                //now here you can set the pResponse to be the newORU or you can send it to another Business Host.
                                SET sc=..SendRequestSync("DestinationOfTheFinalORU", newORU ,. newORUResp)
                                SET pResponse=newORUResp
                }
                Quit sc
}

Hi

One approach to handle files in Ensemble without storing them in the database  could be to store the file to an external directory and pass the file path as a string message property instead of the stream between the business hosts.

When you finish what you need to do with the file, then using the file path you can delete the file.

 If you follow this approach and depending on what you need to do with your interface, you have to consider that you may not be able to resend messages or view the files because your files may not exist when you resend your messages, unless your interface is retrieving the files every time you resend a message. In this case, the purge tasks will not have to delete the  external files, but deleting the external files has to be handled properly by your code.

I hope it helps.

Regards

Stelios

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

If the Ens package is available to you, then I find very useful the ConvertDateTime() method of the Ens.Util.Time class.

For example, if I want to convert this date: “20181220” to “20-12-2018”, then I use the ConvertDateTime() method like this:

SET ConvertedDt =##class(Ens.Util.Time).ConvertDateTime("20181220","%Y%m%d","%d-%m-%Y")

The patterns that I use more frequently are:

%Y    year including the century, as a 4-digit number (0000-9999)
%y    year within a century as a number (00-99)
%m    month as a 2-digit number (01-12)
%#m    month as a number (1-12) without leading zeros    
%d    day of the month as a 2-digit number (01-31)
%#d    day of the month as a number (1-31) without leading zero
%H    hour in 24-hour format as a 2-digit number (00-23)
%M    minute as a 2-digit number (00-59)
%S    second as a 2-digit number (00-60) (60 for leap seconds)
%N    fractional second in milliseconds as number (000-999)

You can read more details about the Ens.Util.Time class including the full list of the supported patterns here:

https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=ENSLIB&CLASSNAME=Ens.Util.Time

I hope it helps.

Regards

Stelios

Hi Lassi

Probably you are getting "AA" because the Ack mode of the Business Service is set  to "Immediate". 

One way to do this, is to configure your business Service to send the incoming HL7 message to a business process that constructs the acknowledgement according to your requirements ,and sends the acknowledgement back to the business service as response. 

In this case, your Business Service Ack mode has to be "Application".

Here is a sample Business Process that could do something like this. 

Class dev.process.ackProc Extends Ens.BusinessProcess [ ClassType = persistent ]
{
Method OnRequest(pRequest As EnsLib.HL7.Message, Output Ack As EnsLib.HL7.Message) As %Status
{
SET sc=$$$OK
SET Ack=##class(EnsLib.HL7.Message).%New()
SET Ack.DocType="2.5:ACK"
SET sc=Ack.SetValueAt("ENSEMBLE","MSH:3")
SET sc=Ack.SetValueAt(pRequest.FindSegmentValues("MSH:3"),"MSH:6")
SET sc=Ack.SetValueAt("ACK","MSH:9.1")
SET sc=Ack.SetValueAt(pRequest.FindSegmentValues("MSH:9.2"),"MSH:9.2")
SET sc=Ack.SetValueAt($REPLACE($ZTIMESTAMP,",",""),"MSH:10")
SET sc=Ack.SetValueAt("CE","MSA:1")
Quit sc
}
}

I hope it helps.

Regards

Stelios

Hi

If you want to get the username and password that is stored in the Ensemble credentials list that is accessible via the management portal Ensemble>Credentials, and  if you know the credential id,

then you can get the username and password via the Ens.Config.Credentials class:

SET cr=##class(Ens.Config.Credentials).%OpenId("yourCredentialID")

SET UserName=cr.Username

SET Password=cr.Password

see here the class reference:

http://docs.intersystems.com/latest/csp/docbook/%25CSP.Documatic.cls?AGE...

I hope it helps

Stelios

I had the same question, and after doing some further reading, I believe that the certificate that the client sends to the server depend on the list of the “Acceptable client certificate CA names” that the server presents to the client. This list is part of the “Client Certificate Request Message” that the server sends to the client during the SSL handshake.

So it looks like that the client is using this information to search for the appropriate certificates in the windows certificate store.

You can read here about the Client Certificate Request Message:
 https://technet.microsoft.com/en-gb/library/cc783349(v=ws.10).aspx

(Optional) Client Certificate Request Message

The server must always present its certificates to the client, but the client is not always required to authenticate itself. Therefore, the client is not always required to send its certificates to the server. If the server does not require client authentication, then this message is not sent.

This step might be used for Web sites such as a banking Web site, where the server must confirm the identity of the client before providing sensitive information. If the application requires mutual authentication, the server sends a Client Certificate Request. The Client Certificate Request message includes:

  • The type of certificate required (typically RSA or DSS)
  • A list of acceptable CAs

 If I try to connect to the LDAPs server using OpenSSL:

Openssl s_client -connect ldapServername.com:636 –state

then I can see  the “Acceptable client certificate CA names”

I hope it helps

Stelios