How to get an alarm state change in a smart client background plugin?

I have a smart client background plugin. To get an new alarm is no problem - MessageId “NewAlarmIndication”. But how can I get a change of an alarm state?

I try different messageIds (ChangedAlarmIndication, ChangedAlarmHistoryIndication, NewAlarmUpdatedIndication), but they didn’t work.

And how can I handle if I get more then on alarm at the same time? With “NewAlarmIndication” I get only one. In the alarm list in smart client I can see all alarms, but here only one??

I use the following test:

background plugin with

public override void Init()
{
    MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
    _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
 
    _obj2 = _messageCommunication.RegisterCommunicationFilter(NewX,
        new CommunicationIdFilter(MessageId.Server.NewAlarmIndication));
    _obj3 = _messageCommunication.RegisterCommunicationFilter(NewX, new CommunicationIdFilter(MessageId.Server.ChangedAlarmIndication));
    _obj4 = _messageCommunication.RegisterCommunicationFilter(NewX, new CommunicationIdFilter(MessageId.Server.ChangedAlarmHistoryIndication));
}

and

private object NewX(Message message, FQID destination, FQID sender)
{
    string mesId = message.MessageId;
    System.Windows.Forms.MessageBox.Show($"new {mesId}");
    return null;
}

and

public override List<EnvironmentType> TargetEnvironments
{
    get { return new List<EnvironmentType>() { EnvironmentType.SmartClient }; } // Default will run in the Event Server
}

If there is a new alarm I get “NewAlarmIndication”

If I in the alarm list sets the alarm “Acknowledge” (change state) I get “ChangedAlarmIndication”

If I open the alarm and add a comment to it I get “ChangedAlarmHistoryIndication”

If I make one event trigger two alarms by creating two alarm definitions, I get the “NewAlarmIndication” twice, one time for each alarm.

This is how it is supposed to be.

Can you please try again, perhaps using my code or perhaps reviewing your own code?

Hello Bo,

yes it works.

Many Thanks