Is it possible to receive messages in an event plugin?

Hi,

We are writing an event plugin and like to receive custom messages from another (client) plugin. The same code works between different client plugins and stand-alone client, but it doesn’t work when implementing it in the event plugin.

The code does the following in order listen to messages from other plugins:

MessageCommunicationManager.Start(<ServerId>);
MessageCommunication = MessageCommunicationManager.Get(<ServerId>);
 
MessageCommunication.RegisterCommunicationFilter(<MessageReceiver>, <CommunicationIdFilter>, null, EndPointType.Any);
 

But nothing is received in handler.

The custom message is sent from a client plugin like this:

MessageCommunication.TransmitMessage(<Message>, null, null, MessageCommunicationManager.EndPointFQID)

Is this supported in an event plugin or is it something that needs to be done differently to make it work?

We tried to reproduce your symptom but no success so far. Please see what we did and please test this -

MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
MessageCommunication _message =  MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
_message.RegisterCommunicationFilter( myMessageHandler , new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageIdChatLine), null, EndPointType.Any);
 
private object myMessageHandler(Message message, FQID destination, FQID sender)
{
    EnvironmentManager.Instance.Log(false, "ConfigDump something happen.", null);
    return null;
}

The only the difference between your code and our test is here, the last parameter -

_messageCommunication.TransmitMessage(new VideoOS.Platform.Messaging.Message(MessageIdChatLine, data), null, null, null);

Hi, thank you for your answer.

Changing the last argument (FQID source) to null, did not make any difference. Did you run the receiver code (first) in an event plugin, e.g.

<plugin>
   <file name="XXX.dll"/>
   <load env="Service"/>
</plugin>

Also, could it be due to some system configuration on my system, e.g. firewalls preventing traffic. Is there something I could test to verify that system configuration is working for this use-cse?

The test Rie made was made by modifying the ConfigDump tools sample BackgroundPlugin, could you test the same way?

For debugging whether network traffic blocks could be the caseu of the issue please use: https://developer.milestonesys.com/s/article/Ports-for-alarms-from-Milestone-Event-Server-service

I found out what the problem was. I ran the code to early. Apparently, communications was not yet setup when my code was run (in the Init() method). I didn’t think about that the event server is responsible for communications.

I now wait 10 seconds before setting up the listener and everything works as expected! Thanks for the help!