@@ -223,24 +223,6 @@ ClassMethod OnGetConnections(
223223 quit
224224}
225225
226- Method dispatchSendRequestAsyncNGTest (
227- pTarget ,
228- pRequest ,
229- pTimeout ,
230- pDescription ,
231- ByRef pMessageHeaderId ,
232- ByRef pQueueName ,
233- ByRef pEndTime ) As %String
234- {
235- Set tTargetConfigName = $get ($$$DispatchNameToConfigName(pTarget )) Quit :" " =tTargetConfigName $$$EnsError($$$EnsErrBusinessDispatchNameNotRegistered,pTarget )
236- Set tTargetBusinessClass =$$$ConfigClassName(tTargetConfigName )
237- Set tPriority =$$$eMessagePriorityAsync
238-
239- Set tSC =$classmethod (tTargetBusinessClass ," acceptRequestAsync" ,..%ConfigName ,tTargetConfigName ,pRequest ,tPriority ,$$$queueSyncCallQueueName,..%SessionId ," " ,.tRequestHeader ,pDescription ,..%SuperSession )
240-
241- Quit tSC
242- }
243-
244226Method dispatchSendRequestAsyncNG (
245227 pTarget ,
246228 pRequest ,
@@ -305,37 +287,50 @@ Method dispatchIsRequestDone(
305287 pMessageHeaderId ,
306288 ByRef pResponse ) As %Status
307289{
290+
308291 set tSC =$$$OK
309292 try {
310- set tTimeout =$s (pTimeout =-1 :-1 ,1 :pEndTime -$zh ) if (pTimeout '=-1 )&&(tTimeout <0 ) quit
293+ set tTimeout =$s (pTimeout =-1 :-1 ,1 :pEndTime -$zh )
294+
311295 set tSC = ##class (Ens.Queue ).DeQueue ($$$queueSyncCallQueueName,.tResponseHeader ,tTimeout ,.tIsTimedOut ,0 ) Quit :$$$ISERR(tSC )
312- quit :tIsTimedOut
296+
297+ quit :$IsObject (tResponseHeader )=0
313298
314299 set tFound = $select (tResponseHeader .CorrespondingMessageId : pMessageHeaderId =tResponseHeader .CorrespondingMessageId , 1 : 0 )
315300 if tFound =0 {
316- $$$sysTRACE( " Out-of-band message ' " _ tResponseHeader . %Id ()_ " ' discarded " )
317- do tResponseHeader . SetStatus ($$$eMessageStatusDiscarded )
318- quit
301+
302+ set tSC = ##class ( Ens.Queue ). EnQueue ( tResponseHeader )
303+ Kill $$$EnsActiveMessage($$$SystemName_ " : " _ $Job )
319304 }
320- if tResponseHeader .IsError {
305+ else {
306+
307+ if tIsTimedOut || ((pTimeout '=-1 )&&(tTimeout <0 )) {
308+
309+ do tResponseHeader .SetStatus ($$$eMessageStatusDiscarded)
310+ return $$$ERROR($$$EnsErrFailureTimeout, tTimeout , $$$StatusDisplayString(tSC ), $$$CurrentClass)
311+ }
312+ if tResponseHeader .IsError {
313+
314+ do tResponseHeader .SetStatus ($$$eMessageStatusCompleted)
315+ return $$$EnsError($$$EnsErrGeneral," Error message received: " _tResponseHeader .ErrorText )
316+
317+ }
318+ if tResponseHeader .MessageBodyClassName '=" " {
319+
320+ set tResponse = $classmethod (tResponseHeader .MessageBodyClassName ," %OpenId" ,tResponseHeader .MessageBodyId ,,.tSC )
321+ if '$IsObject (tResponse ) return $$$EnsError($$$EnsErrGeneral," Could not open MessageBody " _tResponseHeader .MessageBodyId _" for MessageHeader #" _tResponseHeader .%Id ()_" with body class " _tResponseHeader .MessageBodyClassName _" :" _$$$StatusDisplayString(tSC ))
322+ } else {
323+
324+ set tResponse =$$$NULLOREF
325+ }
326+ set pResponse =tResponse
321327 do tResponseHeader .SetStatus ($$$eMessageStatusCompleted)
322- set tSC = $$$EnsError($$$EnsErrGeneral," Error message received: " _tResponseHeader .ErrorText )
323- quit
324- }
325- if tResponseHeader .MessageBodyClassName '=" " {
326- set tResponse = $classmethod (tResponseHeader .MessageBodyClassName ," %OpenId" ,tResponseHeader .MessageBodyId ,,.tSC )
327- if '$IsObject (tResponse ) Set tSC =$$$EnsError($$$EnsErrGeneral," Could not open MessageBody " _tResponseHeader .MessageBodyId _" for MessageHeader #" _tResponseHeader .%Id ()_" with body class " _tResponseHeader .MessageBodyClassName _" :" _$$$StatusDisplayString(tSC )) Quit
328- } else {
329- set tResponse =$$$NULLOREF
328+ set tSC = 2
329+
330330 }
331- set pResponse =tResponse
332- do tResponseHeader .SetStatus ($$$eMessageStatusCompleted)
333-
334-
335- Set tSC2 = ##class (Ens.Queue ).Delete ($$$queueSyncCallQueueName," *" ) quit :$$$ISERR(tSC2 )
336331 }
337- catch {
338- set tSC = $$$EnsSystemError
332+ catch ex {
333+ set tSC = ex . AsStatus ()
339334 }
340335 quit tSC
341336}
0 commit comments