@@ -187,6 +187,106 @@ impl StartWorkflowInput {
187187
188188impl_with_args ! ( StartWorkflowInput ) ;
189189
190+ /// Input to [`ClientInterceptor::signal_with_start_workflow`].
191+ #[ non_exhaustive]
192+ #[ derive( derive_more:: Debug ) ]
193+ pub struct SignalWithStartWorkflowInput {
194+ /// The workflow type sent to the server.
195+ pub workflow_type : String ,
196+ /// The signal name sent to the workflow.
197+ pub signal_name : String ,
198+ /// Options for the workflow start.
199+ pub options : WorkflowStartOptions ,
200+ /// Controls for the signal-with-start RPC.
201+ pub rpc_options : crate :: RpcOptions ,
202+ // These remain type-erased until after interception so interceptors can replace either value
203+ // before the client's payload converter and codec run.
204+ #[ debug( skip) ]
205+ workflow_args : Box < dyn TemporalClientValue > ,
206+ #[ debug( skip) ]
207+ signal_args : Box < dyn TemporalClientValue > ,
208+ }
209+
210+ impl SignalWithStartWorkflowInput {
211+ pub ( crate ) fn new < W , S > (
212+ workflow_type : String ,
213+ workflow_args : W ,
214+ signal_name : String ,
215+ signal_args : S ,
216+ mut options : WorkflowStartOptions ,
217+ ) -> Self
218+ where
219+ W : TemporalSerializable + Send + ' static ,
220+ S : TemporalSerializable + Send + ' static ,
221+ {
222+ let rpc_options = std:: mem:: take ( & mut options. rpc_options ) ;
223+ Self {
224+ workflow_type,
225+ signal_name,
226+ options,
227+ rpc_options,
228+ workflow_args : Box :: new ( workflow_args) ,
229+ signal_args : Box :: new ( signal_args) ,
230+ }
231+ }
232+
233+ pub ( crate ) fn into_parts (
234+ self ,
235+ ) -> (
236+ String ,
237+ Box < dyn TemporalClientValue > ,
238+ String ,
239+ Box < dyn TemporalClientValue > ,
240+ WorkflowStartOptions ,
241+ crate :: RpcOptions ,
242+ ) {
243+ (
244+ self . workflow_type ,
245+ self . workflow_args ,
246+ self . signal_name ,
247+ self . signal_args ,
248+ self . options ,
249+ self . rpc_options ,
250+ )
251+ }
252+
253+ /// Attempt to access the workflow arguments as a concrete type.
254+ pub fn workflow_args_ref < T : Any > ( & self ) -> Option < & T > {
255+ self . workflow_args . as_any ( ) . downcast_ref ( )
256+ }
257+
258+ /// Attempt to access the signal arguments as a concrete type.
259+ pub fn signal_args_ref < T : Any > ( & self ) -> Option < & T > {
260+ self . signal_args . as_any ( ) . downcast_ref ( )
261+ }
262+
263+ /// Attempt to mutably access the workflow arguments as a concrete type.
264+ pub fn workflow_args_mut < T : Any > ( & mut self ) -> Option < & mut T > {
265+ self . workflow_args . as_any_mut ( ) . downcast_mut ( )
266+ }
267+
268+ /// Attempt to mutably access the signal arguments as a concrete type.
269+ pub fn signal_args_mut < T : Any > ( & mut self ) -> Option < & mut T > {
270+ self . signal_args . as_any_mut ( ) . downcast_mut ( )
271+ }
272+
273+ /// Replace the workflow arguments before serialization.
274+ pub fn replace_workflow_args < T > ( & mut self , args : T )
275+ where
276+ T : TemporalSerializable + Send + ' static ,
277+ {
278+ self . workflow_args = Box :: new ( args) ;
279+ }
280+
281+ /// Replace the signal arguments before serialization.
282+ pub fn replace_signal_args < T > ( & mut self , args : T )
283+ where
284+ T : TemporalSerializable + Send + ' static ,
285+ {
286+ self . signal_args = Box :: new ( args) ;
287+ }
288+ }
289+
190290/// Result of a successful intercepted workflow start.
191291#[ non_exhaustive]
192292#[ derive( Clone , Debug , PartialEq , Eq ) ]
@@ -1062,6 +1162,19 @@ pub trait ClientInterceptor: Send + Sync + 'static {
10621162 next. run ( input)
10631163 }
10641164
1165+ /// Intercept a `signal_with_start_workflow` operation.
1166+ fn signal_with_start_workflow < ' a > (
1167+ & ' a self ,
1168+ input : SignalWithStartWorkflowInput ,
1169+ next : Next <
1170+ ' a ,
1171+ SignalWithStartWorkflowInput ,
1172+ BoxFuture < ' a , Result < StartWorkflowOutput , WorkflowStartError > > ,
1173+ > ,
1174+ ) -> BoxFuture < ' a , Result < StartWorkflowOutput , WorkflowStartError > > {
1175+ next. run ( input)
1176+ }
1177+
10651178 /// Intercept a `list_workflows_page` operation.
10661179 fn list_workflows_page < ' a > (
10671180 & ' a self ,
@@ -1351,6 +1464,13 @@ interceptor_chain!(
13511464 BoxFuture <' a, Result <StartWorkflowOutput , WorkflowStartError >>
13521465) ;
13531466
1467+ interceptor_chain ! (
1468+ call_signal_with_start_workflow,
1469+ signal_with_start_workflow,
1470+ SignalWithStartWorkflowInput ,
1471+ BoxFuture <' a, Result <StartWorkflowOutput , WorkflowStartError >>
1472+ ) ;
1473+
13541474interceptor_chain ! (
13551475 call_list_workflows_page,
13561476 list_workflows_page,
0 commit comments