ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Workflow.Client Namespace / WorkflowClientModule Class / NotificationManager Property
Example

In This Topic
    NotificationManager Property
    In This Topic
    Get a new instance of the manager class for all notification related functionality.
    Syntax
    public static INotificationManager NotificationManager {get;}
    Public Shared ReadOnly Property NotificationManager As INotificationManager
    Remarks
    Use the same manager instance to subscribe to and unsubcribe from jobs. The manager instance references the active connection set in the Workflow Client Module. This means that activating a new connection will cause the connection to change for any stored references to the manager.
    Example
    Subscribe to job notification messages
    // Subscribe to the job message event to start receiving job and step notifications.
    // Use the subscription token to unsubscribe from the event.
    var subscriptionToken = JobMessageEvent.Subscribe(e =>
    {
      var jobId = e.Message.JobId;
      var msgType = e.MessageType;
      var message = e.Message;
      // Include logic to process the job / step messages
    });
    
    // Subscribe to certain jobs. This will add these jobIds to the list of already subscribed jobs.
    var notifManager = WorkflowClientModule.NotificationManager;
    notifManager.SubscribeToJobs(jobIds);
    Unsubscribe to messages for the given jobs
    // Unsubscribe from the job message event using the subscription token
    JobMessageEvent.Unsubscribe(subscriptionToken);
    
    // Unsubscribe from jobs using the same instance of Notification Manager used to subscribe to jobs.
    // This will remove the jobs from the subscribed job list if no other clients are subscribed to those jobs.
    var notifManager = WorkflowClientModule.NotificationManager;
    notifManager.UnsubscribeFromJobs(jobIds);
    Send a response to Workflow Manager Server pertaining to a job's current step
    // Send a step response to Workflow Manager Server with additional information required for the step to continue.
    // In this example, provide an answer response to a QuestionStepInfoRequiredMessage so that the Question step can complete.
    // The response must include the jobId, stepId, and other information pertinent to the step.
    var stepInfoResponseMessage = new QuestionStepInfoResponseMessage()
    {
      JobId = jobId,
      StepId = stepId,
      QuestionResponse = 1,
      Comment = "Selected question response option 1"
    };
    var stepResponse = new StepResponse()
    {
      Message = stepInfoResponseMessage
    };
    
    var notifManager = WorkflowClientModule.NotificationManager;
    notifManager.SendStepResponse(stepResponse);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also