The simplest solution is to make sure the ADT transform/send rule is called before the ORM transform/send rule in the routing rule, set the router's pool size to 1, and enable the "Force Sync Send" option in the router. What happens to the ORM message when the ADT message is NAKed, though, may be problematic.

If you want more granular control over this processing, invoke the transformations and subsequent calls to the operation via a BPL instead of a router. You will be able to evaluate the ACK/NAK response from the called Business Operation responsible for sending the ADT message and take appropriate measures for processing/suspending the ORM message.

You Windows users have scripting ...

wait for: Username:
send: username<CR>
wait for: Password:
send: password<CR>
send: :alias sql Do $system.SQL.Shell()<CR>
send: :alias % zn "%SYS"<CR>

Save the script to a file with an .scr extension, and start terminal with:

\path\to\iristerm.exe /console=cn_iptcp:hostname[port] \path\to\scriptname.scr
Node: Krusty, Instance: HEALTHSHARE
 
Username: jeff
Password: ****
USER>:c
 
USER>:h
 1: :h
 
USER>:a
 
USER>:sql
>> Invalid history command
 
USER>:t
>> Invalid history command
 
USER>w $ZV
IRIS for Windows (x86-64) 2021.1 (Build 215_0_21260U) Tue Nov 9 2021 19:30:33 EST

Maybe you're seeing a 2021.2 behavior.

Or it's just this docker thing the cool kids use ... wink

Oops, instead of hr.SetParam() try hr.InsertFormData("name","value").

This works for me:

USER>set req=##class(%Net.HttpRequest).%New()
USER>set req.Server = "blah.org"
USER>do req.SetParam("name","value")
USER>do req.Post("method",1,0) // 2nd param is output to current device; 3rd is no reset


POST /method?name=value HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; InterSystems IRIS;)
Host: blah.org
Accept-Encoding: gzip
Content-Length: 0

A <code> section would work, but if you're going to use this regularly within your DTLs, it might make sense to create a custom method that would be available through the Function drop-down list in the DTL Editor. For Example:

Class User.Test.FunctionSet Extends Ens.Util.FunctionSet
{
/// Unescapes the field value provided in <var>pPath</var> and returns it as a String.
ClassMethod UnEscapeHL7(pPath As %String, pSeps As %String = "|^~\&", pEsc As %String = "\") As %String
{
    Return ##class(EnsLib.HL7.Segment).UnescapeEx(pPath, pSeps, pEsc)
}
}

Call it like this (replacing the field in my example with the field containing your note comment):

I've updated the method to optionally accept separators and the escape character as arguments; you would use source.Separators and source.ESC to override the default values with the ones supplied in the source message.

You appear to be attempting to set the value of a field following the location of the stream object in the segment, and you can't do that directly ... this is a limitation specifically of working with stream objects in segments. You'll need to modify the string returned from GetFieldStreamRaw() in tRemainder and supply that as the 3rd argument to the StoreFieldStreamRaw() method.

I don't have a request of type EnsLib.EDI.XML.Document handy to test, but I do know that setting the Source property of the request (for an HL7 message, at least) to the desired filename will enable you to use the %f formatting token to obtain the Source contents as the filename. This should theoretically allow you to use the unmodified EnsLib.EDI.XML.Operation.FileOperation class ...

If the length of the encoded PDF is less than MAXSTRING (roughly 3.6MB) it will be populated in the message as type %String. Otherwise it's a %Stream.GobalCharacter, and working with them using property paths in many of the IRIS functions will cause problems. GetFieldStreamRaw() guarantees you have a stream to work with.

Things may work out fine with your current code, but I've always taken the precaution of making sure I'm working with a stream when there's a chance the field content may be large.

You will want to fetch the stream using the GetFieldStreamRaw() method in EnsLib.HL7.Message rather than just referencing the field directly.

Set tSC=source.GetFieldStreamRaw(.varBase64,"PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:5(1).5")
Return:$$$ISERR(tSC) tSC

This will have varBase64 as a proper stream object for use with your DecodeBase64HL7 method. GetFieldStreamRaw() supplies the stream as type %Stream.GlobalCharacter, so you may want to adjust your method ...

You can change the message DocType, but you can't change the message content:

HICG > s msg=##class(EnsLib.HL7.Message).%OpenId(7463)
HICG > w msg.IsMutable
0
HICG > w msg.DocType
2.3.1:ORU_R01
HICG > s msg.DocType="2.5.1:ADT_A01"
HICG > d msg.%Save()
HICG > w msg.DocType
2.5.1:ADT_A01
HICG >

Unfortunately there's no easy way to "reset" the source document type in the DTL editor dynamically. You could, however, dynamically set the document type in either a BPL or COS business process and then invoke the appropriate DTL for translation.

The class query MemberStatusList in SYS.Mirror (found in the %SYS namespace) will give you a list of mirror members and some useful status information:

%SYS>d ##class(%ResultSet).RunQuery("SYS.Mirror","MemberStatusList")

Member Name:Current Role:Current Status:Journal Transfer Latency:Dejournal Latency:Journal Transfer Latency:Dejournal Latency:Display Type:Display Status:
MDCHCNDBSL1.HICGRP.COM/STAGE:Primary:Active:N/A:N/A:N/A:N/A:Failover:Primary:
MDCHCNDBSL2.HICGRP.COM/STAGE:Backup:Active:Active:Caught up:Active:Caught up:Failover:Backup:
CDCHCNDRSL.HICGRP.COM/STAGE:Async:Async:Caught up:Caught up:Caught up:Caught up:Disaster Recovery:Connected: