@@ -139,12 +139,12 @@ Method SetPropertyValues()
139139}
140140
141141Method dispatchSendRequestSync (
142- target ,
143- request ,
142+ pTarget ,
143+ pRequest ,
144144 timeout ,
145- description ) As %String
145+ pDescription ) As %String
146146{
147- set tSC = ..SendRequestSync (target , request ,.objResponse ,timeout ,description )
147+ set tSC = ..SendRequestSync (pTarget , pRequest ,.objResponse ,timeout ,pDescription )
148148 if $$$ISERR(tSC ) throw ##class (%Exception.StatusException ).CreateFromStatus (tSC )
149149 quit $g (objResponse )
150150}
@@ -162,7 +162,7 @@ Method dispatchSendRequestSyncMultiple(
162162
163163 set tSC = ..SendRequestSyncMultiple (.tCallStructList ,pTimeout )
164164 if $$$ISERR(tSC ) throw ##class (%Exception.StatusException ).CreateFromStatus (tSC )
165-
165+
166166 // Convert multidimensional array to Python list
167167 set tResponseList = builtins .list ()
168168
@@ -173,11 +173,11 @@ Method dispatchSendRequestSyncMultiple(
173173}
174174
175175Method dispatchSendRequestAsync (
176- target ,
177- request ,
178- description )
176+ pTarget ,
177+ pRequest ,
178+ pDescription )
179179{
180- set tSC = ..SendRequestAsync (target , request , description )
180+ set tSC = ..SendRequestAsync (pTarget , pRequest , pDescription )
181181 if $$$ISERR(tSC ) throw ##class (%Exception.StatusException ).CreateFromStatus (tSC )
182182 quit
183183}
@@ -223,4 +223,121 @@ 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+
244+ Method dispatchSendRequestAsyncNG (
245+ pTarget ,
246+ pRequest ,
247+ pTimeout ,
248+ pDescription ,
249+ ByRef pMessageHeaderId ,
250+ ByRef pQueueName ,
251+ ByRef pEndTime ) As %String
252+ {
253+ set tSC =$$$OK, tResponse =$$$NULLOREF
254+ try {
255+
256+ set tTargetDispatchName =pTarget
257+ set tTargetConfigName =$get ($$$DispatchNameToConfigName(pTarget ))
258+ if tTargetConfigName =" " set tSC =$$$EnsError($$$EnsErrBusinessDispatchNameNotRegistered,tTargetDispatchName ) quit
259+ set tTargetBusinessClass = $$$ConfigClassName(tTargetConfigName )
260+ set tINVOCATION =$classmethod (tTargetBusinessClass ," %GetParameter" ," INVOCATION" )
261+ if (tINVOCATION '=" Queue" )&&(tINVOCATION '=" InProc" ) set tSC =$$$ERROR($$$EnsErrParameterInvocationInvalid,tTargetBusinessClass ) quit
262+
263+ quit :$$$ISERR(tSC )
264+ ;
265+ set tStartTime =$zh
266+ set :pTimeout '=-1 tEndTime =$zh +pTimeout
267+
268+ if tINVOCATION =" InProc" {
269+ set tTimeout =$s (pTimeout =-1 :-1 ,1 :tEndTime -$zh )
270+ if (pTimeout '=-1 )&&(tTimeout <0 ) quit
271+ set tSC =..SendRequestSync (tTargetConfigName ,pRequest ,.tResponse ,tTimeout ,pDescription )
272+ return tResponse
273+ } elseif tINVOCATION =" Queue" {
274+ Set tSessionId =..%SessionId
275+ Set tSuperSession = ..%SuperSession
276+ Set tSC = ##class (Ens.MessageHeader ).NewRequestMessage (.tRequestHeader ,pRequest ,.tSessionId ,.tSuperSession ) quit :$$$ISERR(tSC )
277+ Set ..%SessionId =tSessionId
278+ Set ..%SuperSession =tSuperSession
279+ Set tRequestHeader .SourceConfigName = ..%ConfigName
280+ Set tRequestHeader .TargetConfigName = tTargetConfigName
281+ Set tRequestHeader .SourceBusinessType = $$$ConfigBusinessType($$$DispatchNameToConfigName(..%ConfigName ))
282+ Set tRequestHeader .TargetBusinessType = $$$ConfigBusinessType($$$DispatchNameToConfigName(tTargetConfigName ))
283+ Set tRequestHeader .TargetQueueName = $$$getConfigQueueName($$$DispatchNameToConfigName(tTargetConfigName ),..%SessionId )
284+ Set tRequestHeader .ReturnQueueName = $$$queueSyncCallQueueName
285+ Set tRequestHeader .BusinessProcessId = " "
286+ Set tRequestHeader .Priority = $$$eMessagePriorityAsync
287+ Set tRequestHeader .Description = pDescription
288+ Set tSC = ##class (Ens.Queue ).Create ($$$queueSyncCallQueueName) quit :$$$ISERR(tSC )
289+ Set tSC = ##class (Ens.Queue ).EnQueue (tRequestHeader ) quit :$$$ISERR(tSC )
290+ Set pMessageHeaderId = tRequestHeader .MessageId ()
291+ Set pQueueName = $$$queueSyncCallQueueName
292+ Set :(pTimeout '=-1 ) pEndTime = tEndTime
293+ }
294+ }
295+ catch {
296+ set tSC = $$$EnsSystemError
297+ }
298+ quit tSC
299+ }
300+
301+ Method dispatchIsRequestDone (
302+ pTimeout ,
303+ pEndTime ,
304+ pQueueName ,
305+ pMessageHeaderId ,
306+ ByRef pResponse ) As %Status
307+ {
308+ set tSC =$$$OK
309+ try {
310+ set tTimeout =$s (pTimeout =-1 :-1 ,1 :pEndTime -$zh ) if (pTimeout '=-1 )&&(tTimeout <0 ) quit
311+ set tSC = ##class (Ens.Queue ).DeQueue ($$$queueSyncCallQueueName,.tResponseHeader ,tTimeout ,.tIsTimedOut ,0 ) Quit :$$$ISERR(tSC )
312+ quit :tIsTimedOut
313+
314+ set tFound = $select (tResponseHeader .CorrespondingMessageId : pMessageHeaderId =tResponseHeader .CorrespondingMessageId , 1 : 0 )
315+ if tFound =0 {
316+ $$$sysTRACE(" Out-of-band message '" _tResponseHeader .%Id ()_" ' discarded" )
317+ do tResponseHeader .SetStatus ($$$eMessageStatusDiscarded)
318+ quit
319+ }
320+ if tResponseHeader .IsError {
321+ 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
330+ }
331+ set pResponse =tResponse
332+ do tResponseHeader .SetStatus ($$$eMessageStatusCompleted)
333+
334+
335+ Set tSC2 = ##class (Ens.Queue ).Delete ($$$queueSyncCallQueueName," *" ) quit :$$$ISERR(tSC2 )
336+ }
337+ catch {
338+ set tSC = $$$EnsSystemError
339+ }
340+ quit tSC
341+ }
342+
226343}
0 commit comments