Do you get an error? What alarms are being displayed if not the alarms based on the alarm definitions seen in Management Client? If you’re seeing any alarms, then that implies you’re seeing alarms generated via MIP SDK directly, but you’re not seeing alarms generated by the event server based on the alarm definitions? It would be really odd and unusual to see one but not the other.
Or are you seeing NewEventIndication results with events like “motion started” or “device not responding”?
The following snippet shows a simple method to subscribe to NewAlarmIndication messages and print them to the console and it works for me. I’m running 2020 R2 with MIP SDK 2020 R2 in a 64bit project.
private static void ListenForAlarms(ServerId serverId, ManualResetEventSlim signal)
{
try
{
MessageCommunicationManager.Start(serverId);
using (var mc = MessageCommunicationManager.Get(serverId))
{
var obj = mc.RegisterCommunicationFilter(NewAlarmHandler,
new CommunicationIdFilter(MessageId.Server.NewAlarmIndication));
signal.Wait();
mc.UnRegisterCommunicationFilter(obj);
}
}
finally
{
MessageCommunicationManager.Stop(serverId);
}
}
private static object NewAlarmHandler(Message message, FQID destination, FQID sender)
{
Console.WriteLine(JsonConvert.SerializeObject(message, Formatting.Indented));
return null;
}
And the following is the JSON representation of the alarm message received
{
"MessageId": "Server.NewAlarmIndication",
"RelatedFQID": null,
"Data": {
"EventHeader": {
"ID": "8fcdb897-dc47-4a1b-ad15-71edb0447868",
"Timestamp": "2020-07-14T17:43:32.5993849Z",
"Type": "System Alarm",
"Version": "1.0",
"Priority": 1,
"PriorityName": "High",
"Name": "Test Alarm",
"Message": "External Event",
"Source": {
"Name": "Test Trigger",
"FQID": {
"ServerId": {
"Type": "XPCO",
"Hostname": "msnode01.lab.local",
"Port": 80,
"Id": "266d03a1-9ca5-43dc-9638-2ae7ac9a45d2",
"Scheme": "http"
},
"ParentId": "266d03a1-9ca5-43dc-9638-2ae7ac9a45d2",
"ObjectId": "ce486af5-eef0-44fa-bcb4-88d3f143bde4",
"FolderType": 0,
"Kind": "c9bdac3f-41dc-4afa-b057-61767a3914b7"
}
},
"MessageId": "0fcb1955-0e80-4fd4-a78a-db47ee89700c"
},
"Description": "",
"State": 1,
"StateName": "New",
"CategoryName": "",
"AssignedTo": "",
"RuleList": [
{
"ID": "41c409d7-f5e9-4ad4-bde2-81fde40a760e",
"Name": "Test Alarm",
"Type": "4547f085-8b68-4639-826f-8722afb0ffc5"
}
],
"ReferenceList": []
},
"Reason": null,
"ExternalMessageSourceEndPoint": {
"ServerId": {
"Type": "Service",
"Hostname": "MSNODE01",
"Port": 80,
"Id": "6810bc2a-5ebb-4587-a183-2d5631e867b7",
"Scheme": "http"
},
"ObjectId": "6810bc2a-5ebb-4587-a183-2d5631e867b7",
"FolderType": 0,
"Kind": "3b25fe94-7c2f-499a-86df-2fa68aa3e1b5"
}
}
Finally, here is the alarm definition this alarm was based on. The trigger is a user-defined event.