Introduction to the Custom Notification Channel SDK in BizTalk360 version 8.0

Published on : Aug 16, 2016

Category : BizTalk360 Update

Rajeshkumar Kandhasamy

Author

One of the major capabilities of BizTalk360 is to monitor your BizTalk environment and notify you whenever there is some kind of an issue (e.g. a receive location is down, host instance has stopped, no messages received on a port, etc). In the previous versions of BizTalk360, the notifications from BizTalk360 can be sent through to static notification end points like SMS, Email, Windows Event log and HP Operation Manager. However from v8.0, we have added the brand new capability called “Custom Notifications Channels” to BizTalk360. Using this functionality end users can now send notification to a variety of external systems like Slack, ServiceNow, and they can also build their own custom notification channels to any external systems. With the introduction of custom notification channels it’s very easy to send alerts to any external systems like your ticketing system, internal databases, calling a REST endpoint, executing a PowerShell script, etc. You can read the full official documentation at our support portal BizTalk360 Assist. As part of BizTalk360 version 8.0 we have shipped two enterprise notification channels (Slack and ServiceNow), in the future we will be adding more channels out of the box. In order to use one of our out of the box channels, please check the article How to Configure Default Notification Channels in our support portal.

“Hello World” – Custom Notification Channels in BizTalk360

The best way to learn about the custom notification channels SDK is by creating an example. Let’s create a simple notification channel called “File Channel”. Basically, whenever an alarm is triggered, this channel will be called, which in turn will simply write the structured notification message in the file system with a GUID. This example will explain the core concepts with a simple example. You can download the sample template from GitHub . 1. Open the downloaded project and right click on the Solution Name and select Add New Project. Select Class Library project from the available Visual C# project types. 2. Name your Channel as “FileNotificationChannel”. 3. The System.Runtime.Serialization assembly needs to be added as a reference to this Project from the available Assemblies Framework’s. 4. The downloaded project will have Solution Items Folder, which will have three DLL’s, which need to be referenced into this project. These are:
  • B360.Notifier.Common.dll
  • log4net.dll
  • Newtonsoft.Json.dll
5. The downloaded project will have AlarmProperties.xml and GlobalProperties.xml files, these files must be added into this project and the files need to be an Embedded Resource files. Follow the below step: 1. Right click on the File and click on the Properties. 2. Make sure the “Build Action” is set to “Embedded Resource“. 6. Build the project, at this stage the project should compile successfully.

Core concepts

We have made the framework as simple as possible, you only need to know 3 important things:

GlobalProperties.xml

If you want to store any global properties for the channel, you can define the UI components in this xml file. For example, in our “File Channel”, we will require a default path where the files will need to be written.

AlarmProperties.xml

If you want to store any properties that goes at each alarm level, you can define the UI component in this xml file. For example, in our “File Channel”, you can give the option for alarms to overwrite the file path.

IChannelNotification interface

This is the core interface you need to implement, which contains 3 methods (GetGlobalPropertiesSchema, GetAlarmPropertiesSchema, and SendNotification). As the names suggest they are used to supply the global and alarm level UI configuration and a “SendNotification” method where you do your actual implementation. PS: Then notification SDK also comes with a helper library to perform some regular activities like formatting the alert into HTML, JSON, Text format, etc. Let’s take a look at each one of them.

Global Properties XML:

As you can see from the simple global properties XML file, we are simply creating a section with a title that contains a text box to accept the file path. We support the core UI controls like Textbox, check box, option box and radio button. All the attributes are self-explanatory. BizTalk360 - Global Properties Xml The settings side of the configuration UI will be rendered based on XML given, and it will be look like below: BizTalk360 - Configuration Notification Channel

Alarm Properties XML:

In a similar way to global properties XML, the alarm properties XML also looks pretty identical to our example, since we simply provide the option to overwrite the path at alarm level. BizTalk360 - Alarm Properties Xml In the alarm configuration under “Advanced Screen”, the configuration UI will be rendered based on XML given, and it will be look like below: BizTalk360 - Enable Notification Channel Alarm Configuration

Helper Class:

We need to have the Helper class to read the XML files, this function is utilized by the BizTalk360 service at runtime. This function will be called in the Notification Channel Class, which we will create in next step. BizTalk360 - Helper Class

Notification Channel Class:

In order to perform the required actions in our own Notification Channel, we need to have a Class “FileChannel”, which will inherit from the Interface “IChannelNotification” from the B360.Notifier.Common namespace. BizTalk360 - File Notification Channel BizTalk360 - File Notification Channel

Adding & Configuring Notification Channels in BizTalk360:

We can easily add the Notification Channels into BizTalk360. 1. Go to Settings. Under Monitoring and Notification side menu. 2. Click on the Manage Notification Channels Menu. 3. Click on the Add New Button. BizTalk360 - Notification Channels List 4. Provide your channel name as “File Notification Channel”. Let the Notification channel be Enabled. If required you can change the logo as well. 5. Choose the DLL (Go to the Project location, under Bin folder either Debug/Release folder will have the DLL). It’s called FileNotificationChannel.dll). 6. And Click on the “Validate and Render UI” button. BizTalk360 - UI Preview 7. And you will see the above screen, Click on Save Channel Button. 8. Immediately you will get the Blade window of Configure Notification Channel. Do the required changes and Click on Configure Button.

Associating Notification Channel to Alarm in BizTalk360:

Once if you added and configured the Notification channel in settings side, you will see the channel available while creating an alarm (In final tab of alarm creation). You can associate and configure the Notification channel specific to an alarm. We can integrate any required external system or output channel using this Custom Notification Channel SDK. This is one great way to integrate various operations systems with BizTalk360. There are few key points we have documented, which are available in Assist here. The Entire Sample of File Notification Channel is available on GitHub. The Sample Template also available on GitHub. Please feel free to download and utilize.