Skip to content

How to subscribe to provisioning system events

In Zervicepoint version 1.34 we introduced a new event subscriber class in the provisioning system. What this means is that you can now subscribe to a couple of different events that occur in the provisioning system services and act on them using your own event code. This document describes the different events and their arguments and provides examples for use with the Zervicepoint Powershell module.

ServiceRunning event

The ServiceRunning event is published when either the Provisioning System Service or the Provisioning System Inventory service is started.

ServiceRunning arguments

Argument Description
ServiceName The name of the service running, either "ProvisioningService" or "InventoryService"

ServiceStopped event

The ServiceStopped event is published whenever one of the Provisioning System services enters the stopped state.

ServiceStopped arguments

Argument Description
ServiceName The name of the service stopped, either "ProvisioningService" or "InventoryService"

InventoryRunning event

The InventoryRunning event is published when either the Provisioning System Service or the Provisioning System Inventory service starts the inventory process.

InventoryRunning arguments

Argument Description
PackageType The type of package being inventoried, either "Provisioning" or "FormData"
Engine The inventory engine being used, either "ProviderInventoryEngine" or "CentralProviderInventoryEngine"

InventoryCompleted event

The InventoryCompleted event is published when either the Provisioning System Service or the Provisioning System Inventory service finishes the inventory process.

InventoryCompleted arguments

Argument Description
PackageType The type of package being inventoried, either "Provisioning" or "FormData"
Engine The inventory engine being used, either "ProviderInventoryEngine" or "CentralProviderInventoryEngine"
PackageCount The number of provider packages reported
ModuleCount The number of modules (in all provider packages) reported
MethodCount The number of methods (all modules in all packages) reported

ProviderRunning event

The ProviderRunning event is published when a provider method is called by a process workflow.

ProviderRunning arguments

Argument Description
OrderId The ID of the order to which the workflow belongs
Package The name of the provider package to which the provider method belongs
Module The name of the module whithin the provider package
Method The name of the method being called

ProviderCompleted event

The ProviderCompleted event is published when a provider method is completed.

ProviderCompleted arguments

Argument Description
OrderId The ID of the order to which the workflow belongs
Package The name of the provider package to which the provider method belongs
Module The name of the module whithin the provider package
Method The name of the method being called
Success Boolean value indicating if the method call succeeded or not
Message Possible error message when the method call fails

Examples

PowerShell - Creating an instance of the EventSubsciber class

Import-Module 'C:\Program Files\Zipper\ZervicePoint\Powershell\ZervicePoint.WebApi.PowerShell'
$subscriber = New-ZPEventSubscriber -EventSource ProvisioningSystem

PowerShell - Subscribing to the ProviderRunning event

Register-ObjectEvent -InputObject $subscriber -EventName ProviderRunning -Action { Write-Host "OrderId: $($Args.OrderId), Provider: $($Args.Provider), Module: $($Args.Module), Method: $($Args.Method)" }

PowerShell - Getting a list of available events

PS C:\WINDOWS\System32> $subscriber | Get-Member -MemberType Event

   TypeName: Zipper.ZervicePoint.ProvisioningSystem.Events.EventSubscriber

Name               MemberType Definition
----               ---------- ----------
InventoryCompleted Event      System.EventHandler`1[Zipper.ZervicePoint.ProvisioningSystem.Events.InventoryCompletedEventArgs] InventoryCompleted(System.Object, Zipper.ZervicePoint.ProvisioningSystem.Events.InventoryCompletedEventArgs)
InventoryRunning   Event      System.EventHandler`1[Zipper.ZervicePoint.ProvisioningSystem.Events.InventoryRunningEventArgs] InventoryRunning(System.Object, Zipper.ZervicePoint.ProvisioningSystem.Events.InventoryRunningEventArgs)      
ProviderCompleted  Event      System.EventHandler`1[Zipper.ZervicePoint.ProvisioningSystem.Events.ProviderCompletedEventArgs] ProviderCompleted(System.Object, Zipper.ZervicePoint.ProvisioningSystem.Events.ProviderCompletedEventArgs)   
ProviderRunning    Event      System.EventHandler`1[Zipper.ZervicePoint.ProvisioningSystem.Events.ProviderRunningEventArgs] ProviderRunning(System.Object, Zipper.ZervicePoint.ProvisioningSystem.Events.ProviderRunningEventArgs)         
ServiceRunning     Event      System.EventHandler`1[Zipper.ZervicePoint.ProvisioningSystem.Events.ServiceRunningEventArgs] ServiceRunning(System.Object, Zipper.ZervicePoint.ProvisioningSystem.Events.ServiceRunningEventArgs)            
ServiceStopped     Event      System.EventHandler`1[Zipper.ZervicePoint.ProvisioningSystem.Events.ServiceStoppedEventArgs] ServiceStopped(System.Object, Zipper.ZervicePoint.ProvisioningSystem.Events.ServiceStoppedEventArgs)