@@ -31,16 +31,17 @@ use crate::net::metadata::{MetadataContainer, MetadataKind};
3131use crate :: retries:: { RetryIter , RetryPolicy } ;
3232use crate :: schema:: deployment:: { DeploymentResolver , DeploymentType } ;
3333use crate :: schema:: invocation_target:: {
34- DEFAULT_IDEMPOTENCY_RETENTION , DEFAULT_WORKFLOW_COMPLETION_RETENTION , InputRules ,
35- InvocationAttemptOptions , InvocationTargetMetadata , InvocationTargetResolver , OnMaxAttempts ,
36- OutputRules ,
34+ DEFAULT_IDEMPOTENCY_RETENTION , DEFAULT_WORKFLOW_COMPLETION_RETENTION , DeploymentStatus ,
35+ InputRules , InvocationAttemptOptions , InvocationTargetMetadata , InvocationTargetResolver ,
36+ OnMaxAttempts , OutputRules ,
3737} ;
3838use crate :: schema:: metadata:: openapi:: ServiceOpenAPI ;
3939use crate :: schema:: service:: {
4040 HandlerRetryPolicyMetadata , ServiceMetadataResolver , ServiceRetryPolicyMetadata ,
4141} ;
4242use crate :: schema:: subscriptions:: { ListSubscriptionFilter , Subscription , SubscriptionResolver } ;
4343use crate :: schema:: { deployment, service} ;
44+ use crate :: service_protocol:: ServiceProtocolVersion ;
4445use crate :: time:: MillisSinceEpoch ;
4546use crate :: { Version , Versioned , identifiers} ;
4647
@@ -597,7 +598,8 @@ impl InvocationTargetResolver for Schema {
597598 let handler_name = handler_name. as_ref ( ) ;
598599
599600 let ActiveServiceRevision {
600- service_revision, ..
601+ service_revision,
602+ deployment_id,
601603 } = self . active_service_revisions . get ( service_name) ?;
602604 let handler = service_revision. handlers . get ( handler_name) ?;
603605
@@ -627,13 +629,32 @@ impl InvocationTargetResolver for Schema {
627629 )
628630 . unwrap_or ( Duration :: ZERO ) ;
629631
632+ let deployment_status = self
633+ . deployments
634+ . get ( deployment_id)
635+ . map ( |dp| {
636+ if ServiceProtocolVersion :: is_acceptable_for_new_invocations (
637+ * dp. supported_protocol_versions . start ( ) ,
638+ * dp. supported_protocol_versions . end ( ) ,
639+ ) {
640+ DeploymentStatus :: Enabled
641+ } else {
642+ DeploymentStatus :: Deprecated ( dp. id )
643+ }
644+ } )
645+ // It should never happen that the deployment doesn't exist,
646+ // this is an invalid schema registry otherwise.
647+ // But let's not panic yet, this will fail later on.
648+ . unwrap_or_default ( ) ;
649+
630650 Some ( InvocationTargetMetadata {
631651 public : handler. public . unwrap_or ( service_revision. public ) ,
632652 completion_retention,
633653 journal_retention,
634654 target_ty : handler. target_ty ,
635655 input_rules : handler. input_rules . clone ( ) ,
636656 output_rules : handler. output_rules . clone ( ) ,
657+ deployment_status,
637658 } )
638659 }
639660
0 commit comments