Greg,
You are right, I added this code in check_ack but I am still getting the same err…
switch -exact — $acktype {
AA – CA {
# Good ACK – Clean up
set send_cnt 0 ;# Init counter
#handling inbound Data type reply
if {[cequal [msgmetaget $mh TYPE] DATA]} {
return “{KILL $mh} {KILL $my_mh}”
} else {
return “{KILLREPLY $mh} {KILL $my_mh}”
}
…………
Do you mean the msgType in the metadata is NOT sent together with the msg data, but the engine puts it in???
Thanks! -Sam 🙂
This is my config: (I only put in fields that have value)
*** Properties of Inbound thread ***
Inbound tab:
Inbound Data
TPS Inbound Data: hl7Raw_ack
Trx id determination Format: hl7
EDI Batch: None
Outbound Replies
Retries: -1
Interval: 10
*** Properties of Outbound thread ***
Outbound tab:
Outbound Data
Retries: -1
Interval: 10
Send OK Procs: sendOK_save
EDI Batch: None
Inbound Replies
Await Replies (checked)
Timesout: 15
TPS Inbound Reply: check_ack
Trx id Determination Format: hl7
proc hl7Raw_ack { args } {
global HciConnName
set mode [keylget args MODE]
set context [keylget args CONTEXT]
if { ! [info exists HciConnName] } {
set HciConnName “UNKNOWN_TD”
}
switch -exact — $mode {
start {
return “” ;# Nothing specific
}
run {
set mh [keylget args MSGID] ;# Message header
set msg [msgget $mh] ;# The message
#
# Make sure we are in proper context
#
if {$context != “sms_ib_data”} {
echo “$HciConnName: hl7Raw_ack; wrong context $context”
echo “CONTINUE MESSAGE — NO ACTION TAKEN”
return “{CONTINUE $mh}”
}
#
# Set up defaults
#
set mtype “ACK” ;# Message type
set ack_type “AA” ;# Assume good ack
set send_appl “”
set rx_appl “Cloverleaf”
set send_fac “”
set rx_fac “”
set p_type “P”
set seq_no “”
set rx_ID “”
set version “2.2” ;# assume 2.2
set ack_msg “”
set fldsep “|”
set sepchar “^~\&”
set dttm [fmtclock [getclock] “%Y%m%d%H%M”]
#
# Split the message and get MSH segment
#
set segments [split $msg r]
#
# If valid MSH segment, get data else send NAK
#
set mshseg [lindex $segments 0] ;# MSH segment
set mshname [csubstr $mshseg 0 3] ;# Segment name
if ![cequal $mshname “MSH”] { ;# Invalid MSH
set ack_msg “Invalid MSH segment”
set ack_type “AR”
} else { ;# Valid MSH
set fldsep [csubstr $mshseg 3 1] ;# get field sep char
set mshflds [split $mshseg $fldsep] ;# get MSH fields
set sepchar [lindex $mshflds 1] ;# Sep characters
set send_appl [lindex $mshflds 2] ;# Set send to receive
set rx_appl [lindex $mshflds 4] ;# Set receive to send
set send_fac [lindex $mshflds 5] ;# Set send to receive
set rx_fac [lindex $mshflds 3] ;# Set receive to send
set p_type [lindex $mshflds 10] ;# Set processing type
set rx_ID [lindex $mshflds 9] ;# Message Control ID
set version [lindex $mshflds 11] ;# Version
set seq_no [lindex $mshflds 12] ;# Set sequence number
}
#
# Now build the ACKNOWLEGEMENT message
#
set ACK “MSH$fldsep$sepchar$fldsep$rx_appl$fldsep$send_fac$fldsep”
append ACK “$send_appl$fldsep$rx_fac$fldsep$dttm$fldsep$fldsep$mtype$fldsep”
append ACK “$rx_ID$fldsep$p_type$fldsep$version$fldsep${seq_no}r”
append ACK “MSA$fldsep$ack_type$fldsep$rx_ID$fldsep${ack_msg}r”
set obMsg [msgcreate -type reply]
msgset $obMsg $ACK
#
# Now continue original message and send response
# unless there was an error, then kill original
#
if [cequal $ack_type “AA”] {
return “{CONTINUE $mh} {OVER $obMsg}”
} else {
return “{KILL $mh} {OVER $obMsg}”
}
}
shutdown {
# Doing some clean-up work
}
default {
return “” ;# don’t know what to do
}
}
}