File tree Expand file tree Collapse file tree 4 files changed +36
-0
lines changed
DurableSDK/Commands/Internals Expand file tree Collapse file tree 4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,17 @@ function GetDurableClientFromModulePrivateData {
22
22
}
23
23
}
24
24
25
+ function GetInvocationIdFromModulePrivateData {
26
+ $PrivateData = $PSCmdlet.MyInvocation.MyCommand.Module.PrivateData
27
+ if ($null -eq $PrivateData -or $null -eq $PrivateData [' InvocationId' ]) {
28
+ # Return null instead of throwing - invocation ID is optional for correlation/tracing
29
+ return $null
30
+ }
31
+ else {
32
+ $PrivateData [' InvocationId' ]
33
+ }
34
+ }
35
+
25
36
function Get-DurableStatus {
26
37
[CmdletBinding ()]
27
38
param (
@@ -114,6 +125,8 @@ function Start-DurableOrchestration {
114
125
}
115
126
116
127
$Body = $InputObject | ConvertTo-Json - Compress - Depth 100
128
+
129
+ $InvocationId = GetInvocationIdFromModulePrivateData
117
130
118
131
$null = Invoke-RestMethod - Uri $Uri - Method ' POST' - ContentType ' application/json' - Body $Body
119
132
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ public interface IPowerShellServices
13
13
{
14
14
void SetDurableClient ( object durableClient ) ;
15
15
16
+ void SetInvocationId ( string invocationId ) ;
17
+
16
18
void SetOrchestrationContext ( OrchestrationContext orchestrationContext ) ;
17
19
18
20
void ClearOrchestrationContext ( ) ;
Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ public void SetDurableClient(object durableClient)
45
45
_hasSetOrchestrationContext = true ;
46
46
}
47
47
48
+ public void SetInvocationId ( string invocationId )
49
+ {
50
+ _pwsh . AddCommand ( SetFunctionInvocationContextCommand )
51
+ . AddParameter ( "InvocationId" , invocationId )
52
+ . InvokeAndClearCommands ( ) ;
53
+
54
+ _hasSetOrchestrationContext = true ;
55
+ }
56
+
48
57
public void SetOrchestrationContext ( OrchestrationContext orchestrationContext )
49
58
{
50
59
_pwsh . AddCommand ( SetFunctionInvocationContextCommand )
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public class SetFunctionInvocationContextCommand : PSCmdlet
23
23
{
24
24
private const string ContextKey = "OrchestrationContext" ;
25
25
private const string DurableClientKey = "DurableClient" ;
26
+ private const string InvocationIdKey = "InvocationId" ;
26
27
27
28
/// <summary>
28
29
/// The orchestration context.
@@ -36,6 +37,12 @@ public class SetFunctionInvocationContextCommand : PSCmdlet
36
37
[ Parameter ( Mandatory = true , ParameterSetName = DurableClientKey ) ]
37
38
public object DurableClient { get ; set ; }
38
39
40
+ /// <summary>
41
+ /// The function invocation ID.
42
+ /// </summary>
43
+ [ Parameter ( Mandatory = true , ParameterSetName = InvocationIdKey ) ]
44
+ public string InvocationId { get ; set ; }
45
+
39
46
/// <summary>
40
47
/// Whether or not to clear the privateData of this module.
41
48
/// </summary>
@@ -70,11 +77,16 @@ protected override void EndProcessing()
70
77
privateData [ DurableClientKey ] = DurableClient ;
71
78
break ;
72
79
80
+ case InvocationIdKey :
81
+ privateData [ InvocationIdKey ] = InvocationId ;
82
+ break ;
83
+
73
84
default :
74
85
if ( Clear . IsPresent )
75
86
{
76
87
privateData . Remove ( ContextKey ) ;
77
88
privateData . Remove ( DurableClientKey ) ;
89
+ privateData . Remove ( InvocationIdKey ) ;
78
90
}
79
91
break ;
80
92
}
You can’t perform that action at this time.
0 commit comments