Microsoft.IT.SCOM.SBWS.TopicDiscovery.DS (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsMicrosoft.IT.SCOM.SBWS.RunAsProfile.Account
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
Scheduler DataSource System.SimpleScheduler Default
Probe ProbeAction Microsoft.Windows.PowerShellPropertyBagProbe Default
Mapper ConditionDetection System.Discovery.ClassSnapshotDataMapper Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
TimeoutSecondsint$Config/TimeoutSeconds$

Source Code:

<DataSourceModuleType ID="Microsoft.IT.SCOM.SBWS.TopicDiscovery.DS" Accessibility="Public" Batching="false" RunAs="Microsoft.IT.SCOM.SBWS.RunAsProfile.Account">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.Discovery.MapperSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" maxOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SyncTime" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" maxOccurs="1" name="ClassId" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" maxOccurs="1" name="InstanceSettings" type="SettingsType"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.SimpleScheduler">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
</DataSource>
<ProbeAction ID="Probe" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>TopicDiscovery.ps1</ScriptName>
<ScriptBody><Script>param($namespaceName, $hostName, $assemblyLocation)

$api = New-Object -comObject 'MOM.ScriptAPI'

$api.LogScriptEvent("TopicDiscovery.ps1",100,4,"Staring topic discovery for azure service bus namespace ${namespaceName}")

[Void][System.Reflection.Assembly]::LoadWithPartialName("System")
[Void][System.Reflection.Assembly]::LoadFile($assemblyLocation)

$conn = "Endpoint=sb://" + $hostName + "/" +$namespaceName + ";StsEndpoint=https://" + $hostName +":9355/" + $namespaceName +";RuntimePort=9354;ManagementPort=9355"
$bag = $api.CreatePropertyBag()
$namespaceManager = [Microsoft.ServiceBus.NamespaceManager]::CreateFromConnectionString($conn)

$topics = $namespaceManager.GetTopics()
$api.LogScriptEvent("TopicDiscovery.ps1",105,4,"got topics ${namespaceName}")

foreach($s in $topics) {

$api.LogScriptEvent("TopicDiscovery.ps1",106,4,"Discovered topic $($s.Path) in namespace ${namespaceName}")

$bag = $api.CreatePropertyBag()
$bag.AddValue("TopicName", $s.Path)
$bag

$success = $true
}

if($success){
$api.LogScriptEvent("TopicDiscovery.ps1",101,4,"Completed topic discovery for azure service bus namespace ${namespaceName}")
}

if (($Error.Count -gt 0) -and ($success -eq $false)) {
$api.LogScriptEvent("TopicDiscovery.ps1",200,1,"The following Errors occured while trying to discover the Service Bus for Windows Server topics on Namespace ${namespaceName}: " + $Error[0])
}</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>namespaceName</Name>
<Value>$Target/Property[Type="Microsoft.IT.SCOM.SBWS.Namespace"]/NamespaceName$</Value>
</Parameter>
<Parameter>
<Name>hostName</Name>
<Value>$Target/Property[Type="Microsoft.IT.SCOM.SBWS.Namespace"]/HostName$</Value>
</Parameter>
<Parameter>
<Name>assemblyLocation</Name>
<Value>$FileResource[Name="Microsoft.ServiceBus"]/Path$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
<ConditionDetection ID="Mapper" TypeID="System!System.Discovery.ClassSnapshotDataMapper">
<ClassId>$Config/ClassId$</ClassId>
<InstanceSettings>$Config/InstanceSettings$</InstanceSettings>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="Mapper">
<Node ID="Probe">
<Node ID="Scheduler"/>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>