Skip to content

Commit 52916b6

Browse files
EnsUtils: sessionId argument of sendRequestFromService() is now ByRef; it outputs the actual session ID of the request
1 parent c226117 commit 52916b6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/cls/iscru/util/EnsUtils.cls

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ ClassMethod getCurrentProduction() As Ens.Config.Production
2222
/// If <var>serviceName</var> is not specified then EnsLib.Testing.Service is used.
2323
/// In that case "Testing Enabled" production setting should be checked.
2424
/// Specify <var>sessionId</var> if the request should be sent in the scope of a particular session.
25-
ClassMethod sendRequestFromService(targetHostName As %String, message As %Persistent, serviceName As %String = "EnsLib.Testing.Service", sessionId As %Integer = "", description As %String = "") As %Status
25+
/// The actual session ID is recorded to <var>sessionId</var> once the message has been sent.
26+
ClassMethod sendRequestFromService(targetHostName As %String, message As %Persistent, serviceName As %String = "EnsLib.Testing.Service", ByRef sessionId As %Integer = "", description As %String = "") As %Status
2627
{
2728
#dim prod As Ens.Config.Production = ..getCurrentProduction()
2829
if '$isObject(prod) quit $$$ERROR($$$GeneralError, "No running production")
@@ -34,9 +35,11 @@ ClassMethod sendRequestFromService(targetHostName As %String, message As %Persis
3435
#dim sc As %Status = ##class(Ens.Director).CreateBusinessService(serviceName, .service)
3536
if $$$ISERR(sc) quit sc
3637

37-
if (sessionId '= "") set service.%SessionId = sessionId
38+
if ($get(sessionId) '= "") set service.%SessionId = sessionId
39+
set sc = service.SendRequestAsync(targetHostName, message, description)
40+
set sessionId = service.%SessionId
3841

39-
quit service.SendRequestAsync(targetHostName, message, description)
42+
quit sc
4043
}
4144

4245
/// Find a business host by name and type.

0 commit comments

Comments
 (0)