Receiving External Events

Hi We have just upgraded to 2018R1 and are now using Expert edition, our plugin was originally created on the Professional Edition. We have set up a few listeners;

   messageReferences.Add(messageComms.RegisterCommunicationFilter(TriggerEventHandler,

      new CommunicationIdFilter(MessageId.Server.NewEventsIndication)));

    messageReferences.Add(messageComms.RegisterCommunicationFilter(TriggerEventHandler,

      new CommunicationIdFilter(MessageId.Server.NewEventIndication)));

    messageReferences.Add(messageComms.RegisterCommunicationFilter(TriggerEventHandler,

     new CommunicationIdFilter(MessageId.Server.ExternalEventMessage)));

    messageReferences.Add(messageComms.RegisterCommunicationFilter(TriggerEventHandler,

     new CommunicationIdFilter(MessageId.Server.NewAlarmCommand)));

But we dont seem to be receiving through the events anymore, either by testing the even in the admin app or smart client. What am i doing wrong ?

Any help would be great, what is different in this aspect between XProtect editions?

Regards,

Phill

What environment is this? (Smart Client / Management Client / Event Server?)

The two last ones, ExternalEventMessage and NewAlarmCommand, will never give anything.

NewEventsIndication will give multiple BaseEvents in an array where NewEventIndication will give one BaseEvent at a time. So in essence you should get everything twice. I wonder if the TriggerEventHandler does get data but in an unexpected format, try to set a breakpoint and see if it does.

If you get nothing I would suspect that the start-up might an issue, timing or otherwise. Can you please outline (or show with a code-snippet) how you start the MessageCommunication?

Hi Bo,

I tried adding as many as i can for covering every eventuality. I actually have a breakpoint on my method but it doesn’t give anything when an alarm is triggered so the method isn’t even being hit.

The environment is Event Server and i do all my message receivers in Init(). Other messages are coming through ok (Our internal messages for the plugin) so i know message communication itself works.

public override void Init()
        {
EnvironmentManager.Instance.TraceFunctionCalls = true;
MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                messageComms = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
                messageReferences = new List<object>();
 messageReferences.Add(messageComms.RegisterCommunicationFilter(eyevisEventHandler,
                    new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageId.Server.NewEventCommand)));
}

Thats a stripped down but i also create other message receivers for our inhouse ones too, which as i mentioned do work ok.

Regards,

Phill

OK, so testing further, Analytics events when tested from the admin application do come through. User Defined events arent though. What is the difference between these and should they both come through when registered as:

   messageReferences.Add(messageComms.RegisterCommunicationFilter(TriggerEventHandler,
 
          new CommunicationIdFilter(MessageId.Server.NewEventIndication)));

Are you by chance casting the message.Data as EventData? It should be casted as BaseEvent. This was changed very long ago but you might be coming from a very old version. Could be the issue depending on where you put the breakpoint when saying the handler is never being hit.

The breakpoint is on the method itself. It isn’t even hitting ‘TriggerEventHandler’, as mentioned the analytics event does if i test manually in the Management Client, but User-Defined events do not. I am casting it as Base Event;

  BaseEvent eventData = message.Data as BaseEvent;

If you want i can get you a teamviewer on to my Dev VM and take a look if that will help?

I might get back to that offer. I am conducting some experiments.. I am out of office for two days but will get back on this.

Thanks Bo, am i missing anything else which could be different between 2017 and 2018 MIP SDK and Professional / Expert XProtect?

The answer should be that this functionality should not be any different in the versions you mention.

Please run a test where you use the Event Tracer tool plugin sample. See if you get any “External Events” on triggering the user defined events.

If you get the same behavior with the sample the issue must be in your XProtect, if the sample works we should look into your code implementation. It would be a good step to establish whether the XProtect system behaves unexpected or your plugin does.

Hi Bo, For some reason it looks like i had deleted the mipplugin’s for events on the event server!! Restoring this and it now works. Sorry!!! Days I have been looking at this! Thank you very very very much for your help, it looks like for communication it needs those plugins for generic events.

Hi @Phill Whitehead​, @Bo Ellegård Andersen (Milestone Systems)​

Could you please remember which plugins exactly were removed and then restored?

I have the similar issue now - the standard sample (…\MIPSDK\ComponentSamples\AlarmViewer) doesn’t notify about any alarms/events/etc.

Regards,

Alex.

Hi, I don’t remember the exact ones sorry. There is an SDK Redistributable which I think puts the plugins on.